Java Code Examples for org.apache.ibatis.jdbc.SQL#UPDATE

The following examples show how to use org.apache.ibatis.jdbc.SQL#UPDATE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserSqlProvider.java    From SpringbootMybatis with Apache License 2.0 6 votes vote down vote up
/**
 * This method was generated by MyBatis Generator.
 * This method corresponds to the database table user
 *
 * @mbg.generated
 */
public String updateByExampleSelective(Map<String, Object> parameter) {
    User record = (User) parameter.get("record");
    UserCriteria example = (UserCriteria) parameter.get("example");
    
    SQL sql = new SQL();
    sql.UPDATE("user");
    
    if (record.getId() != null) {
        sql.SET("id = #{record.id,jdbcType=INTEGER}");
    }
    
    if (record.getUsername() != null) {
        sql.SET("username = #{record.username,jdbcType=VARCHAR}");
    }
    
    if (record.getPsw() != null) {
        sql.SET("psw = #{record.psw,jdbcType=VARCHAR}");
    }
    
    applyWhere(sql, example, true);
    return sql.toString();
}
 
Example 2
Source File: UserSqlProvider.java    From SpringbootMybatis with Apache License 2.0 6 votes vote down vote up
/**
 * This method was generated by MyBatis Generator.
 * This method corresponds to the database table user
 *
 * @mbg.generated
 */
public String updateByPrimaryKeySelective(User record) {
    SQL sql = new SQL();
    sql.UPDATE("user");
    
    if (record.getUsername() != null) {
        sql.SET("username = #{username,jdbcType=VARCHAR}");
    }
    
    if (record.getPsw() != null) {
        sql.SET("psw = #{psw,jdbcType=VARCHAR}");
    }
    
    sql.WHERE("id = #{id,jdbcType=INTEGER}");
    
    return sql.toString();
}
 
Example 3
Source File: UserSqlProvider.java    From SpringbootMybatis with Apache License 2.0 5 votes vote down vote up
/**
 * This method was generated by MyBatis Generator.
 * This method corresponds to the database table user
 *
 * @mbg.generated
 */
public String updateByExample(Map<String, Object> parameter) {
    SQL sql = new SQL();
    sql.UPDATE("user");
    
    sql.SET("id = #{record.id,jdbcType=INTEGER}");
    sql.SET("username = #{record.username,jdbcType=VARCHAR}");
    sql.SET("psw = #{record.psw,jdbcType=VARCHAR}");
    
    UserCriteria example = (UserCriteria) parameter.get("example");
    applyWhere(sql, example, true);
    return sql.toString();
}