public IView execute(HttpServletRequest request, HttpServletResponse response) { NodeCondition vo = BeanUtils.getBean(request, NodeCondition.class); vo.setValue(request.getParameter("values")); if (NodeCondition.add(vo) == 1) { return new JspView("/app/workflow/condition/show.jsp?nodeId=" + vo.getNodeId()); } else { return new JspErrorView("添加节点条件失败"); } }
public static int add(NodeCondition vo) { // 指定值对象类型(VOClass)。例子:User // 指定插入表名称(tableName)。例子:如user表3个列,tableName=user(id, name, gender) // 根据列的顺序获取值对象的属性值。例子:vo.getId(), vo.getName(), vo.getGender() return SimpleDaoTemplate.update( "INSERT INTO wf_node_condition(nodeId, model, modelName, type, typeName, value, valueName, sign) VALUES(?, ?, ?, ?, ?, ?, ?, ?)", vo.getNodeId(), vo.getModel(), vo.getModelName(), vo.getType(), vo.getTypeName(), vo.getValue(), vo.getValueName(), vo.getSign()); }
public static int edit(NodeCondition vo) { // 指定值对象类型(VOClass)。例子:User // 指定插入表名称(tableName)。例子:如user表3个列,tableName=user // 指定修改列信息(modify)。例子:name=?, value=? // 根据修改列的顺序获取值对象的属性值。例子:vo.getName(), vo.getValue(), vo.getId() return SimpleDaoTemplate.update( "UPDATE wf_node_condition SET nodeId = ?, model = ?, modelName = ?, type = ?, typeName = ?, value = ?, valueName = ?, sign = ? WHERE id = ?", vo.getNodeId(), vo.getModel(), vo.getModelName(), vo.getType(), vo.getTypeName(), vo.getValue(), vo.getValueName(), vo.getSign(), vo.getId()); }