delete.template

来自「这个代码生成工具是针对java command framework(简称jcf)」· TEMPLATE 代码 · 共 55 行

TEMPLATE
55
字号
package #commandPackagePath#;
import java.util.Map;
import org.apache.log4j.Logger;
import com.gsta.eshore.framework.jcf.Command;
import com.gsta.eshore.framework.jcf.JCFException;
import #errorCodeClass#;
import #daoPackagePath#.#daoClass#;
import #modelPackagePath#.#entityClass#;

/**
 * @author He-WenQiang. Create in #dateTime#.
 *
 */
public class #commandClass# extends Command
{
	private static Logger logger=Logger.getLogger(#commandClass#.class);
	private #daoClass# dao;
	public void setDao(#daoClass# dao) {
		this.dao = dao;
	}

	public void execute(Map params, Map response) throws Exception
	{
		logger.debug("#commandClass# Command starting. ");
		#entityClass# #entityClassInstance# = (#entityClass#) params.get("#entityClassInstance#");
		if (check#entityClass#(#entityClassInstance#)) {
			String msg = "#commandClass# PARAM_ERR ,#entityClassInstance# is not validated!";
			throw new JCFException(ErrorCode.PARAM_ERR, msg);
		}
		try {
		dao.delete(#entityClassInstance#);
		response.put("resultBoolean",Boolean.valueOf(true));
		} catch (Exception e) {
		    e.printStackTrace();
			throw new JCFException(ErrorCode.DB_OP_ERR,"#commandClass#");
		}
	}
	
	private boolean check#entityClass#(#entityClass# #entityClassInstance#){
	     //print your code here;
		return false;
	}

	public void fini() throws JCFException
	{
	}

	public void init(String arg0) throws JCFException
	{

	}


}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?