瀏覽代碼

Merge remote-tracking branch 'origin/master'

Administrator 4 年之前
父節點
當前提交
b122e6e8bb

+ 5 - 40
boman-api/boman-domain/src/main/java/com.boman.domain/dto/QueryBySqlDto.java

@@ -123,45 +123,6 @@ public class QueryBySqlDto {
                 + EQ + queryBySql.getDeputyTableName() + POINT + queryBySql.getDeputyTableNameRelKey();
     }
 
-    /**
-     * 功能描述: 传到mapper层,判断是否需要转义
-     *
-     * @param columns   columns
-     * @param condition condition
-     * @return com.alibaba.fastjson.JSONObject
-     */
-    public static JSONObject packLeftJoinCondition(List<GenTableColumn> columns, JSONObject condition) {
-        if (isEmpty(condition)) {
-            return condition;
-        }
-
-        JSONObject result = new JSONObject(columns.size());
-        for (Map.Entry<String, Object> entry : condition.entrySet()) {
-            String key = entry.getKey();
-            key = getColumnNameFromCondition(key);
-            Object value = entry.getValue();
-            for (GenTableColumn column : columns) {
-                if (!column.getColumnName().equalsIgnoreCase(key)) {
-                    continue;
-                }
-
-                // long string collection 暂时只作此三种类型判断
-                if (!isEmpty(value)) {
-                    // columnType 作为判断需不需要转义的一个标准,防止索引失效
-                    List<Object> objects = new ArrayList<>(3);
-                    objects.add(value);
-                    objects.add(column.getQueryType());
-                    objects.add(column.getColumnType());
-                    result.put(key, objects);
-                    break;
-                }
-            }
-        }
-
-        return result;
-    }
-
-
     /**
      * 功能描述: 表名.属性名  取出属性名
      *
@@ -173,7 +134,7 @@ public class QueryBySqlDto {
             throw new IllegalArgumentException("key为空");
         }
 
-        String[] split = key.split("\\.");
+        String[] split = key.split("\\$");
         assert split.length == 2;
         // split[0] 表名, split[1] 属性名
         return split[1].trim();
@@ -189,6 +150,10 @@ public class QueryBySqlDto {
         }
     }
 
+    public static String packColumn(String tableName, String columnName) {
+        return tableName + POINT + columnName;
+    }
+
 
     /******************************************************** get set ********************************************************/
 

+ 4 - 4
boman-modules/boman-system/src/main/resources/mapper/system/SysMenuMapper.xml

@@ -91,7 +91,7 @@
 			 left join sys_user_role ur on rm.role_id = ur.role_id
 			 left join sys_role ro on ur.role_id = ro.id
 			 left join sys_user u on ur.user_id = u.id
-		where u.id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0  AND ro.status = 0
+		where u.id = #{userId} and m.menu_type in ('M', 'C') and m.status = '0'  AND ro.status = '0'
 	    union
 		select distinct m.id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms
 					  , m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time, m.create_by, m.update_by
@@ -101,7 +101,7 @@
 				 left join sys_user_role ur on rm.role_id = ur.role_id
 				 left join sys_role ro on ur.role_id = ro.id
 				 left join sys_user u on ur.user_id = u.id
-		where m.visible = 1 and  m.status = '0'
+		where m.visible = '1' and  m.status = '0'
 	</select>
 
 	<select id="listBtnByUserId" parameterType="Long" resultMap="SysMenuResult">
@@ -117,7 +117,7 @@
 		<if test="userId != null and userId != ''">
 			and u.id = #{userId}
 		</if>
-		and m.status = 0 AND ro.status = 0
+		and m.status = '0' AND ro.status = '0'
 		order by m.parent_id, m.order_num
 	</select>
 
@@ -127,7 +127,7 @@
 			m.update_time, m.remark, m.sys_table_name
 		from sys_menu m
 		where m.menu_type = 'F'
-		  and m.status = 0
+		  and m.status = '0'
 		order by m.parent_id, m.order_num
 	</select>
 

+ 11 - 36
boman-web-core/src/main/java/com/boman/web/core/controller/ObjController.java

@@ -234,42 +234,6 @@ public class ObjController {
         return tableServiceCmdService.getQueryParam(condition);
     }
 
