修复长整形问题,基础包新增count方法
This commit is contained in:
@@ -44,4 +44,6 @@ public interface TableMapper {
|
||||
Object getSequence(@Param("tableName") String tableName);
|
||||
|
||||
int createSequence(@Param("tableName") String tableName, @Param("lastId")Object lastId);
|
||||
|
||||
Long count(@Param("tableName")String tableName,@Param("sql")String sql);
|
||||
}
|
||||
|
||||
@@ -122,4 +122,6 @@ public interface BaseMapper {
|
||||
|
||||
Map<String, Object> selectOneSql(String sql);
|
||||
|
||||
Long count(String tableName, Condition condition);
|
||||
|
||||
}
|
||||
|
||||
@@ -199,9 +199,7 @@ public class BaseMapperImpl implements BaseMapper {
|
||||
Condition condition = Condition.creatCriteria()
|
||||
.andIn(dataMap.getPkName(), dataMap.getIdList())
|
||||
.build();
|
||||
int i = tableMapper.updateByWhere(dataMap.getData(), dataMap.getTableName(), condition.getSql());
|
||||
SqlException.base(i, "更新失败");
|
||||
return i;
|
||||
return tableMapper.updateByWhere(dataMap.getData(), dataMap.getTableName(), condition.getSql());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -601,6 +599,11 @@ public class BaseMapperImpl implements BaseMapper {
|
||||
return tableMapper.userSqlByOne(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long count(String tableName, Condition condition) {
|
||||
return tableMapper.count(tableName,condition.getSql());
|
||||
}
|
||||
|
||||
public void JudgesNull(Object object, String str) {
|
||||
if (object == null) {
|
||||
throw new BaseMapperException(str);
|
||||
|
||||
@@ -251,6 +251,9 @@ public class Condition implements Serializable {
|
||||
|
||||
public ConditionBuilder equal(String key, Object value) {
|
||||
sqlCheck(value);
|
||||
if (value.toString().contains("\"")) {
|
||||
value = value.toString().replaceAll("\"", "");
|
||||
}
|
||||
this.conditionSql += " " + key + EQUAL + "'" + value + "'";
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -164,4 +164,7 @@
|
||||
select ${tableName}_seq.nextval
|
||||
from dual
|
||||
</select>
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
SELECT count(0) FROM ${tableName} ${sql}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user