/** * 默认方法 查询现有的数据权限组 * * @throws ToftException */ public void doInsert() throws ToftException { Map params = this.getContext().getAllParams(); params.put("flag", "1"); params.put("status", "1"); TableUtils utils = TableUtils.getUtils("dataGroup"); // 同一类型下组名称重复性验证 String group_name = (String) this.getContext().getParam("group_name"); String data_id = (String) this.getContext().getParam("data_id"); // select * from sys_data_group where group_name= String sqlcode = "select count(*) from sys_data_group where data_id='" + data_id + "'and group_name='" + group_name + "'"; int countcode = SqlUtils.selectInteger(sqlcode, this.getContext().getConn()); if (countcode > 0) { // 缂栧彿閲嶅 throw ToftException.ThrowToftException(getText("norepeat")); } String msg = utils.execute(); this.getContext().dataResult.setMessage(msg); }
/** * 在更新的时候加上验证 同一类型下 * * @throws ToftException */ public void doUpdate() throws ToftException { TableUtils utils = TableUtils.getUtils("dataGroup"); // 同一类型下组名称重复性验证 String group_name = (String) this.getContext().getParam("group_name"); String data_id = (String) this.getContext().getParam("data_id"); // select * from sys_data_group where group_name= String sqlcode = "select count(*) from sys_data_group where data_id='" + data_id + "'and group_name='" + group_name + "'"; int countcode = SqlUtils.selectInteger(sqlcode, this.getContext().getConn()); if (countcode > 0) { // 抛出异常-提示同一类型下组名不重复 throw ToftException.ThrowToftException(getText("norepeat")); } String msg = utils.execute(); this.getContext().dataResult.setMessage(msg); }
public void processor() throws ToftException { // DataGroupOperate的默认方法 TableUtils utils = TableUtils.getUtils("dataGroup"); String msg = utils.execute(); // 查询返回操作信息字符串 this.getContext().dataResult.setMessage(msg); // 把该字符串设置到dataresult中 }