-//
-//    /**
-//     * 功能描述: 获取表单表头
-//     * 注意: 都是从redis中拿的,如果数据库和redis不一致,则需刷新一下redis
-//     * 刷新的入口为 {@link MyController#loadTable(com.boman.domain.GenTable)}
-//     *
-//     *                    eg:{
-//     *                          "table": "sys_config"
-//     *                        }
-//     *
-//     * @param condition condition
-//     * @return com.boman.domain.dto.AjaxResult
-//     */
-//    @ApiOperation(value = "获取表单表头")
-//    @PostMapping("/getTableHead")
-//    public AjaxResult getTableHead(@RequestBody FormDataDto condition) {
-//        return tableServiceCmdService.getTableHead(condition);
-//    }
-
-    /**
-     * 功能描述: 获取表单按钮
-     * 注意: 都是从redis中拿的,如果数据库和redis不一致,则需刷新一下redis
-     * <p>
-     * eg:{
-     * "table": "sys_config"
-     * }
-     *
-     * @param condition condition
-     * @return com.boman.domain.dto.AjaxResult
-     */
-//    @ApiOperation(value = "获取表单按钮")
-//    @PostMapping("/getButton")
-//    public AjaxResult getButton(@RequestBody FormDataDto condition) {
-//        return AjaxResult.success(tableServiceCmdService.getButton(condition.getTable()));
-//    }
-
     /**
      * 功能描述: 获取表单子表
      *
@@ -384,4 +348,15 @@ public class ObjController {
         return AjaxResult.success(commonService.delete(dto));
     }
 
+    /**
+     * 功能描述: 通用修改数据
+     *
+     * @param dto dto
+     * @return int
+     */
+    @PostMapping("/insertList")
+    public AjaxResult insertList(@RequestBody InsertListDto dto) {
+        return AjaxResult.success(commonService.insertList(dto));
+    }
+
 }

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

@@ -85,7 +85,7 @@ public interface StandardMapper {
 
     /* ***************************************************** select ******************************************************/
     @Select("select max(${pkName}) from ${tableName}")
-    int selectMaxId(@Param("tableName") String tableName, @Param("pkName") String pkName);
+    Integer selectMaxId(@Param("tableName") String tableName, @Param("pkName") String pkName);
 
     /**
      * 功能描述: 根据id查所有

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

@@ -329,7 +329,7 @@ public class TableServiceCmdService {
 
 
     /**
-     * 功能描述: 获取单表单数据
+     * 功能描述: 连表查询,目前两张表
      *
      * @param queryBySql queryBySql
      * @return com.boman.domain.dto.AjaxResult

+ 8 - 12
boman-web-core/src/main/java/com/boman/web/core/utils/ColumnUtils.java

@@ -87,16 +87,6 @@ public class ColumnUtils {
                         commitData.put(columnName, commitData.getSqlDate(columnName));
                     }
                 }
-
-//                if (DATETIME.equalsIgnoreCase(column.getColumnType())) {
-//                    if (!CREATE_TIME.equalsIgnoreCase(columnName) && isNotEmpty(commitData.get(columnName))) {
-//                        commitData.put(columnName, commitData.getTimestamp(columnName));
-//                    }
-//                } else  if (DATE.equalsIgnoreCase(column.getColumnType())) {
-//                    if (!CREATE_TIME.equalsIgnoreCase(columnName) && isNotEmpty(commitData.get(columnName))) {
-//                        commitData.put(columnName, commitData.getSqlDate(columnName));
-//                    }
-//                }
             }
         }
     }
@@ -379,13 +369,19 @@ public class ColumnUtils {
 
         JSONObject packColCondition = new JSONObject(columns.size());
         for (Map.Entry<String, Object> entry : condition.entrySet()) {
-            String columnName = QueryBySqlDto.getColumnNameFromCondition(entry.getKey());
+//            String columnName = QueryBySqlDto.getColumnNameFromCondition(entry.getKey());
+            String key = entry.getKey();
+            String[] split = key.split("\\$");
+            assert split.length == 2;
+            // split[0] 表名, split[1] 属性名
+            String columnName = split[1];
             Object value = entry.getValue();
             for (GenTableColumn column : columns) {
                 // long string collection 暂时只作此三种类型判断
                 if (column.getColumnName().equalsIgnoreCase(columnName) && ObjectUtils.isNotEmpty(value)) {
                     // columnType 作为判断需不需要转义的一个标准,防止索引失效
-                    packColCondition.put(entry.getKey(), Lists.newArrayList(value, column.getQueryType(), column.getColumnType()));
+                    String packColumn = QueryBySqlDto.packColumn(split[0], split[1]);
+                    packColCondition.put(packColumn, Lists.newArrayList(value, column.getQueryType(), column.getColumnType()));
                     break;
                 }
             }

+ 2 - 2
boman-web-core/src/main/java/com/boman/web/core/utils/IdUtils.java

@@ -32,8 +32,8 @@ public class IdUtils {
 
         // 查数据库
         StandardMapper mapper = SpringUtils.getBean(StandardMapper.class);
-        int maxId = mapper.selectMaxId(tableName, pkName);
-        if (maxId <= 0) {
+        Integer maxId = mapper.selectMaxId(tableName, pkName);
+        if (null == maxId || maxId <= 0) {
             maxId = 1;
             redisService.setCacheObject(sequencesKey, maxId);
         } else {