Example #1
0
  /**
   * 创建 留点记录表
   *
   * @param id
   * @return deleted count
   */
  public Liudianrecord createLiudianrecord(Liudianrecord liudianrecord) throws SQLException {

    if (liudianrecord.getId() > 0) {
      throw new SQLException("ID must <= 0.");
    }
    liudianrecord.setId(
        DBTools.getID(
            getSqlMapClientTemplate().getDataSource().getConnection(), "T_LIUDIANRECORD"));
    getSqlMapClientTemplate().insert("createLiudianrecord", liudianrecord);

    return liudianrecord;
  }
Example #2
0
  /**
   * 修改 留点记录表但忽略空值
   *
   * @param id
   * @return
   */
  public int updateLiudianrecordIgnoreNull(Liudianrecord liudianrecord) {
    Liudianrecord tmp = findLiudianrecord(liudianrecord.getId());
    int flag = 0;

    if (liudianrecord.getFandianstart() != null) {
      tmp.setFandianstart(liudianrecord.getFandianstart());

      flag++;
    }

    if (liudianrecord.getFandianend() != null) {
      tmp.setFandianend(liudianrecord.getFandianend());

      flag++;
    }

    if (liudianrecord.getLiudian() != null) {
      tmp.setLiudian(liudianrecord.getLiudian());

      flag++;
    }

    if (liudianrecord.getAgentid() != null) {
      tmp.setAgentid(liudianrecord.getAgentid());

      flag++;
    }

    if (liudianrecord.getTypeid() != null) {
      tmp.setTypeid(liudianrecord.getTypeid());

      flag++;
    }

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