2023年7月28日

myBatis update and return

 public interface SystemParameterDAO {

/**

* @see SystemParameterSqlBuilder#update

*/

@UpdateProvider(type = SystemParameterSqlBuilder.class, method = "update")

@Options(statementType= StatementType.CALLABLE)

void update( SystemParameter systemParameter);


class SystemParameterSqlBuilder {

public String updateById() {

return "BEGIN "

+ "        UPDATE system_parameter"

+ "        SET system_param_value = #{systemParamValue},"

+ "            update_time = current_timestamp"

+ "        WHERE  system_param_name = #{systemParamName}"

+ "            RETURNING CREATE_TIME, UPDATE_TIME INTO #{createTime, mode=OUT, jdbcType=TIMESTAMP}, #{updateTime, mode=OUT, jdbcType=TIMESTAMP};"

+ "   END;     ";


}

}

}