示例#1
0
  /**
   * 默认方法 查询现有的数据权限组
   *
   * @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);
  }
示例#2
0
  /**
   * 显示查询dataGroup表的查询数据
   *
   * @throws ToftException
   */
  public void querydataGroup() throws ToftException {
    String querygroup_name = (String) this.getContext().getAllParams().get("querygroup_name");

    String where = "";

    // 如果querydata_name不为空,修改查询的where条件
    if ((querygroup_name != null) && !("".equals(querygroup_name))) {

      where = " and  group_name like '%" + querygroup_name + "%'"; // 查询字段
    }

    TableUtils utils = TableUtils.getUtils("dataGroup");
    Map map = utils.pageSelect(where, null);
    this.getContext().addAttribute("result", map);
  }
示例#3
0
  /**
   * 在更新的时候加上验证 同一类型下
   *
   * @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);
  }
示例#4
0
 public void processor() throws ToftException { // DataGroupOperate的默认方法
   TableUtils utils = TableUtils.getUtils("dataGroup");
   String msg = utils.execute(); // 查询返回操作信息字符串
   this.getContext().dataResult.setMessage(msg); // 把该字符串设置到dataresult中
 }