|
|
@ -10,7 +10,15 @@ public interface UfActiveRecordMapper { |
|
|
|
"SELECT * FROM ${tableName} " + |
|
|
|
"<if test='conditions != null'>" + |
|
|
|
"WHERE " + |
|
|
|
"<foreach collection='conditions' item='value' index='key' separator=' AND '>`${key}` = #{value}</foreach>" + |
|
|
|
"<foreach collection='conditions' item='value' index='key' separator=' AND '>" + |
|
|
|
"<if test='value instanceof java.util.List'>" + |
|
|
|
"`${key}` IN " + |
|
|
|
"(<foreach collection='value' item='valueItem' separator=','>#{valueItem}</foreach>)" + |
|
|
|
"</if>" + |
|
|
|
"<if test='!(value instanceof java.util.List)'>" + |
|
|
|
"`${key}` = #{value}" + |
|
|
|
"</if>" + |
|
|
|
"</foreach>" + |
|
|
|
"</if> " + |
|
|
|
"<if test='orders != null'>" + |
|
|
|
"ORDER BY " + |
|
|
@ -27,11 +35,19 @@ public interface UfActiveRecordMapper { |
|
|
|
"SELECT COUNT(*) FROM ${tableName} " + |
|
|
|
"<if test='conditions != null'>" + |
|
|
|
"WHERE " + |
|
|
|
"<foreach collection='conditions' item='value' index='key' separator=' AND '>`${key}` = #{value}</foreach>" + |
|
|
|
"<foreach collection='conditions' item='value' index='key' separator=' AND '>" + |
|
|
|
"<if test='value instanceof java.util.List'>" + |
|
|
|
"`${key}` IN " + |
|
|
|
"(<foreach collection='value' item='valueItem' separator=','>#{valueItem}</foreach>)" + |
|
|
|
"</if>" + |
|
|
|
"<if test='!(value instanceof java.util.List)'>" + |
|
|
|
"`${key}` = #{value}" + |
|
|
|
"</if>" + |
|
|
|
"</foreach>" + |
|
|
|
"</if>" + |
|
|
|
"</script>" |
|
|
|
) |
|
|
|
Integer count(UfActiveRecordCriteria criteria); |
|
|
|
Integer count(String tableName, Map<String,Object> conditions); |
|
|
|
|
|
|
|
@Select("SELECT * FROM ${tableName} WHERE id = #{id}") |
|
|
|
Map<String,Object> findById(String tableName, String id); |
|
|
@ -49,12 +65,24 @@ public interface UfActiveRecordMapper { |
|
|
|
@Update( |
|
|
|
"<script>" + |
|
|
|
"UPDATE ${tableName} SET " + |
|
|
|
"<foreach collection='data' item='value' index='key' separator=','>${key} = #{value}</foreach>" + |
|
|
|
"<foreach collection='data' item='value' index='key' separator=','>`${key}` = #{value}</foreach>" + |
|
|
|
"WHERE id = #{id}" + |
|
|
|
"</script>" |
|
|
|
) |
|
|
|
Integer update(String tableName, String id, Map<String,Object> data); |
|
|
|
|
|
|
|
@Update( |
|
|
|
"<script>" + |
|
|
|
"UPDATE ${tableName} SET " + |
|
|
|
"<foreach collection='data' item='value' index='key' separator=','>`${key}` = #{value}</foreach>" + |
|
|
|
"<if test='conditions != null'>" + |
|
|
|
"WHERE " + |
|
|
|
"<foreach collection='conditions' item='value' index='key' separator=' AND '>`${key}` = #{value}</foreach>" + |
|
|
|
"</if> " + |
|
|
|
"</script>" |
|
|
|
) |
|
|
|
Integer updateAll(String tableName, Map<String,Object> conditions, Map<String,Object> data); |
|
|
|
|
|
|
|
@Delete("DELETE FROM ${tableName} WHERE id = #{id}") |
|
|
|
Integer delete(String tableName, String id); |
|
|
|
} |