示例#1
0
  /**
   * 创建 短信用户组
   *
   * @param id
   * @return deleted count
   */
  public Messgroup createMessgroup(Messgroup messgroup) throws SQLException {

    if (messgroup.getId() > 0) {
      throw new SQLException("ID must <= 0.");
    }
    messgroup.setId(
        DBTools.getID(getSqlMapClientTemplate().getDataSource().getConnection(), "T_MESSGROUP"));
    getSqlMapClientTemplate().insert("createMessgroup", messgroup);
    return messgroup;
  }
示例#2
0
  /**
   * 修改 短信用户组但忽略空值
   *
   * @param id
   * @return
   */
  public int updateMessgroupIgnoreNull(Messgroup messgroup) {
    Messgroup tmp = findMessgroup(messgroup.getId());
    int flag = 0;

    if (messgroup.getMessname() != null) {
      tmp.setMessname(messgroup.getMessname());

      flag++;
    }

    if (messgroup.getMessnums() != null) {
      tmp.setMessnums(messgroup.getMessnums());

      flag++;
    }

    if (messgroup.getCreatetime() != null) {
      tmp.setCreatetime(messgroup.getCreatetime());

      flag++;
    }

    if (messgroup.getCreateuserid() != null) {
      tmp.setCreateuserid(messgroup.getCreateuserid());

      flag++;
    }

    if (messgroup.getParam1() != null) {
      tmp.setParam1(messgroup.getParam1());

      flag++;
    }

    if (messgroup.getParam2() != null) {
      tmp.setParam2(messgroup.getParam2());

      flag++;
    }

    if (messgroup.getParam3() != null) {
      tmp.setParam3(messgroup.getParam3());

      flag++;
    }

    if (flag == 0) {
      return 0;
    } else {
      return getSqlMapClientTemplate().update("updateMessgroup", tmp);
    }
  }