コード例 #1
0
  /**
   * 新增申成知道提问
   *
   * @param cloudKnowAsk
   * @throws Exception
   */
  public static void insertCloudKnowAsk(CloudKnowAsk cloudKnowAsk) throws Exception {
    String sql =
        "insert into cloud_know_ask(id,user_id,question,description,type,urgent,state,"
            + "create_date,create_time,create_ip,update_date,update_time,update_ip) values "
            + "(null,"
            + cloudKnowAsk.getUserId()
            + ",'"
            + cloudKnowAsk.getQuestion()
            + "','"
            + cloudKnowAsk.getDescription()
            + "','"
            + cloudKnowAsk.getType()
            + "',"
            + cloudKnowAsk.getUrgent()
            + ","
            + cloudKnowAsk.getState()
            + ",'"
            + cloudKnowAsk.getCreateDate()
            + "','"
            + cloudKnowAsk.getCreateTime()
            + "','"
            + cloudKnowAsk.getCreateIp()
            + "','"
            + cloudKnowAsk.getUpdateDate()
            + "','"
            + cloudKnowAsk.getUpdateTime()
            + "','"
            + cloudKnowAsk.getUpdateIp()
            + "')";
    DB.executeUpdate(sql);

    cloudKnowAsk.setId(getMaxIdByUserId(cloudKnowAsk.getUserId()));
  }
コード例 #2
0
 /**
  * 更新申成知道提问
  *
  * @param cloudKnowAsk
  * @throws Exception
  */
 public static void updateCloudKnowAsk(CloudKnowAsk cloudKnowAsk) throws Exception {
   String sql =
       "update cloud_know_ask set question='"
           + cloudKnowAsk.getQuestion()
           + "',description='"
           + cloudKnowAsk.getDescription()
           + "',type='"
           + cloudKnowAsk.getType()
           + "',urgent="
           + cloudKnowAsk.getUrgent()
           + ",state="
           + cloudKnowAsk.getState()
           + ",update_date='"
           + cloudKnowAsk.getUpdateDate()
           + "',update_time='"
           + cloudKnowAsk.getUpdateTime()
           + "',update_ip='"
           + cloudKnowAsk.getUpdateIp()
           + "' where id="
           + cloudKnowAsk.getId();
   DB.executeUpdate(sql);
 }