update.template

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

TEMPLATE
61
字号
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 #modelPackagePath#.#entityClass#;
import #daoPackagePath#.#daoClass#;

/**
 * @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.update(#entityClassInstance#);
			response.put("resultBoolean",Boolean.valueOf(true));
		} catch (Exception e) {
		    e.printStackTrace();
			response.put("resultBoolean",Boolean.valueOf(false));
			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
	{
		logger.debug("DeleteFunctionById Command init. ");
	}


}

⌨️ 快捷键说明

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