Package org.springframework.jdbc.core.namedparam

Examples of org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource


   * @return
   */
  public int insertModelLog(ModelLog modelLog) {
    String sql = "insert into sys_model_log(model_name,user_name,time,content,model_content)"
        + " values(:modelName,:userName,now(),:content,:modelContent)";
    SqlParameterSource paramMap = new BeanPropertySqlParameterSource(modelLog);
    return namedParameterJdbcTemplate.update(sql, paramMap);
  }
View Full Code Here


   * @param docLog
   * @return
   */
  public int insertDocLog(DocLog docLog) {
    String sql = "insert into sys_doc_log(docid,user_name,time,content) values(:docid,:userName,:time,:content)";
    SqlParameterSource paramMap = new BeanPropertySqlParameterSource(docLog);
    return namedParameterJdbcTemplate.update(sql, paramMap);
  }
View Full Code Here

   * @param doc
   */
  public int insertDoc(Doc doc) {
    String sql = "insert into bu_doc(docid,title,content,digest,modify_user,del,reporter,last_modify,url,type,keyword,model_name,status) "
        + "values(:docid,:title,:content,:digest,:modifyUser,'0',:reporter,now(),:url,:type,:keyword,:modelName,status)";
    SqlParameterSource paramMap = new BeanPropertySqlParameterSource(doc);
    return namedParameterJdbcTemplate.update(sql, paramMap);
  }
View Full Code Here

   */
  public int updateDoc(Doc doc) {
    String sql = "update bu_doc set title=:title"
        + ",content=:content,digest=:digest,modify_user=:modifyUser,"
        + "reporter=:reporter,url=:url,type=:type,keyword=:keyword,model_name=:modelName,status=:status,last_modify = now() where docid =:docid";
    SqlParameterSource paramMap = new BeanPropertySqlParameterSource(doc);
    return namedParameterJdbcTemplate.update(sql, paramMap);
  }
View Full Code Here

   * @param docid
   * @param status
   */
  public int updateDocStatus(Doc doc) {
    String sql = "update bu_doc set status  = :status where docid = :docid";
    SqlParameterSource paramMap = new BeanPropertySqlParameterSource(doc);
    return namedParameterJdbcTemplate.update(sql, paramMap);
  }
View Full Code Here

   * @param ftpSetting
   */
  public void insertFtpSetting(FtpSetting ftpSetting) {
    String sql = "insert into sys_ftp(ftp_ip,ftp_port,username,password,ftp_path,ftp_push_rate,enable)"
        + " values(:ftpIp,:ftpPort,:username,:password,:ftpPath,:ftpPushRate,:enable)";
    SqlParameterSource paramMap = new BeanPropertySqlParameterSource(ftpSetting);
    namedParameterJdbcTemplate.update(sql, paramMap);
  }
View Full Code Here

   * @param ftpSetting
   */
  public void updateFtpSetting(FtpSetting ftpSetting) {
    String sql = "update sys_ftp set ftp_ip=:ftpIp,ftp_port=:ftpPort,username=:username,password=:password,"
        + "ftp_path=:ftpPath,ftp_push_rate=:ftpPushRate,enable=:enable";
    SqlParameterSource paramMap = new BeanPropertySqlParameterSource(ftpSetting);
    namedParameterJdbcTemplate.update(sql, paramMap);
  }
View Full Code Here

  * @throws DataAccessException
  */
  public int insertUser(User user) throws DataAccessException{
     String sql = "insert into bu_user(user_name,password,position_num,add_user,add_time,last_login,del,nickname) "
        + "values (:userName,password(:password),:positionNum,:addUser,now(),now(),0,:nickName)";
     SqlParameterSource paramMap = new BeanPropertySqlParameterSource(user);
    return namedParameterJdbcTemplate.update(sql, paramMap);
   }
View Full Code Here

   */
  public int updateUserInfo(User user) {
    String sql = "update bu_user set position_num=:positionNum ,"
        + " email=:email , telephone=:telephone , mobile=:mobile , nickname=:nickName "
        + "where user_name = :userName";
    SqlParameterSource paramMap = new BeanPropertySqlParameterSource(user);
    return namedParameterJdbcTemplate.update(sql, paramMap);
  }
View Full Code Here

  /**
   * 使用Bean形式的命名参数, Bean的属性名称应与命名参数一致.
   */
  public void createObject(User user) {
    //使用BeanPropertySqlParameterSource将User的属性映射为命名参数.
    BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(user);
    jdbcTemplate.update(INSERT_USER, source);
  }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.