Browse Source

code formatter

shiqian 4 years ago
parent
commit
6879fb9e6b

+ 7 - 1
boman-common/boman-common-core/src/main/java/com/boman/common/core/utils/array/ArrayUtils.java

@@ -20,7 +20,13 @@ public class ArrayUtils extends org.apache.commons.lang3.ArrayUtils {
      * @return 是否包含
      */
     public static boolean arraysContains(String[] arr, String targetValue) {
-        return Arrays.asList(arr).contains(targetValue);
+        for (String str : arr) {
+            if (str.contains(targetValue)) {
+                return true;
+            }
+        }
+
+        return false;
     }
 
     /**

+ 2 - 4
boman-web-core/src/main/java/com/boman/web/core/controller/CommonController.java

@@ -33,8 +33,7 @@ public class CommonController {
     /**
      * 功能描述: 根据表名和自定义字段查找
      *
-     * @param tableName tableName
-     * @param id        id
+     * @param dto dto
      * @return com.boman.common.core.web.domain.AjaxResult
      */
     @PostMapping
@@ -51,8 +50,7 @@ public class CommonController {
      */
     @GetMapping("tableName/{tableName}/pkName/{pkName}")
     public Long getMaxId(@PathVariable("tableName") String tableName, @PathVariable("pkName") String pkName) {
-        Integer maxId = commonService.getMaxId(tableName, pkName);
-        return Long.valueOf(maxId.toString());
+        return commonService.getMaxId(tableName, pkName);
     }
 
 }

+ 0 - 2
boman-web-core/src/main/java/com/boman/web/core/controller/ObjController.java

@@ -1,8 +1,6 @@
 package com.boman.web.core.controller;
 
 import com.boman.common.core.web.domain.AjaxResult;
-import com.boman.domain.GenTable;
-//import com.boman.gen.controller.MyController;
 import com.boman.web.core.domain.FormDataDto;
 import com.boman.web.core.service.TableServiceCmdService;
 import io.swagger.annotations.ApiOperation;

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

@@ -75,7 +75,7 @@ public class CommonServiceImpl implements ICommonService {
     }
 
     @Override
-    public Integer getMaxId(String tableName, String pkName) {
+    public Long getMaxId(String tableName, String pkName) {
         return IdUtils.getMaxId(tableName, pkName);
     }
 

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

@@ -39,7 +39,7 @@ public interface ICommonService {
      */
     JSONObject getOneByMap(String tableName, JSONObject param);
 
-    Integer getMaxId(String tableName, String pkName);
+    Long getMaxId(String tableName, String pkName);
 
     /**
      * 功能描述: 根据条件count

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

@@ -46,7 +46,7 @@ public class BaseSaveServiceImpl implements IBaseSaveService {
      * @return com.boman.system.common.RowResult
      */
     @Override
-    public RowResult insertRow(TableContext context, Integer maxId) {
+    public RowResult insertRow(TableContext context, Long maxId) {
         List<GenTableColumn> columns = context.getColumns();
         JSONObject commitData = context.getCommitData();
         ColumnUtils.packUpdateByAndTime(columns, commitData, new Timestamp(System.currentTimeMillis()), true);

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

@@ -19,6 +19,6 @@ public interface IBaseSaveService {
      * @param maxId   最大的SEQ
      * @return com.boman.system.common.RowResult
      */
-    RowResult insertRow(TableContext context, Integer maxId);
+    RowResult insertRow(TableContext context, Long maxId);
 
 }

+ 3 - 1
boman-web-core/src/main/java/com/boman/web/core/utils/ColumnUtils.java

@@ -24,6 +24,7 @@ import java.util.Map;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
+import static com.boman.common.core.constant.GenConstants.COLUMNTYPE_NUMBER;
 import static com.boman.common.core.utils.obj.ObjectUtils.*;
 import static com.boman.domain.constant.FormDataConstant.*;
 
@@ -279,11 +280,12 @@ public class ColumnUtils {
                 if (!GenTableColumn.IS_REQUIRED.equalsIgnoreCase(column.getIsRequired())) {
                     continue;
                 }
+
                 if (!entry.getKey().equals(column.getColumnName())) {
                     continue;
                 }
 
-                if (!ArrayUtils.arraysContains(GenConstants.COLUMNTYPE_NUMBER, getDbType(column.getColumnType()))) {
+                if (!ArrayUtils.arraysContains(COLUMNTYPE_NUMBER, getDbType(column.getColumnType()))) {
                     continue;
                 }
 

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

@@ -21,12 +21,13 @@ import static com.boman.common.core.utils.obj.ObjectUtils.requireNonNull;
 public class IdUtils {
 
 
-    public static int getMaxId(String tableName, String pkName) {
+    public static Long getMaxId(String tableName, String pkName) {
         RedisService redisService = SpringUtils.getBean(RedisService.class);
         String sequencesKey = RedisKey.SEQ + tableName.toUpperCase();
         boolean isExist = redisService.exists(sequencesKey);
         if (isExist) {
-            return redisService.increment(sequencesKey);
+            int result = redisService.increment(sequencesKey);
+            return (long) result;
         }
 
         // 查数据库
@@ -39,7 +40,7 @@ public class IdUtils {
             redisService.increment(sequencesKey, ++maxId);
         }
 
-        return maxId;
+        return (long) maxId;
     }
 
     public static String getPkName(List<GenTableColumn> columnList) {