shiqian 4 rokov pred
rodič
commit
0ade38454e

+ 29 - 26
boman-web-core/src/main/java/com/boman/web/core/mapper/StandardMapper.java

@@ -73,14 +73,14 @@ public interface StandardMapper {
     /**
      * 功能描述: 通用修改  {@link SqlProvider#update(java.util.Map)}
      *
-     * @param tableName        tableName
-     * @param packCommitData   packCommitData
-     * @param packColCondition packColCondition
+     * @param tableName      tableName
+     * @param packCommitData packCommitData
+     * @param condition      condition
      * @return int
      */
     @UpdateProvider(type = SqlProvider.class, method = "update")
     int update(@Param("tableName") String tableName, @Param("packCommitData") JSONObject packCommitData
-            , @Param("packColCondition") JSONObject packColCondition);
+            , @Param("packColCondition") JSONObject packColCondition, @Param("condition") JSONObject condition);
 
 
     /* ***************************************************** select ******************************************************/
@@ -120,16 +120,17 @@ public interface StandardMapper {
      * 功能描述: 自定义查询,需要查询的字段和value都在condition中
      * {@link SqlProvider#selectByCondition(Map)}
      *
-     * @param tableName     tableName
-     * @param packCondition 封装好的查询条件
-     * @param showData      需要查询的列
-     * @param orderBy       orderBy
-     * @param limit         分页
-     * @param offset        分页, 可以为null
+     * @param tableName tableName
+     * @param condition 封装好的查询条件
+     * @param showData  需要查询的列
+     * @param orderBy   orderBy
+     * @param limit     分页
+     * @param offset    分页, 可以为null
      * @return java.util.List<com.alibaba.fastjson.JSONObject>
      */
     @SelectProvider(type = SqlProvider.class, method = "selectByCondition")
     List<JSONObject> selectByCondition(@Param("tableName") String tableName
+                                       , @Param("condition") JSONObject condition
                                        , @Param("packCondition") JSONObject packCondition
                                        , @Param("showData") List<String> showData
                                        , @Param("orderBy") String orderBy
@@ -140,17 +141,18 @@ public interface StandardMapper {
      * 功能描述: 自定义查询,需要查询的字段和value都在condition中
      * {@link SqlProvider#selectByLeftJoinCondition(Map)}
      *
-     * @param queryBySql    queryBySql
-     * @param packCondition 封装好的查询条件
-     * @param showData      需要查询的列
-     * @param orderBy       orderBy
-     * @param limit         分页
-     * @param offset        分页, 可以为null
+     * @param queryBySql queryBySql
+     * @param condition  封装好的查询条件
+     * @param showData   需要查询的列
+     * @param orderBy    orderBy
+     * @param limit      分页
+     * @param offset     分页, 可以为null
      * @return java.util.List<com.alibaba.fastjson.JSONObject>
      */
     @SelectProvider(type = SqlProvider.class, method = "selectByLeftJoinCondition")
     List<JSONObject> selectByLeftJoinCondition(@Param("queryBySql") QueryBySqlDto queryBySql
                                        , @Param("packCondition") JSONObject packCondition
+                                       , @Param("condition") JSONObject condition
                                        , @Param("showData") List<String> showData
                                        , @Param("orderBy") String orderBy
                                        , @Param("limit") int limit
@@ -161,35 +163,36 @@ public interface StandardMapper {
      * 功能描述: 自定义查询,需要查询的字段和value都在condition中
      * {@link SqlProvider#countByCondition(Map)}
      *
-     * @param tableName     tableName
-     * @param packCondition 封装好的查询条件
+     * @param tableName tableName
+     * @param condition condition
      * @return int
      */
     @SelectProvider(type = SqlProvider.class, method = "countByCondition")
-    int countByCondition(@Param("tableName") String tableName, @Param("packCondition") JSONObject packCondition);
+    int countByCondition(@Param("tableName") String tableName, @Param("packCondition") JSONObject packCondition, @Param("condition") JSONObject condition);
 
     /**
      * 功能描述: 连表查询
      * {@link SqlProvider#countByLeftJoinCondition(Map)}
      *
-     * @param queryBySql    dto
-     * @param packCondition packCondition
+     * @param queryBySql dto
+     * @param condition  condition
      * @return int
      */
     @SelectProvider(type = SqlProvider.class, method = "countByLeftJoinCondition")
-    int countByLeftJoinCondition(@Param("packCondition") JSONObject packCondition, @Param("queryBySql") QueryBySqlDto queryBySql);
+    int countByLeftJoinCondition(@Param("packCondition") JSONObject packCondition, @Param("queryBySql") QueryBySqlDto queryBySql, @Param("condition") JSONObject condition);
 
     /**
      * 功能描述: 根据tableName和map(属性名和属性值)进行查查
      * {@link SqlProvider#getByMap(java.util.Map)}
      *
-     * @param tableName     tableName
-     * @param packCondition 属性名和属性值 条件
-     * @param limitOne      true sql加上limit 1,   false 则不加
+     * @param tableName tableName
+     * @param condition 属性名和属性值 条件
+     * @param limitOne  true sql加上limit 1,   false 则不加
      * @return java.util.List<com.alibaba.fastjson.JSONObject>
      */
     @SelectProvider(type = SqlProvider.class, method = "getByMap")
     List<JSONObject> getByMap(@Param("tableName") String tableName, @Param("packCondition") JSONObject packCondition
+            , @Param("condition") JSONObject condition
             , @Param("limitOne") boolean limitOne);
 
     /**
@@ -277,7 +280,7 @@ public interface StandardMapper {
             packCondition(packColCondition, sql);
 
             String sqlStr = sql.toString();
-            LOGGER.info("通用删除的sql语句为: {} \r\n condition: {}", sqlStr, condition);
+            LOGGER.info("通用删除的sql语句为: {} \r\n packColCondition: {}", sqlStr, packColCondition);
             return sqlStr;
         }
 

+ 3 - 3
boman-web-core/src/main/java/com/boman/web/core/service/TableServiceCmdService.java

@@ -300,7 +300,7 @@ public class TableServiceCmdService {
         IdUtils.putIfNotContains(showData, IdUtils.getPkName(columns));
 
         JSONObject rows = new JSONObject();
-        int total = selectService.countByCondition(genTable.getTableName(), packCondition);
+        int total = selectService.countByCondition(genTable.getTableName(), packCondition, condition);
         rows.put(FormDataConstant.PAGE_TOTAL, total);
         rows.put(TABLE_HEAD_LIST, getTableHeadList(genTable));
         if (total <= 0) {
@@ -361,7 +361,7 @@ public class TableServiceCmdService {
         JSONObject packCondition = ifNullSetEmpty(ColumnUtils.packLeftJoinCondition(allColumnName, condition));
 
         JSONObject rows = new JSONObject();
-        int total = selectService.countByLeftJoinCondition(packCondition, queryBySql);
+        int total = selectService.countByLeftJoinCondition(packCondition, queryBySql, condition);
         rows.put(FormDataConstant.PAGE_TOTAL, total);
         rows.put(TABLE_HEAD_LIST, getTableHeadList(primaryGenTable));
         if (total <= 0) {
@@ -374,7 +374,7 @@ public class TableServiceCmdService {
         showData = filterData(columns, 4, showData, MaskConstant.LIST_VISIBLE::equals);
         // 表的id单独处理,不管mask,都查出来返给前台
         IdUtils.putIfNotContains(showData, IdUtils.getPkName(columns));
-        List<JSONObject> result = selectService.selectByLeftJoinCondition(queryBySql, packCondition, showData);
+        List<JSONObject> result = selectService.selectByLeftJoinCondition(queryBySql, packCondition, condition, showData);
         result = filter(result, ObjectUtils::isNotEmpty);
 
         // 查询时为null的列不显示的处理

+ 1 - 1
boman-web-core/src/main/java/com/boman/web/core/service/attendance/AttendanceServiceImpl.java

@@ -140,7 +140,7 @@ public class AttendanceServiceImpl implements AttendanceService {
         GenTable genTable = cmdService.getTableFromRedisByTableName(RedisKey.TABLE_INFO, dto.getTable());
         List<GenTableColumn> columns = genTable.getColumns();
         JSONObject packCondition = ifNullSetEmpty(ColumnUtils.packColCondition(columns, condition));
-        int total = selectService.countByCondition(tableName, packCondition);
+        int total = selectService.countByCondition(tableName, packCondition, condition);
         JSONObject result = new JSONObject();
         result.put(FormDataConstant.PAGE_TOTAL, total);
         if (total <= 0) {

+ 1 - 1
boman-web-core/src/main/java/com/boman/web/core/service/common/CommonServiceImpl.java

@@ -105,7 +105,7 @@ public class CommonServiceImpl implements ICommonService {
         requireNonNull(tableName, "tableName is empty");
         GenTable genTable = cmdService.getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName);
         JSONObject packCondition = ColumnUtils.packColCondition(genTable.getColumns(), condition);
-        return selectService.countByCondition(tableName, packCondition);
+        return selectService.countByCondition(tableName, packCondition, condition);
     }
 
     /**

+ 9 - 9
boman-web-core/src/main/java/com/boman/web/core/service/select/BaseSelectServiceImpl.java

@@ -49,11 +49,11 @@ public class BaseSelectServiceImpl implements IBaseSelectService {
         requireNonNull(tableName, "表名为空");
         requireNonNull(showData, String.format("此表 = [%s], 无列表可展示字段", tableName));
         String orderBy = requireNonNull(dto.getOrderBy(), "order by is empty");
-        return mapper.selectByCondition(tableName, packCondition, showData, orderBy, dto.getLimit(), dto.getOffset());
+        return mapper.selectByCondition(tableName, condition, packCondition, showData, orderBy, dto.getLimit(), dto.getOffset());
     }
 
     @Override
-    public List<JSONObject> selectByLeftJoinCondition(QueryBySqlDto queryBySql, JSONObject packCondition, List<String> showData) {
+    public List<JSONObject> selectByLeftJoinCondition(QueryBySqlDto queryBySql, JSONObject packCondition, JSONObject condition, List<String> showData) {
         String primaryTableName = queryBySql.getPrimaryTableName() ,deputyTableName = queryBySql.getDeputyTableName();
         String primaryTableNameRelKey = queryBySql.getPrimaryTableNameRelKey(), deputyTableNameRelKey = queryBySql.getDeputyTableNameRelKey();
         requireNonNull(primaryTableName, String.format("tableName = [%s] , 此表不存在", primaryTableName));
@@ -63,7 +63,7 @@ public class BaseSelectServiceImpl implements IBaseSelectService {
         requireNonNull(showData, String.format("子表和主表 关联字段名称不存在, name = [%s]", deputyTableNameRelKey));
         String orderBy = requireNonNull(queryBySql.getOrderBy(), "order by is empty");
 
-        return mapper.selectByLeftJoinCondition(queryBySql, packCondition, showData, orderBy, queryBySql.getLimit(), queryBySql.getOffset());
+        return mapper.selectByLeftJoinCondition(queryBySql, packCondition, condition, showData, orderBy, queryBySql.getLimit(), queryBySql.getOffset());
     }
 
     /**
@@ -81,7 +81,7 @@ public class BaseSelectServiceImpl implements IBaseSelectService {
         GenTable gent = cmdService.getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName);
         ColumnUtils.checkColumn(param, gent.getColumns());
         JSONObject packColCondition = ColumnUtils.packColCondition(gent.getColumns(), param);
-        List<JSONObject> result = mapper.getByMap(tableName, packColCondition, false);
+        List<JSONObject> result = mapper.getByMap(tableName, packColCondition, param, false);
 
         handleBlob(result, gent.getIsContainsBlob());
         handleDateTimeForQueryList(result, gent.getColumns());
@@ -107,7 +107,7 @@ public class BaseSelectServiceImpl implements IBaseSelectService {
         GenTable gent = cmdService.getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName);
         ColumnUtils.checkColumn(param, gent.getColumns());
         JSONObject packColCondition = ColumnUtils.packColCondition(gent.getColumns(), param);
-        List<JSONObject> result = mapper.getByMap(tableName, packColCondition, true);
+        List<JSONObject> result = mapper.getByMap(tableName, packColCondition, param, true);
 
         handleBlob(result, gent.getIsContainsBlob());
         handleDateTimeForQueryList(result, gent.getColumns());
@@ -125,10 +125,10 @@ public class BaseSelectServiceImpl implements IBaseSelectService {
      * @return int
      */
     @Override
-    public int countByCondition(String tableName, JSONObject packCondition) {
+    public int countByCondition(String tableName, JSONObject packCondition, JSONObject condition) {
         requireNonNull(tableName, "表名为空");
 
-        return mapper.countByCondition(tableName, packCondition);
+        return mapper.countByCondition(tableName, packCondition, condition);
     }
 
     /**
@@ -139,8 +139,8 @@ public class BaseSelectServiceImpl implements IBaseSelectService {
      * @return int
      */
     @Override
-    public int countByLeftJoinCondition(JSONObject packCondition, QueryBySqlDto queryBySql) {
-        return mapper.countByLeftJoinCondition(packCondition, queryBySql);
+    public int countByLeftJoinCondition(JSONObject packCondition, QueryBySqlDto queryBySql, JSONObject condition) {
+        return mapper.countByLeftJoinCondition(packCondition, queryBySql, condition);
     }
 
     /**

+ 3 - 3
boman-web-core/src/main/java/com/boman/web/core/service/select/IBaseSelectService.java

@@ -42,7 +42,7 @@ public interface IBaseSelectService {
      */
     List<JSONObject> selectByCondition(String tableName, JSONObject condition, JSONObject packCondition, List<String> showData, FormDataDto dto);
 
-    List<JSONObject> selectByLeftJoinCondition(QueryBySqlDto queryBySql, JSONObject packCondition, List<String> showData);
+    List<JSONObject> selectByLeftJoinCondition(QueryBySqlDto queryBySql, JSONObject packCondition, JSONObject condition, List<String> showData);
 
     /**
      * 功能描述: 根据条件查询
@@ -51,7 +51,7 @@ public interface IBaseSelectService {
      * @param packCondition 封装的查询条件
      * @return int
      */
-    int countByCondition(String tableName, JSONObject packCondition);
+    int countByCondition(String tableName, JSONObject packCondition, JSONObject condition);
 
     /**
      * 功能描述: 根据条件查询
@@ -60,7 +60,7 @@ public interface IBaseSelectService {
      * @param packCondition packCondition
      * @return int
      */
-    int countByLeftJoinCondition(JSONObject packCondition, QueryBySqlDto queryBySql);
+    int countByLeftJoinCondition(JSONObject packCondition, QueryBySqlDto queryBySql, JSONObject condition);
 
     /**
      * 功能描述: 根据id查所有,不支持自定义查询列

+ 1 - 1
boman-web-core/src/main/java/com/boman/web/core/service/update/BaseUpdateServiceImpl.java

@@ -84,7 +84,7 @@ public class BaseUpdateServiceImpl implements IBaseUpdateService {
         JSONObject packColCondition = ColumnUtils.packColCondition(columns, condition);
         JSONObject packCommitData = ColumnUtils.packColCondition(columns, commitData);
 
-        return mapper.update(tableName, packCommitData, packColCondition);
+        return mapper.update(tableName, packCommitData, packColCondition, condition);
     }
 
     private JSONObject escapeByQueryType(List<GenTableColumn> columns, JSONObject commitData) {