Browse Source

修改mysql兼容sqlserver

车车 2 months ago
parent
commit
0e21433773
54 changed files with 375 additions and 334 deletions
  1. 4 4
      ktg-admin/src/main/resources/application.yml
  2. 1 1
      ktg-common/src/main/java/com/ktg/common/utils/PageUtils.java
  3. 6 3
      ktg-framework/src/main/java/com/ktg/framework/web/service/SysLoginService.java
  4. 0 1
      ktg-iscs/src/main/java/com/ktg/iscs/domain/IsUserUnit.java
  5. 5 5
      ktg-iscs/src/main/java/com/ktg/iscs/service/impl/HardwareApiServiceImpl.java
  6. 6 6
      ktg-iscs/src/main/java/com/ktg/iscs/service/impl/HardwareMaterialApiServiceImpl.java
  7. 3 1
      ktg-iscs/src/main/java/com/ktg/iscs/service/impl/IsMaterialsChangeRecordServiceImpl.java
  8. 1 1
      ktg-iscs/src/main/java/com/ktg/iscs/service/impl/IsMaterialsPlanCabinetServiceImpl.java
  9. 35 13
      ktg-iscs/src/main/resources/mapper/IsIsolationPointMapper.xml
  10. 1 1
      ktg-iscs/src/main/resources/mapper/IsJobTicketLockMapper.xml
  11. 2 1
      ktg-iscs/src/main/resources/mapper/IsJobTicketPointsMapper.xml
  12. 2 2
      ktg-iscs/src/main/resources/mapper/IsMapPointMapper.xml
  13. 12 5
      ktg-iscs/src/main/resources/mapper/IsMaterialsCheckPlanMapper.xml
  14. 3 3
      ktg-iscs/src/main/resources/mapper/IsMaterialsLoanMapper.xml
  15. 39 25
      ktg-iscs/src/main/resources/mapper/IsSopMapper.xml
  16. 13 44
      ktg-iscs/src/main/resources/mapper/StatisticsMapper.xml
  17. 7 7
      ktg-mes/src/main/resources/mapper/cal/CalPlanTeamMapper.xml
  18. 7 7
      ktg-mes/src/main/resources/mapper/dv/DvCheckMachineryMapper.xml
  19. 6 6
      ktg-mes/src/main/resources/mapper/dv/DvCheckSubjectMapper.xml
  20. 6 6
      ktg-mes/src/main/resources/mapper/dv/DvRepairMapper.xml
  21. 6 5
      ktg-mes/src/main/resources/mapper/md/ItemTypeMapper.xml
  22. 8 8
      ktg-mes/src/main/resources/mapper/md/MdClientMapper.xml
  23. 3 3
      ktg-mes/src/main/resources/mapper/md/MdItemMapper.xml
  24. 8 8
      ktg-mes/src/main/resources/mapper/md/MdVendorMapper.xml
  25. 2 2
      ktg-mes/src/main/resources/mapper/md/MdWorkshopMapper.xml
  26. 6 6
      ktg-mes/src/main/resources/mapper/md/MdWorkstationMachineMapper.xml
  27. 7 7
      ktg-mes/src/main/resources/mapper/md/MdWorkstationMapper.xml
  28. 6 6
      ktg-mes/src/main/resources/mapper/md/MdWorkstationToolMapper.xml
  29. 6 6
      ktg-mes/src/main/resources/mapper/md/MdWorkstationWorkerMapper.xml
  30. 9 9
      ktg-mes/src/main/resources/mapper/pro/ProProcessMapper.xml
  31. 6 6
      ktg-mes/src/main/resources/mapper/pro/ProRouteMapper.xml
  32. 12 12
      ktg-mes/src/main/resources/mapper/pro/ProRouteProcessMapper.xml
  33. 6 6
      ktg-mes/src/main/resources/mapper/pro/ProRouteProductMapper.xml
  34. 6 6
      ktg-mes/src/main/resources/mapper/pro/ProTaskIssueMapper.xml
  35. 4 4
      ktg-mes/src/main/resources/mapper/pro/ProTaskMapper.xml
  36. 6 6
      ktg-mes/src/main/resources/mapper/pro/ProWorkorderMapper.xml
  37. 6 6
      ktg-mes/src/main/resources/mapper/qc/QcIqcMapper.xml
  38. 7 7
      ktg-mes/src/main/resources/mapper/qc/QcTemplateMapper.xml
  39. 9 9
      ktg-mes/src/main/resources/mapper/tm/TmToolMapper.xml
  40. 7 7
      ktg-mes/src/main/resources/mapper/tm/TmToolTypeMapper.xml
  41. 7 7
      ktg-mes/src/main/resources/mapper/wm/WmIssueHeaderMapper.xml
  42. 6 6
      ktg-mes/src/main/resources/mapper/wm/WmMaterialStockMapper.xml
  43. 16 16
      ktg-mes/src/main/resources/mapper/wm/WmStockTakingResultMapper.xml
  44. 8 8
      ktg-mes/src/main/resources/mapper/wm/WmStorageLocationMapper.xml
  45. 8 8
      ktg-mes/src/main/resources/mapper/wm/WmWarehouseMapper.xml
  46. 1 1
      ktg-system/src/main/resources/mapper/system/SysConfigMapper.xml
  47. 2 2
      ktg-system/src/main/resources/mapper/system/SysDeptMapper.xml
  48. 1 1
      ktg-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
  49. 2 2
      ktg-system/src/main/resources/mapper/system/SysMenuMapper.xml
  50. 2 2
      ktg-system/src/main/resources/mapper/system/SysPostMapper.xml
  51. 2 2
      ktg-system/src/main/resources/mapper/system/SysRoleMapper.xml
  52. 29 6
      ktg-system/src/main/resources/mapper/system/SysUserMapper.xml
  53. 1 1
      ktg-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
  54. 1 1
      pom.xml

+ 4 - 4
ktg-admin/src/main/resources/application.yml

@@ -71,13 +71,13 @@ spring:
   # redis 配置
   redis:
     # 地址
-    host: 127.0.0.1
+    host: 120.27.232.27
     # 端口,默认为6379
     port: 6379
     # 数据库索引
     database: 0
     # 密码
-    password: mars2025
+    password: bozzys0507
     # 连接超时时间
     timeout: 10s
     lettuce:
@@ -127,7 +127,7 @@ pagehelper:
   helperDialect: sqlserver
   supportMethodsArguments: true
   reasonable: true
-  #params: count=countSql
+  params: count=countSql
 
 # Swagger配置
 swagger:
@@ -175,7 +175,7 @@ mail:
   #alarm: MATERIALS_OVERDUE_ALARM
 
 ### MQ CONFIG
-rocketmq:
+#rocketmq:
   namesrvAddr: localhost:9876 # NameServer地址
   producers: # 生产者配置
     order-producer: # 订单生产者

+ 1 - 1
ktg-common/src/main/java/com/ktg/common/utils/PageUtils.java

@@ -7,7 +7,7 @@ import com.ktg.common.utils.sql.SqlUtil;
 
 /**
  * 分页工具类
- * 
+ *
  * @author ruoyi
  */
 public class PageUtils extends PageHelper

+ 6 - 3
ktg-framework/src/main/java/com/ktg/framework/web/service/SysLoginService.java

@@ -245,7 +245,8 @@ public class SysLoginService {
         String fingerprint = verificationVO.getFingerprint();
         SysUserCharacteristic one = iSysUserCharacteristicService.getOne(Wrappers.<SysUserCharacteristic>lambdaQuery()
                 .eq(SysUserCharacteristic::getContent, fingerprint)
-                .last("limit 1"));
+                .orderByDesc(SysUserCharacteristic::getRecordId)
+                .last("offset 0 rows fetch next 1 rows only"));
         SysUser sysUser1 = iSysUserService.getById(one.getUserId());
         SysUser sysUser = userService.selectUserByUserName(sysUser1.getUserName());
         // 生成令牌
@@ -278,7 +279,8 @@ public class SysLoginService {
         String okFace = faceMatchVO.getContent();
         SysUserCharacteristic one = iSysUserCharacteristicService.getOne(Wrappers.<SysUserCharacteristic>lambdaQuery()
                 .eq(SysUserCharacteristic::getContent, okFace)
-                .last("limit 1"));
+                .orderByDesc(SysUserCharacteristic::getRecordId)
+                .last("offset 0 rows fetch next 1 rows only"));
         SysUser sysUser1 = iSysUserService.getById(one.getUserId());
         SysUser sysUser = userService.selectUserByUserName(sysUser1.getUserName());
         // 生成令牌
@@ -304,7 +306,8 @@ public class SysLoginService {
         String okFace = faceMatchVO.getContent();
         SysUserCharacteristic one = iSysUserCharacteristicService.getOne(Wrappers.<SysUserCharacteristic>lambdaQuery()
                 .eq(SysUserCharacteristic::getContent, okFace)
-                .last("limit 1"));
+                .orderByDesc(SysUserCharacteristic::getRecordId)
+                .last("offset 0 rows fetch next 1 rows only"));
         SysUser sysUser = iSysUserService.getById(one.getUserId());
         // 生成令牌
         AjaxResult ajax = AjaxResult.success();

+ 0 - 1
ktg-iscs/src/main/java/com/ktg/iscs/domain/IsUserUnit.java

@@ -19,7 +19,6 @@ public class IsUserUnit
     private static final long serialVersionUID = 1L;
 
     @ApiModelProperty(value = "用户ID")
-    @TableId(type = IdType.AUTO)
     private Long userId;
 
     @ApiModelProperty(value = "岗位ID")

+ 5 - 5
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/HardwareApiServiceImpl.java

@@ -326,7 +326,7 @@ public class HardwareApiServiceImpl implements HardwareApiService {
                     .eq(IsJobTicketLock::getTicketId, dto.getTicketId())
                     .isNull(IsJobTicketLock::getLockId)
                     .orderByAsc(IsJobTicketLock::getRecordId)
-                    .last("limit 1"));
+                    .last("offset 0 rows fetch next 1 rows only"));
             Assert.notNull(isJobTicketLock, "无初始化数据来提供给该挂锁更新");
             // 1.2开始补充该条数据
             isJobTicketLock.setLockId(lock.getLockId());
@@ -714,7 +714,7 @@ public class HardwareApiServiceImpl implements HardwareApiService {
                     .isNull(IsJobTicketLockset::getLocksetId)
                     // 处理下多条取一条用,按照从上倒下顺序使用
                     .orderByAsc(IsJobTicketLockset::getRecordId)
-                    .last("limit 1"));
+                    .last("offset 0 rows fetch next 1 rows only"));
             Assert.notNull(jobTicketLockset, "无初始化数据来提供给该辅件更新");
             // 1.3开始补充该条数据
             jobTicketLockset.setLocksetId(lockset.getLocksetId());
@@ -1024,7 +1024,7 @@ public class HardwareApiServiceImpl implements HardwareApiService {
                                     .eq(IsJobTicketLock::getTicketId, isJobTicketPoints.getTicketId())
                                     .isNull(IsJobTicketLock::getLockId)
                                     .orderByAsc(IsJobTicketLock::getRecordId)
-                                    .last("limit 1"));
+                                    .last("offset 0 rows fetch next 1 rows only"));
                             if (one != null) {
                                 iIsJobTicketLockService.update(Wrappers.<IsJobTicketLock>lambdaUpdate()
                                         .eq(IsJobTicketLock::getRecordId, one.getRecordId())
@@ -1261,13 +1261,13 @@ public class HardwareApiServiceImpl implements HardwareApiService {
                     .eq(IsJobTicketKey::getTicketId, lockJobByBfc.getTicketId())
                     .eq(IsJobTicketKey::getTicketType, 0)
                     .orderByDesc(IsJobTicketKey::getRecordId)
-                    .last("limit 1"));
+                    .last("offset 0 rows fetch next 1 rows only"));
             // 获取解锁时钥匙的最新一条数据
             IsJobTicketKey unlockLast = iIsJobTicketKeyService.getOne(Wrappers.<IsJobTicketKey>lambdaQuery()
                     .eq(IsJobTicketKey::getTicketId, lockJobByBfc.getTicketId())
                     .eq(IsJobTicketKey::getTicketType, 1)
                     .orderByDesc(IsJobTicketKey::getRecordId)
-                    .last("limit 1"));
+                    .last("offset 0 rows fetch next 1 rows only"));
             // 判断阶段
             if (lockLast.getKeyStatus().equals("0")) {
                 return 0;

+ 6 - 6
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/HardwareMaterialApiServiceImpl.java

@@ -159,7 +159,7 @@ public class HardwareMaterialApiServiceImpl implements HardwareMaterialApiServic
                         .eq(IsMaterialsLoanException::getStatus, 0)
                         .eq(IsMaterialsLoanException::getRestitutionToId, oldMaterials.getMaterialsCabinetId())
                         .orderByDesc(IsMaterialsLoanException::getMisplaceId)
-                        .last("limit 1"));
+                        .last("offset 0 rows fetch next 1 rows only"));
                 Assert.isTrue(one1 != null, "请在该柜中放入新物资!");
             }*/
 
@@ -187,7 +187,7 @@ public class HardwareMaterialApiServiceImpl implements HardwareMaterialApiServic
                     .eq(IsMaterialsCheckRecord::getMaterialsId, replaceMaterialDTO.getOldMaterialsId())
                     .eq(IsMaterialsCheckRecord::getStatus, "1")
                     .orderByDesc(IsMaterialsCheckRecord::getRecordId)
-                    .last("limit 1"));
+                    .last("offset 0 rows fetch next 1 rows only"));
             // 判断物资是不是维修,如果是维修,做维修处理
             if (StringUtils.isNotBlank(replaceMaterialDTO.getMeasure()) && replaceMaterialDTO.getMeasure().equals("维修")) {
                 // 如果是维修直接更新物资状态
@@ -342,7 +342,7 @@ public class HardwareMaterialApiServiceImpl implements HardwareMaterialApiServic
                     .eq(IsMaterialsCheckRecord::getMaterialsId, replaceMaterialDTO.getOldMaterialsId())
                     .eq(IsMaterialsCheckRecord::getStatus, "1")
                     .orderByDesc(IsMaterialsCheckRecord::getRecordId)
-                    .last("limit 1"));
+                    .last("offset 0 rows fetch next 1 rows only"));
             if (checkRecord != null && StringUtils.isNotBlank(checkRecord.getMeasure()) && checkRecord.getMeasure().equals("维修")) {
                 // 如果是维修直接更新物资状态
                 iIsMaterialsService.update(Wrappers.<IsMaterials>lambdaUpdate()
@@ -768,7 +768,7 @@ public class HardwareMaterialApiServiceImpl implements HardwareMaterialApiServic
         IsMaterialsCabinet cabinet = iIsMaterialsCabinetService.getOne(Wrappers.<IsMaterialsCabinet>lambdaQuery()
                 .eq(IsMaterialsCabinet::getCabinetCode, cabinetCode)
                 .orderByDesc(IsMaterialsCabinet::getCabinetId)
-                .last("limit 1"));
+                .last("offset 0 rows fetch next 1 rows only"));
         Assert.isFalse(cabinet == null, "物资柜信息不存在!");
         // 2.获取用户信息
         Long userId = SecurityUtils.getUserId();
@@ -778,7 +778,7 @@ public class HardwareMaterialApiServiceImpl implements HardwareMaterialApiServic
                 .eq(IsMaterialsPlanCabinet::getCheckUserId, userId)
                 .ne(IsMaterialsPlanCabinet::getStatus, "1")
                 .orderByDesc(IsMaterialsPlanCabinet::getPlanId)
-                .last("limit 1"));
+                .last("offset 0 rows fetch next 1 rows only"));
         Assert.isFalse(planCabinet == null, "该物资柜当前无您的检查计划!");
         // 3.1检查当前登陆人的账号是否有检查计划
         IsMaterialsCheckPlan checkPlan = iIsMaterialsCheckPlanService.getOne(Wrappers.<IsMaterialsCheckPlan>lambdaQuery()
@@ -891,7 +891,7 @@ public class HardwareMaterialApiServiceImpl implements HardwareMaterialApiServic
         IsMaterialsCabinet cabinet = iIsMaterialsCabinetService.getOne(Wrappers.<IsMaterialsCabinet>lambdaQuery()
                 .eq(IsMaterialsCabinet::getCabinetCode, cabinetCode)
                 .orderByDesc(IsMaterialsCabinet::getCabinetId)
-                .last("limit 1"));
+                .last("offset 0 rows fetch next 1 rows only"));
         Assert.isFalse(cabinet == null, "物资柜信息不存在!");
         // 1.1柜子中的物资信息
         List<IsMaterials> isMaterials = iIsMaterialsService.list(Wrappers.<IsMaterials>lambdaQuery()

+ 3 - 1
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/IsMaterialsChangeRecordServiceImpl.java

@@ -13,6 +13,7 @@ import com.ktg.iscs.mapper.IsMaterialsChangeRecordMapper;
 import com.ktg.iscs.service.IIsMaterialsChangeRecordService;
 import com.ktg.iscs.service.IIsMaterialsCheckRecordService;
 import com.ktg.iscs.service.IIsMaterialsService;
+import com.ktg.system.domain.SysUserCharacteristic;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -51,7 +52,8 @@ public class IsMaterialsChangeRecordServiceImpl extends ServiceImpl<IsMaterialsC
         // 查询改物资的最新报异常记录
         IsMaterialsCheckRecord checkRecord = isMaterialsCheckRecordService.getOne(Wrappers.<IsMaterialsCheckRecord>lambdaQuery()
                 .eq(IsMaterialsCheckRecord::getMaterialsId, changeRecord.getOldMaterialsId())
-                .last("limit 1"));
+                .orderByDesc(IsMaterialsCheckRecord::getRecordId)
+                .last("offset 0 rows fetch next 1 rows only"));
         if (checkRecord != null) {
             changeRecord.setCheckRecordId(checkRecord.getRecordId());
         } else {

+ 1 - 1
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/IsMaterialsPlanCabinetServiceImpl.java

@@ -61,7 +61,7 @@ public class IsMaterialsPlanCabinetServiceImpl extends ServiceImpl<IsMaterialsPl
                 .eq(IsMaterialsPlanCabinet::getCabinetId, cabinet.getCabinetId())
                 .ne(IsMaterialsPlanCabinet::getStatus, "1")
                 .orderByDesc(IsMaterialsPlanCabinet::getPlanId)
-                .last("limit 1"));
+                .last("offset 0 rows fetch next 1 rows only"));
         if (planCabinet != null) {
             // 2.检查有没有生成检查记录
             List<IsMaterialsCheckRecord> checkRecords = isMaterialsCheckRecordService.list(Wrappers.<IsMaterialsCheckRecord>lambdaQuery()

+ 35 - 13
ktg-iscs/src/main/resources/mapper/IsIsolationPointMapper.xml

@@ -182,18 +182,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             p.point_id = #{pointId}
     </select>
     <select id="getIsIsolationPointPage" resultType="com.ktg.iscs.domain.vo.points.PointPageVO">
+        select t.* from (
         SELECT
-            p.*,
-            l.lock_type_name,
-            l.lock_type_code,
-            l.lock_type_icon,
-            l.lock_type_img,
-            t.lockset_type_img,
-            s.loto_name,
-            w.workstation_name,
-            GROUP_CONCAT(DISTINCT ma.machinery_name) AS machinery_name,
-            r.rfid as point_nfc,
-            lsm.switch_map_name
+        max(p.point_id) AS point_id,
+        max(p.point_code) AS point_code,
+        max(p.point_name) AS point_name,
+        max(p.point_type) AS point_type,
+        max(p.workshop_id) AS workshop_id,
+        max(p.workarea_id) AS workarea_id,
+        max(p.power_type) AS power_type,
+        max(p.isolation_method) AS isolation_method,
+        max(p.point_icon) AS point_icon,
+        max(p.point_picture) AS point_picture,
+        max(p.del_flag) AS del_flag,
+        max(p.create_by) AS create_by,
+        max(p.create_time) AS create_time,
+        max(p.update_time) AS update_time,
+        max(p.update_by) AS update_by,
+        max(p.lock_type_id) AS lock_type_id,
+        max(p.rfid_id) AS rfid_id,
+        max(p.lockset_type_id) AS lockset_type_id,
+        max(p.workstation_id) AS workstation_id,
+        max(p.loto_id) AS loto_id,
+        max(p.remark) AS remark,
+        max(p.point_serial_number) AS point_serial_number,
+        max(l.lock_type_name) AS lock_type_name,
+        max(l.lock_type_code) AS lock_type_code,
+        max(l.lock_type_icon) AS lock_type_icon,
+        max(l.lock_type_img) AS lock_type_img,
+        max(t.lockset_type_img) AS lockset_type_img,
+        max(s.loto_name) AS loto_name,
+        max(w.workstation_name) AS workstation_name,
+        STRING_AGG(ma.machinery_name, ', ') AS machinery_name,
+        max(r.rfid) as point_nfc,
+        MAX(lsm.switch_map_name) AS switch_map_name
         FROM is_isolation_point p
         LEFT JOIN is_lock_type l ON l.lock_type_id = p.lock_type_id
         LEFT JOIN is_lockset_type t ON t.lockset_type_id = p.lockset_type_id
@@ -247,8 +269,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 and p.switch_map_id is null
             </if>
         </where>
-            group by p.point_id
-            order by p.point_id desc
+        group by p.point_id) t
+        order by t.point_id desc
     </select>
     <select id="getOneByNfc" resultType="com.ktg.iscs.domain.IsIsolationPoint">
         select p.*,

+ 1 - 1
ktg-iscs/src/main/resources/mapper/IsJobTicketLockMapper.xml

@@ -123,7 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
         </where>
         order by tl.record_id desc
-        limit 1
+        offset 0 rows fetch next 1 rows only
     </select>
     <select id="getLockJob" resultType="com.ktg.iscs.domain.IsJobTicketLock">
         SELECT

+ 2 - 1
ktg-iscs/src/main/resources/mapper/IsJobTicketPointsMapper.xml

@@ -179,7 +179,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND p.unlocked_by_key_id IS NULL
           AND p.point_id = #{pointId}
           AND k.collect_time IS NULL
-        limit 1
+        order by p.ticket_id asc
+        offset 0 rows fetch next 1 rows only
     </select>
     <select id="getVirtualLockConflictPoint" resultType="com.ktg.iscs.domain.IsJobTicketPoints">
         SELECT

+ 2 - 2
ktg-iscs/src/main/resources/mapper/IsMapPointMapper.xml

@@ -9,9 +9,9 @@
             p.*,
             m.name as map_name,
             CASE
-                WHEN p.map_type = "1" THEN
+                WHEN p.map_type = '1' THEN
                     w.workstation_name
-                WHEN p.map_type = "2" or p.map_type = "3" THEN
+                WHEN p.map_type = '2' or p.map_type = '3' THEN
                     ip.point_name
                 END AS entity_name
         FROM

+ 12 - 5
ktg-iscs/src/main/resources/mapper/IsMaterialsCheckPlanMapper.xml

@@ -5,10 +5,16 @@
 <mapper namespace="com.ktg.iscs.mapper.IsMaterialsCheckPlanMapper">
 
     <select id="getIsMaterialsCheckPlanPage" resultType="com.ktg.iscs.domain.IsMaterialsCheckPlan">
+        SELECT * FROM (
         SELECT
-            p.*, u.nick_name as check_user_name
-        FROM
-            is_materials_check_plan p
+        p.plan_id,
+        p.plan_name,
+        p.workstation_id,
+        p.plan_date,
+        p.check_user_id,
+        p.status,
+        u.nick_name
+        FROM is_materials_check_plan p
         LEFT JOIN is_materials_plan_cabinet c ON c.plan_id = p.plan_id
         LEFT JOIN sys_user u ON u.user_id = p.check_user_id
         <where>
@@ -31,7 +37,8 @@
                 and p.plan_name like concat('%',#{dto.planName},'%')
             </if>
         </where>
-        group by p.plan_id
-        order by p.plan_id desc
+        GROUP BY p.plan_id, p.plan_name, p.workstation_id, p.plan_date, p.check_user_id, p.status, u.nick_name
+        ) t
+        ORDER BY t.plan_id DESC
     </select>
 </mapper>

+ 3 - 3
ktg-iscs/src/main/resources/mapper/IsMaterialsLoanMapper.xml

@@ -144,11 +144,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         CASE
         WHEN l.actual_restitution_time IS NOT NULL THEN
         CONCAT(
-        FLOOR( TIMESTAMPDIFF( SECOND, l.loan_time, l.actual_restitution_time ) / 3600 ),
+        FLOOR( DATEDIFF( SECOND, l.loan_time, l.actual_restitution_time ) / 3600 ),
         '小时 ',
-        MOD ( FLOOR( TIMESTAMPDIFF( SECOND, l.loan_time, l.actual_restitution_time ) / 60 ), 60 ),
+        MOD ( FLOOR( DATEDIFF( SECOND, l.loan_time, l.actual_restitution_time ) / 60 ), 60 ),
         '分 ',
-        MOD ( TIMESTAMPDIFF( SECOND, l.loan_time, l.actual_restitution_time ), 60 ),
+        MOD ( DATEDIFF( SECOND, l.loan_time, l.actual_restitution_time ), 60 ),
         '秒'
         ) ELSE null
         END AS loan_duration

+ 39 - 25
ktg-iscs/src/main/resources/mapper/IsSopMapper.xml

@@ -92,32 +92,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </delete>
 
+
     <select id="getIsSopPage" resultType="com.ktg.iscs.domain.vo.sop.SopPageVO">
+        select t.* from (
         SELECT
-            s.*,
-            ws.workshop_name,
-            wa.workarea_name,
-            w.workstation_name,
-            d.machinery_name,
-            any_value(di.dict_label) as sop_type_name,
-            COUNT( p.record_id ) AS pointCount
+        s.sop_id,
+        max(s.sop_code) as sop_code,
+        max(s.sop_name) as sop_name,
+        max(s.sop_type) as sop_type,
+        max(s.workshop_id) as workshop_id,
+        max(s.workarea_id) as workarea_id,
+        max(s.sop_content) as sop_content,
+        max(s.sop_status) as sop_status,
+        max(s.create_by) as create_by,
+        max(s.create_time) as create_time,
+        max(s.update_time) as update_time,
+        max(s.update_by) as update_by,
+        max(s.sop_index) as sop_index,
+        max(ws.workshop_name) as workshop_name,
+        max(wa.workarea_name) as workarea_name,
+        max(w.workstation_name) as workstation_name,
+        max(d.machinery_name) as machinery_name,
+        max(di.dict_label) as sop_type_name,
+        COUNT(p.record_id) AS pointCount
         FROM
-            is_sop s
-            LEFT JOIN md_workshop ws ON ws.workshop_id = s.workshop_id
-            LEFT JOIN is_workarea wa ON wa.workarea_id = s.workarea_id
-            LEFT JOIN is_workstation w ON w.workstation_id = s.workstation_id
-            LEFT JOIN sys_user u ON u.user_id = s.create_by
-            LEFT JOIN is_machinery d ON d.machinery_id = s.machinery_id
-            LEFT JOIN is_sop_points p ON p.sop_id = s.sop_id
-            LEFT JOIN sys_dict_data di ON di.dict_type = "sop_type" and di.dict_value = s.sop_type
+        is_sop s
+        LEFT JOIN md_workshop ws ON ws.workshop_id = s.workshop_id
+        LEFT JOIN is_workarea wa ON wa.workarea_id = s.workarea_id
+        LEFT JOIN is_workstation w ON w.workstation_id = s.workstation_id
+        LEFT JOIN is_machinery d ON d.machinery_id = s.machinery_id
+        LEFT JOIN is_sop_points p ON p.sop_id = s.sop_id
+        LEFT JOIN sys_dict_data di ON di.dict_type = 'sop_type' and di.dict_value = s.sop_type
         <where>
-            <if test="dto.sopCode != null and dto.sopCode.trim != ''">
-                and s.sop_code like concat('%',#{dto.sopCode},'%')
+            <if test="dto.sopCode != null and dto.sopCode.trim() != ''">
+                and s.sop_code like concat('%', #{dto.sopCode}, '%')
             </if>
-            <if test="dto.sopName != null and dto.sopName.trim != ''">
-                and s.sop_name like concat('%',#{dto.sopName},'%')
+            <if test="dto.sopName != null and dto.sopName.trim() != ''">
+                and s.sop_name like concat('%', #{dto.sopName}, '%')
             </if>
-            <if test="dto.sopStatus != null and dto.sopStatus.trim != ''">
+            <if test="dto.sopStatus != null and dto.sopStatus.trim() != ''">
                 and s.sop_status = #{dto.sopStatus}
             </if>
             <if test="dto.workshopId != null">
@@ -126,13 +139,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="dto.workareaId != null">
                 and s.workarea_id = #{dto.workareaId}
             </if>
-            <if test="dto.sopType != null and dto.sopType.trim != ''">
+            <if test="dto.sopType != null and dto.sopType.trim() != ''">
                 and s.sop_type = #{dto.sopType}
             </if>
-            <if test="dto.startTime != null and dto.startTime.trim != ''">
+            <if test="dto.startTime != null and dto.startTime.trim() != ''">
                 and s.create_time &gt;= #{dto.startTime}
             </if>
-            <if test="dto.endTime != null and dto.endTime.trim != ''">
+            <if test="dto.endTime != null and dto.endTime.trim() != ''">
                 and s.create_time &lt;= #{dto.endTime}
             </if>
             <if test="dto.workstationId != null">
@@ -143,9 +156,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
             ${dto.paramMap.workstationScope}
         </where>
-        GROUP BY s.sop_id
-        ORDER BY s.sop_index ASC, s.sop_id DESC
+        GROUP BY s.sop_id) t
+        ORDER BY t.sop_index ASC, t.sop_id DESC
     </select>
+
     <select id="selectIsMarsSopBySopId" resultType="com.ktg.iscs.domain.vo.sop.MarsSopDetailVO">
         select s.*, w.workstation_name, m.machinery_name
         from is_sop s

+ 13 - 44
ktg-iscs/src/main/resources/mapper/StatisticsMapper.xml

@@ -66,8 +66,8 @@
                  LEFT JOIN (SELECT m.materials_type_id, count(m.materials_id) AS will_expire_count
                             FROM is_materials m
                             WHERE m.materials_cabinet_id is not null
-                              and DATE_ADD(NOW(), INTERVAL 30 DAY ) &gt; m.expiration_date
-                              AND NOW() &lt; m.expiration_date
+                              and DATEADD(DAY, 30, GETDATE()) &gt; m.expiration_date
+                              AND GETDATE() &lt; m.expiration_date
                             GROUP BY m.materials_type_id) b ON b.materials_type_id = t.materials_type_id
                  LEFT JOIN (SELECT m.materials_type_id, count(m.materials_id) AS expired_count
                             FROM is_materials m
@@ -132,7 +132,7 @@
         </where>
         GROUP BY ma.materials_type_id ) c ON c.materials_type_id = t.materials_type_id
 
-        LEFT JOIN ( SELECT ma.materials_type_id, AVG(TIMESTAMPDIFF(SECOND, m.loan_time, m.actual_restitution_time)) AS
+        LEFT JOIN ( SELECT ma.materials_type_id, AVG(DATEDIFF(SECOND, m.loan_time, m.actual_restitution_time)) AS
         average_time FROM
         is_materials_loan m LEFT JOIN is_materials ma on ma.materials_id = m.materials_id
         <where>
@@ -248,22 +248,21 @@
         GROUP BY l.loan_user_id) d on b.loan_user_id = a.user_id
     </select>
     <select id="getDayLoanStatistics" resultType="com.ktg.iscs.domain.vo.statistics.DayLoanStatisticsVO">
-        select FORMAT(a.date, '%m/%d') as day,
+        select FORMAT(a.date, 'MM/dd') as day,
         ( CASE WHEN b.all_count  IS NULL THEN 0 ELSE b.all_count  END ) AS all_count,
         ( CASE WHEN c.return_count  IS NULL THEN 0 ELSE c.return_count  END ) AS return_count,
         ( CASE WHEN d.timeout_count  IS NULL THEN 0 ELSE d.timeout_count  END ) AS timeout_count
         FROM (
             select a.Date from (
-            select CURRENT_TIMESTAMP - INTERVAL (a.a + (10 * b.a) + (100 * c.a) + (1000 * d.a) ) DAY as Date
+            select DATEADD(DAY, -(a.a + (10 * b.a) + (100 * c.a) + (1000 * d.a)), CURRENT_TIMESTAMP) as Date
             from (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as a
             cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as b
             cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c
             cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as d
             ) a where a.Date between #{startTime} and #{endTime}) a
-            left join (select count (l.materials_loan_id) as all_count, FORMAT(l.loan_time, '%Y-%m-%d') as date from is_materials_loan l group by date) b
-        on b.date = a.Date
-            left join (select count (l.materials_loan_id) as return_count, FORMAT(l.loan_time, '%Y-%m-%d') as date from is_materials_loan l where FORMAT(l.loan_time, '%Y-%m-%d') between #{startTime} and #{endTime} and l.actual_restitution_time &lt;= l.reminder_time group by date) c on c.date = a.Date
-            left join (select count (l.materials_loan_id) as timeout_count, FORMAT(l.loan_time, '%Y-%m-%d') as date from is_materials_loan l where FORMAT(l.loan_time, '%Y-%m-%d') between #{startTime} and #{endTime} and l.actual_restitution_time &gt; l.reminder_time group by date) d on d.date = a.Date
+            left join (select count (l.materials_loan_id) as all_count, FORMAT(l.loan_time, 'yyyy-MM-dd') as date from is_materials_loan l group by FORMAT(l.loan_time, 'yyyy-MM-dd')) b on b.date = FORMAT(a.Date, 'yyyy-MM-dd')
+            left join (select count (l.materials_loan_id) as return_count, FORMAT(l.loan_time, 'yyyy-MM-dd') as date from is_materials_loan l where FORMAT(l.loan_time, 'yyyy-MM-dd') between #{startTime} and #{endTime} and l.actual_restitution_time &lt;= l.reminder_time group by FORMAT(l.loan_time, 'yyyy-MM-dd')) c on c.date = FORMAT(a.Date, 'yyyy-MM-dd')
+            left join (select count (l.materials_loan_id) as timeout_count, FORMAT(l.loan_time, 'yyyy-MM-dd') as date from is_materials_loan l where FORMAT(l.loan_time, 'yyyy-MM-dd') between #{startTime} and #{endTime} and l.actual_restitution_time &gt; l.reminder_time group by FORMAT(l.loan_time, 'yyyy-MM-dd')) d on d.date = FORMAT(a.Date, 'yyyy-MM-dd')
         ORDER BY a.date DESC
     </select>
     <select id="getOngoingJobList" resultType="com.ktg.iscs.domain.vo.homePage.OngoingJobVO">
@@ -281,50 +280,20 @@
         ORDER BY j.ticket_id DESC
     </select>
     <select id="getLoanList" resultType="com.ktg.iscs.domain.vo.homePage.HomePageLoanVO">
-        <!-- select DATE_FORMAT(a.date, '%m/%d') as day,
+        select FORMAT(a.date, 'MM/dd') as day,
         ( CASE WHEN b.loan_count  IS NULL THEN 0 ELSE b.loan_count  END ) AS loan_count,
         ( CASE WHEN c.return_count  IS NULL THEN 0 ELSE c.return_count  END ) AS return_count
         FROM (
             select a.Date from (
-            select curdate() - INTERVAL (a.a + (10 * b.a) + (100 * c.a) + (1000 * d.a) ) DAY as Date
+            select DATEADD(DAY, -(a.a + (10 * b.a) + (100 * c.a) + (1000 * d.a)), CURRENT_TIMESTAMP) as Date
             from (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as a
             cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as b
             cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c
             cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as d
             ) a where a.Date between #{startTime} and #{endTime}) a
-            left join (select count(l.materials_loan_id) as loan_count, DATE_FORMAT(l.loan_time, '%Y-%m-%d') as date from is_materials_loan l where DATE_FORMAT(l.loan_time, '%Y-%m-%d') between #{startTime} and #{endTime} group by date) b on b.date = a.Date
-            left join (select count(l.materials_loan_id) as return_count, DATE_FORMAT(l.loan_time, '%Y-%m-%d') as date from is_materials_loan l where DATE_FORMAT(l.loan_time, '%Y-%m-%d') between #{startTime} and #{endTime} and l.status = "1" group by date) c on c.date = a.Date
-        ORDER BY a.date DESC -->
-        <!-- SELECT
-        FORMAT(a.Date, 'MM/dd') AS day,
-        COALESCE(b.loan_count, 0) AS loan_count,
-        COALESCE(c.return_count, 0) AS return_count
-        FROM (
-        SELECT
-        DATEADD(DAY, -(a.a + (10 * b.a) + (100 * c.a) + (1000 * d.a)), CURRENT_TIMESTAMP) AS Date
-        FROM (VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)) AS a(a)
-        CROSS JOIN (VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)) AS b(b)
-        CROSS JOIN (VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)) AS c(c)
-        CROSS JOIN (VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)) AS d(d)
-        ) AS a
-        LEFT JOIN (
-        SELECT
-        l.loan_time AS date,
-        COUNT(l.materials_loan_id) AS loan_count
-        FROM is_materials_loan l
-        WHERE l.loan_time BETWEEN #{startTime} AND #{endTime}
-        GROUP BY l.loan_time
-        ) AS b ON a.Date = b.date
-        LEFT JOIN (
-        SELECT
-        l.loan_time AS date,
-        COUNT(l.materials_loan_id) AS return_count
-        FROM is_materials_loan l
-        WHERE l.loan_time BETWEEN #{startTime} AND #{endTime}
-        AND l.status = '1'
-        GROUP BY l.loan_time
-        ) AS c ON a.Date = c.date
-        ORDER BY a.Date DESC;-->
+            left join (select count(l.materials_loan_id) as loan_count, FORMAT(l.loan_time, 'yyyy-MM-dd') as date from is_materials_loan l where FORMAT(l.loan_time, 'yyyy-MM-dd') between #{startTime} and #{endTime} group by FORMAT(l.loan_time, 'yyyy-MM-dd')) b on b.date = FORMAT(a.Date, 'yyyy-MM-dd')
+            left join (select count(l.materials_loan_id) as return_count, FORMAT(l.loan_time, 'yyyy-MM-dd') as date from is_materials_loan l where FORMAT(l.loan_time, 'yyyy-MM-dd') between #{startTime} and #{endTime} and l.status = '1' group by FORMAT(l.loan_time, 'yyyy-MM-dd')) c on c.date = FORMAT(a.Date, 'yyyy-MM-dd')
+        ORDER BY a.date DESC
 
     </select>
 

+ 7 - 7
ktg-mes/src/main/resources/mapper/cal/CalPlanTeamMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.cal.mapper.CalPlanTeamMapper">
-    
+
     <resultMap type="CalPlanTeam" id="CalPlanTeamResult">
         <result property="recordId"    column="record_id"    />
         <result property="planId"    column="plan_id"    />
@@ -27,14 +27,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectCalPlanTeamList" parameterType="CalPlanTeam" resultMap="CalPlanTeamResult">
         <include refid="selectCalPlanTeamVo"/>
-        <where>  
+        <where>
             <if test="planId != null "> and plan_id = #{planId}</if>
             <if test="teamId != null "> and team_id = #{teamId}</if>
             <if test="teamCode != null  and teamCode != ''"> and team_code = #{teamCode}</if>
             <if test="teamName != null  and teamName != ''"> and team_name like concat('%', #{teamName}, '%')</if>
         </where>
     </select>
-    
+
     <select id="selectCalPlanTeamByRecordId" parameterType="Long" resultMap="CalPlanTeamResult">
         <include refid="selectCalPlanTeamVo"/>
         where record_id = #{recordId}
@@ -42,9 +42,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkPlanTeamUnique" parameterType="CalPlanTeam" resultMap="CalPlanTeamResult">
         <include refid="selectCalPlanTeamVo"/>
-        where plan_id = #{planId} and team_id = #{teamId} limit 1
+        where plan_id = #{planId} and team_id = #{teamId} order by plan_id desc offset 0 rows fetch next 1 rows only
     </select>
-        
+
     <insert id="insertCalPlanTeam" parameterType="CalPlanTeam" useGeneratedKeys="true" keyProperty="recordId">
         insert into cal_plan_team
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -104,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteCalPlanTeamByRecordIds" parameterType="String">
-        delete from cal_plan_team where record_id in 
+        delete from cal_plan_team where record_id in
         <foreach item="recordId" collection="array" open="(" separator="," close=")">
             #{recordId}
         </foreach>
@@ -114,4 +114,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from cal_plan_team where plan_id = #{planId}
     </delete>
 
-</mapper>
+</mapper>

+ 7 - 7
ktg-mes/src/main/resources/mapper/dv/DvCheckMachineryMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.dv.mapper.DvCheckMachineryMapper">
-    
+
     <resultMap type="DvCheckMachinery" id="DvCheckMachineryResult">
         <result property="recordId"    column="record_id"    />
         <result property="planId"    column="plan_id"    />
@@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectDvCheckMachineryList" parameterType="DvCheckMachinery" resultMap="DvCheckMachineryResult">
         <include refid="selectDvCheckMachineryVo"/>
-        <where>  
+        <where>
             <if test="planId != null "> and plan_id = #{planId}</if>
             <if test="machineryId != null "> and machinery_id = #{machineryId}</if>
             <if test="machineryCode != null  and machineryCode != ''"> and machinery_code = #{machineryCode}</if>
@@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="machinerySpec != null  and machinerySpec != ''"> and machinery_spec = #{machinerySpec}</if>
         </where>
     </select>
-    
+
     <select id="selectDvCheckMachineryByRecordId" parameterType="Long" resultMap="DvCheckMachineryResult">
         <include refid="selectDvCheckMachineryVo"/>
         where record_id = #{recordId}
@@ -53,9 +53,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             select plan_type
             from dv_check_plan
             where plan_id = #{planId}
-        )  limit 1
+        ) order by record_id desc offset 0 rows fetch next 1 rows only
     </select>
-        
+
     <insert id="insertDvCheckMachinery" parameterType="DvCheckMachinery" useGeneratedKeys="true" keyProperty="recordId">
         insert into dv_check_machinery
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -121,7 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteDvCheckMachineryByRecordIds" parameterType="String">
-        delete from dv_check_machinery where record_id in 
+        delete from dv_check_machinery where record_id in
         <foreach item="recordId" collection="array" open="(" separator="," close=")">
             #{recordId}
         </foreach>
@@ -131,4 +131,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from dv_check_machinery where plan_id = #{planId}
     </delete>
 
-</mapper>
+</mapper>

+ 6 - 6
ktg-mes/src/main/resources/mapper/dv/DvCheckSubjectMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.dv.mapper.DvCheckSubjectMapper">
-    
+
     <resultMap type="DvCheckSubject" id="DvCheckSubjectResult">
         <result property="recordId"    column="record_id"    />
         <result property="planId"    column="plan_id"    />
@@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectDvCheckSubjectList" parameterType="DvCheckSubject" resultMap="DvCheckSubjectResult">
         <include refid="selectDvCheckSubjectVo"/>
-        <where>  
+        <where>
             <if test="planId != null "> and plan_id = #{planId}</if>
             <if test="subjectId != null "> and subject_id = #{subjectId}</if>
             <if test="subjectCode != null  and subjectCode != ''"> and subject_code = #{subjectCode}</if>
@@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="subjectStandard != null  and subjectStandard != ''"> and subject_standard = #{subjectStandard}</if>
         </where>
     </select>
-    
+
     <select id="selectDvCheckSubjectByRecordId" parameterType="Long" resultMap="DvCheckSubjectResult">
         <include refid="selectDvCheckSubjectVo"/>
         where record_id = #{recordId}
@@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkSubjectUnique" parameterType="DvCheckSubject" resultMap="DvCheckSubjectResult">
         <include refid="selectDvCheckSubjectVo"/>
-        where plan_id = #{planId} and subject_id = #{subjectId} limit 1
+        where plan_id = #{planId} and subject_id = #{subjectId} order by plan_id desc offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertDvCheckSubject" parameterType="DvCheckSubject" useGeneratedKeys="true" keyProperty="recordId">
@@ -119,7 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteDvCheckSubjectByRecordIds" parameterType="String">
-        delete from dv_check_subject where record_id in 
+        delete from dv_check_subject where record_id in
         <foreach item="recordId" collection="array" open="(" separator="," close=")">
             #{recordId}
         </foreach>
@@ -129,4 +129,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from dv_check_subject where plan_id = #{planId}
     </delete>
 
-</mapper>
+</mapper>

+ 6 - 6
ktg-mes/src/main/resources/mapper/dv/DvRepairMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.dv.mapper.DvRepairMapper">
-    
+
     <resultMap type="DvRepair" id="DvRepairResult">
         <result property="repairId"    column="repair_id"    />
         <result property="repairCode"    column="repair_code"    />
@@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectDvRepairList" parameterType="DvRepair" resultMap="DvRepairResult">
         <include refid="selectDvRepairVo"/>
-        <where>  
+        <where>
             <if test="repairCode != null  and repairCode != ''"> and repair_code = #{repairCode}</if>
             <if test="repairName != null  and repairName != ''"> and repair_name like concat('%', #{repairName}, '%')</if>
             <if test="machineryId != null "> and machinery_id = #{machineryId}</if>
@@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null  and status != ''"> and status = #{status}</if>
         </where>
     </select>
-    
+
     <select id="selectDvRepairByRepairId" parameterType="Long" resultMap="DvRepairResult">
         <include refid="selectDvRepairVo"/>
         where repair_id = #{repairId}
@@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkCodeUnique" parameterType="DvRepair" resultMap="DvRepairResult">
         <include refid="selectDvRepairVo"/>
-        where repair_code = #{repairCode} limit 1
+        where repair_code = #{repairCode} offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertDvRepair" parameterType="DvRepair" useGeneratedKeys="true" keyProperty="repairId">
@@ -159,9 +159,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteDvRepairByRepairIds" parameterType="String">
-        delete from dv_repair where repair_id in 
+        delete from dv_repair where repair_id in
         <foreach item="repairId" collection="array" open="(" separator="," close=")">
             #{repairId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 6 - 5
ktg-mes/src/main/resources/mapper/md/ItemTypeMapper.xml

@@ -63,12 +63,12 @@
 
     <select id="hasChildByItemTypeId" parameterType="Long" resultType="int">
 		select count(1) from md_item_type
-		where  parent_type_id = #{parentTypeId} limit 1
+		where parent_type_id = #{parentTypeId} order by parent_type_id desc offset 0 rows fetch next 1 rows only
 	</select>
 
     <select id="hasItemByItemTypeId" parameterType="Long" resultType="int">
         select count(1) from md_item
-        where item_type_id = #{itemTypeId} limit 1
+        where item_type_id = #{itemTypeId} offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="selectChildrenItemTypeById" parameterType="Long" resultMap="ItemTypeResult">
@@ -81,13 +81,14 @@
 
     <select id="checkItemTypeNameUnique" resultMap="ItemTypeResult">
         <include refid="selectItemTypeVo"/>
-        where item_type_name=#{itemTypeName} and parent_type_id = #{parentTypeId} limit 1
+        where item_type_name=#{itemTypeName} and parent_type_id = #{parentTypeId} order by parent_type_id desc offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="selectItemTypeByName" parameterType="String" resultMap="ItemTypeResult">
         select *
         from (
-                 select CONCAT((select group_concat(item_type_name separator '/')
+                 select CONCAT((select STRING_AGG(item_type_name, '/')
+                                    <!-- group_concat(item_type_name separator '/') -->
                                 from md_item_type b
                                 where FIND_IN_SET(CAST(item_type_id as CHAR),a.ancestors)>0),'/',a.item_type_name) as fullType,a.*
                  from md_item_type a
@@ -97,7 +98,7 @@
 
     <select id="checkItemTypeCodeUnique" resultMap="ItemTypeResult">
         <include refid="selectItemTypeVo"/>
-        where item_type_code=#{itemTypeCode} and parent_type_id = #{parentTypeId} limit 1
+        where item_type_code=#{itemTypeCode} and parent_type_id = #{parentTypeId} order by parent_type_id desc offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertItemType" parameterType="ItemType">

+ 8 - 8
ktg-mes/src/main/resources/mapper/md/MdClientMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.md.mapper.MdClientMapper">
-    
+
     <resultMap type="MdClient" id="MdClientResult">
         <result property="clientId"    column="client_id"    />
         <result property="clientCode"    column="client_code"    />
@@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectMdClientList" parameterType="MdClient" resultMap="MdClientResult">
         <include refid="selectMdClientVo"/>
-        <where>  
+        <where>
             <if test="clientCode != null  and clientCode != ''"> and client_code = #{clientCode}</if>
             <if test="clientName != null  and clientName != ''"> and client_name like concat('%', #{clientName}, '%')</if>
             <if test="clientNick != null  and clientNick != ''"> and client_nick = #{clientNick}</if>
@@ -65,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and client_id != 0
         </where>
     </select>
-    
+
     <select id="selectMdClientByClientId" parameterType="Long" resultMap="MdClientResult">
         <include refid="selectMdClientVo"/>
         where client_id = #{clientId}
@@ -73,17 +73,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkClientCodeUnique" parameterType="MdClient" resultMap="MdClientResult">
         <include refid="selectMdClientVo"/>
-        where client_code = #{clientCode} limit 1
+        where client_code = #{clientCode} order by client_code desc offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkClientNameUnique" parameterType="MdClient" resultMap="MdClientResult">
         <include refid="selectMdClientVo"/>
-        where client_name = #{clientName} limit 1
+        where client_name = #{clientName} order by client_name desc offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkClientNickUnique" parameterType="MdClient" resultMap="MdClientResult">
         <include refid="selectMdClientVo"/>
-        where client_nick = #{clientNick} limit 1
+        where client_nick = #{clientNick} order by client_nick desc offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertMdClient" parameterType="MdClient" useGeneratedKeys="true" keyProperty="clientId">
@@ -190,9 +190,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteMdClientByClientIds" parameterType="String">
-        delete from md_client where client_id in 
+        delete from md_client where client_id in
         <foreach item="clientId" collection="array" open="(" separator="," close=")">
             #{clientId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 3 - 3
ktg-mes/src/main/resources/mapper/md/MdItemMapper.xml

@@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<select id="getExeportList" parameterType="MdItem" resultMap="MdItemResult">
 		select i.item_id, i.item_code, i.item_name, i.specification, i.unit_of_measure,i.unit_name, i.item_or_product,
-		i.item_type_id,i.item_type_code,i.enable_flag,i.safe_stock_flag,i.min_stock,i.max_stock,i.high_value, i.create_by, i.create_time, i.remark,CONCAT((select group_concat(item_type_name separator '/') from md_item_type b where FIND_IN_SET(CAST(item_type_id as CHAR),a.ancestors)>0),'/',a.item_type_name) as item_type_name
+		i.item_type_id,i.item_type_code,i.enable_flag,i.safe_stock_flag,i.min_stock,i.max_stock,i.high_value, i.create_by, i.create_time, i.remark,CONCAT((select STRING_AGG(item_type_name, '/') from md_item_type b where FIND_IN_SET(CAST(item_type_id as CHAR),a.ancestors)>0),'/',a.item_type_name) as item_type_name
 		from md_item i
 		left join md_item_type a
 		on i.item_type_id  = a.item_type_id
@@ -88,12 +88,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<select id="checkItemCodeUnique" parameterType="MdItem" resultMap="MdItemResult">
 		<include refid="selectMdItemVo"/>
-		where item_code = #{itemCode} limit 1
+		where item_code = #{itemCode} order by item_code desc offset 0 rows fetch next 1 rows only
 	</select>
 
 	<select id="checkItemNameUnique" parameterType="MdItem" resultMap="MdItemResult">
 		<include refid="selectMdItemVo"/>
-		where item_code = #{itemName} limit 1
+		where item_code = #{itemName} offset 0 rows fetch next 1 rows only
 	</select>
 
 	<insert id="insertMdItem" parameterType="MdItem" useGeneratedKeys="true" keyProperty="itemId">

+ 8 - 8
ktg-mes/src/main/resources/mapper/md/MdVendorMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.md.mapper.MdVendorMapper">
-    
+
     <resultMap type="MdVendor" id="MdVendorResult">
         <result property="vendorId"    column="vendor_id"    />
         <result property="vendorCode"    column="vendor_code"    />
@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectMdVendorList" parameterType="MdVendor" resultMap="MdVendorResult">
         <include refid="selectMdVendorVo"/>
-        <where>  
+        <where>
             <if test="vendorCode != null  and vendorCode != ''"> and vendor_code = #{vendorCode}</if>
             <if test="vendorName != null  and vendorName != ''"> and vendor_name like concat('%', #{vendorName}, '%')</if>
             <if test="vendorNick != null  and vendorNick != ''"> and vendor_nick = #{vendorNick}</if>
@@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="enableFlag != null  and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
         </where>
     </select>
-    
+
     <select id="selectMdVendorByVendorId" parameterType="Long" resultMap="MdVendorResult">
         <include refid="selectMdVendorVo"/>
         where vendor_id = #{vendorId}
@@ -74,17 +74,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkVendorCodeUnique" parameterType="MdVendor" resultMap="MdVendorResult">
         <include refid="selectMdVendorVo"/>
-        where vendor_code = #{vendorCode} limit 1
+        where vendor_code = #{vendorCode} order by vendor_code desc offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkVendorNameUnique" parameterType="MdVendor" resultMap="MdVendorResult">
         <include refid="selectMdVendorVo"/>
-        where vendor_name = #{vendorName} limit 1
+        where vendor_name = #{vendorName} order by vendor_name desc offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkVendorNickUnique" parameterType="MdVendor" resultMap="MdVendorResult">
         <include refid="selectMdVendorVo"/>
-        where vendor_nick = #{vendorNick} limit 1
+        where vendor_nick = #{vendorNick} order by vendor_nick desc offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertMdVendor" parameterType="MdVendor" useGeneratedKeys="true" keyProperty="vendorId">
@@ -194,9 +194,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteMdVendorByVendorIds" parameterType="String">
-        delete from md_vendor where vendor_id in 
+        delete from md_vendor where vendor_id in
         <foreach item="vendorId" collection="array" open="(" separator="," close=")">
             #{vendorId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 2 - 2
ktg-mes/src/main/resources/mapper/md/MdWorkshopMapper.xml

@@ -46,12 +46,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkWorkshopCodeUnique" parameterType="MdWorkshop" resultMap="MdWorkshopResult">
         <include refid="selectMdWorkshopVo"/>
-        where workshop_code = #{workshopCode} limit 1
+        where workshop_code = #{workshopCode} offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkWorkshopNameUnique" parameterType="MdWorkshop" resultMap="MdWorkshopResult">
         <include refid="selectMdWorkshopVo"/>
-        where workshop_name = #{workshopName} limit 1
+        where workshop_name = #{workshopName} order by workshop_name desc offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertMdWorkshop" parameterType="MdWorkshop" useGeneratedKeys="true" keyProperty="workshopId">

+ 6 - 6
ktg-mes/src/main/resources/mapper/md/MdWorkstationMachineMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.md.mapper.MdWorkstationMachineMapper">
-    
+
     <resultMap type="MdWorkstationMachine" id="MdWorkstationMachineResult">
         <result property="recordId"    column="record_id"    />
         <result property="workstationId"    column="workstation_id"    />
@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectMdWorkstationMachineList" parameterType="MdWorkstationMachine" resultMap="MdWorkstationMachineResult">
         <include refid="selectMdWorkstationMachineVo"/>
-        <where>  
+        <where>
             <if test="workstationId != null "> and workstation_id = #{workstationId}</if>
             <if test="machineryId != null "> and machinery_id = #{machineryId}</if>
             <if test="machineryCode != null  and machineryCode != ''"> and machinery_code = #{machineryCode}</if>
@@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="quantity != null "> and quantity = #{quantity}</if>
         </where>
     </select>
-    
+
     <select id="selectMdWorkstationMachineByRecordId" parameterType="Long" resultMap="MdWorkstationMachineResult">
         <include refid="selectMdWorkstationMachineVo"/>
         where record_id = #{recordId}
@@ -44,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkMachineryExists" parameterType="MdWorkstationMachine" resultMap="MdWorkstationMachineResult">
         <include refid="selectMdWorkstationMachineVo"/>
-        where machinery_code = #{machineryCode} limit 1
+        where machinery_code = #{machineryCode} offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertMdWorkstationMachine" parameterType="MdWorkstationMachine" useGeneratedKeys="true" keyProperty="recordId">
@@ -109,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteMdWorkstationMachineByRecordIds" parameterType="String">
-        delete from md_workstation_machine where record_id in 
+        delete from md_workstation_machine where record_id in
         <foreach item="recordId" collection="array" open="(" separator="," close=")">
             #{recordId}
         </foreach>
@@ -118,4 +118,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <delete id="deleteByWorkstationId" parameterType="Long">
         delete from md_workstation_machine where workstation_id = #{workstationId}
     </delete>
-</mapper>
+</mapper>

+ 7 - 7
ktg-mes/src/main/resources/mapper/md/MdWorkstationMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.md.mapper.MdWorkstationMapper">
-    
+
     <resultMap type="MdWorkstation" id="MdWorkstationResult">
         <result property="workstationId"    column="workstation_id"    />
         <result property="workstationCode"    column="workstation_code"    />
@@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectMdWorkstationList" parameterType="MdWorkstation" resultMap="MdWorkstationResult">
         <include refid="selectMdWorkstationVo"/>
-        <where>  
+        <where>
             <if test="workstationCode != null  and workstationCode != ''"> and workstation_code = #{workstationCode}</if>
             <if test="workstationName != null  and workstationName != ''"> and workstation_name like concat('%', #{workstationName}, '%')</if>
             <if test="workstationAddress != null  and workstationAddress != ''"> and workstation_address = #{workstationAddress}</if>
@@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="enableFlag != null  and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
         </where>
     </select>
-    
+
     <select id="selectMdWorkstationByWorkstationId" parameterType="Long" resultMap="MdWorkstationResult">
         <include refid="selectMdWorkstationVo"/>
         where workstation_id = #{workstationId}
@@ -72,12 +72,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkWorkStationCodeUnique" parameterType="MdWorkstation" resultMap="MdWorkstationResult">
         <include refid="selectMdWorkstationVo"/>
-        where workstation_code = #{workstationCode} limit 1
+        where workstation_code = #{workstationCode} offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkWorkStationNameUnique" parameterType="MdWorkstation" resultMap="MdWorkstationResult">
         <include refid="selectMdWorkstationVo"/>
-        where workstation_name = #{workstationName} limit 1
+        where workstation_name = #{workstationName} offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertMdWorkstation" parameterType="MdWorkstation" useGeneratedKeys="true" keyProperty="workstationId">
@@ -184,9 +184,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteMdWorkstationByWorkstationIds" parameterType="String">
-        delete from md_workstation where workstation_id in 
+        delete from md_workstation where workstation_id in
         <foreach item="workstationId" collection="array" open="(" separator="," close=")">
             #{workstationId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 6 - 6
ktg-mes/src/main/resources/mapper/md/MdWorkstationToolMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.md.mapper.MdWorkstationToolMapper">
-    
+
     <resultMap type="MdWorkstationTool" id="MdWorkstationToolResult">
         <result property="recordId"    column="record_id"    />
         <result property="workstationId"    column="workstation_id"    />
@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectMdWorkstationToolList" parameterType="MdWorkstationTool" resultMap="MdWorkstationToolResult">
         <include refid="selectMdWorkstationToolVo"/>
-        <where>  
+        <where>
             <if test="workstationId != null "> and workstation_id = #{workstationId}</if>
             <if test="toolTypeId != null "> and tool_type_id = #{toolTypeId}</if>
             <if test="toolTypeCode != null  and toolTypeCode != ''"> and tool_type_code = #{toolTypeCode}</if>
@@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="quantity != null "> and quantity = #{quantity}</if>
         </where>
     </select>
-    
+
     <select id="selectMdWorkstationToolByRecordId" parameterType="Long" resultMap="MdWorkstationToolResult">
         <include refid="selectMdWorkstationToolVo"/>
         where record_id = #{recordId}
@@ -44,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkToolTypeExists" parameterType="MdWorkstationTool" resultMap="MdWorkstationToolResult">
         <include refid="selectMdWorkstationToolVo"/>
-        where tool_type_id = #{toolTypeId} and workstation_id = #{workstationId} limit 1
+        where tool_type_id = #{toolTypeId} and workstation_id = #{workstationId} offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertMdWorkstationTool" parameterType="MdWorkstationTool" useGeneratedKeys="true" keyProperty="recordId">
@@ -109,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteMdWorkstationToolByRecordIds" parameterType="String">
-        delete from md_workstation_tool where record_id in 
+        delete from md_workstation_tool where record_id in
         <foreach item="recordId" collection="array" open="(" separator="," close=")">
             #{recordId}
         </foreach>
@@ -118,4 +118,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <delete id="deleteByWorkstationId" parameterType="Long">
         delete from md_workstation_tool where workstation_id = #{workstationId}
     </delete>
-</mapper>
+</mapper>

+ 6 - 6
ktg-mes/src/main/resources/mapper/md/MdWorkstationWorkerMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.md.mapper.MdWorkstationWorkerMapper">
-    
+
     <resultMap type="MdWorkstationWorker" id="MdWorkstationWorkerResult">
         <result property="recordId"    column="record_id"    />
         <result property="workstationId"    column="workstation_id"    />
@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectMdWorkstationWorkerList" parameterType="MdWorkstationWorker" resultMap="MdWorkstationWorkerResult">
         <include refid="selectMdWorkstationWorkerVo"/>
-        <where>  
+        <where>
             <if test="workstationId != null "> and workstation_id = #{workstationId}</if>
             <if test="postId != null "> and post_id = #{postId}</if>
             <if test="postCode != null  and postCode != ''"> and post_code = #{postCode}</if>
@@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="quantity != null "> and quantity = #{quantity}</if>
         </where>
     </select>
-    
+
     <select id="selectMdWorkstationWorkerByRecordId" parameterType="Long" resultMap="MdWorkstationWorkerResult">
         <include refid="selectMdWorkstationWorkerVo"/>
         where record_id = #{recordId}
@@ -44,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkPostExist" parameterType="MdWorkstationWorker" resultMap="MdWorkstationWorkerResult">
         <include refid="selectMdWorkstationWorkerVo"/>
-        where post_code = #{postCode} and workstation_id = #{workstationId} limit 1
+        where post_code = #{postCode} and workstation_id = #{workstationId} offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertMdWorkstationWorker" parameterType="MdWorkstationWorker" useGeneratedKeys="true" keyProperty="recordId">
@@ -109,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteMdWorkstationWorkerByRecordIds" parameterType="String">
-        delete from md_workstation_worker where record_id in 
+        delete from md_workstation_worker where record_id in
         <foreach item="recordId" collection="array" open="(" separator="," close=")">
             #{recordId}
         </foreach>
@@ -118,4 +118,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <delete id="deleteByWorkstationId" parameterType="Long">
         delete from md_workstation_worker where workstation_id = #{workstationId}
     </delete>
-</mapper>
+</mapper>

+ 9 - 9
ktg-mes/src/main/resources/mapper/pro/ProProcessMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.pro.mapper.ProProcessMapper">
-    
+
     <resultMap type="ProProcess" id="ProProcessResult">
         <result property="processId"    column="process_id"    />
         <result property="processCode"    column="process_code"    />
@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectProProcessList" parameterType="ProProcess" resultMap="ProProcessResult">
         <include refid="selectProProcessVo"/>
-        <where>  
+        <where>
             <if test="processCode != null  and processCode != ''"> and process_code = #{processCode}</if>
             <if test="processName != null  and processName != ''"> and process_name like concat('%', #{processName}, '%')</if>
             <if test="attention != null  and attention != ''"> and attention = #{attention}</if>
@@ -35,22 +35,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         order by create_time desc
     </select>
-    
+
     <select id="selectProProcessByProcessId" parameterType="Long" resultMap="ProProcessResult">
         <include refid="selectProProcessVo"/>
         where process_id = #{processId}
     </select>
-	
+
 	<select id="checkProcessCodeUnique" parameterType="ProProcess" resultMap="ProProcessResult">
         <include refid="selectProProcessVo"/>
-        where process_code = #{processCode} limit 1
+        where process_code = #{processCode} offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkProcessNameUnique" parameterType="ProProcess" resultMap="ProProcessResult">
         <include refid="selectProProcessVo"/>
-        where process_name = #{processName} limit 1
+        where process_name = #{processName} offset 0 rows fetch next 1 rows only
     </select>
-        
+
     <insert id="insertProProcess" parameterType="ProProcess" useGeneratedKeys="true" keyProperty="processId">
         insert into pro_process
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -110,9 +110,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteProProcessByProcessIds" parameterType="String">
-        delete from pro_process where process_id in 
+        delete from pro_process where process_id in
         <foreach item="processId" collection="array" open="(" separator="," close=")">
             #{processId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 6 - 6
ktg-mes/src/main/resources/mapper/pro/ProRouteMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.pro.mapper.ProRouteMapper">
-    
+
     <resultMap type="ProRoute" id="ProRouteResult">
         <result property="routeId"    column="route_id"    />
         <result property="routeCode"    column="route_code"    />
@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectProRouteList" parameterType="ProRoute" resultMap="ProRouteResult">
         <include refid="selectProRouteVo"/>
-        <where>  
+        <where>
             <if test="routeCode != null  and routeCode != ''"> and route_code = #{routeCode}</if>
             <if test="routeName != null  and routeName != ''"> and route_name like concat('%', #{routeName}, '%')</if>
             <if test="routeDesc != null  and routeDesc != ''"> and route_desc = #{routeDesc}</if>
@@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         order by create_time desc
     </select>
-    
+
     <select id="selectProRouteByRouteId" parameterType="Long" resultMap="ProRouteResult">
         <include refid="selectProRouteVo"/>
         where route_id = #{routeId}
@@ -52,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkRouteCodeUnique" parameterType="ProRoute" resultMap="ProRouteResult">
         <include refid="selectProRouteVo"/>
-        where route_code = #{routeCode} limit 1
+        where route_code = #{routeCode} offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertProRoute" parameterType="ProRoute" useGeneratedKeys="true" keyProperty="routeId">
@@ -114,9 +114,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteProRouteByRouteIds" parameterType="String">
-        delete from pro_route where route_id in 
+        delete from pro_route where route_id in
         <foreach item="routeId" collection="array" open="(" separator="," close=")">
             #{routeId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 12 - 12
ktg-mes/src/main/resources/mapper/pro/ProRouteProcessMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.pro.mapper.ProRouteProcessMapper">
-    
+
     <resultMap type="ProRouteProcess" id="ProRouteProcessResult">
         <result property="recordId"    column="record_id"    />
         <result property="routeId"    column="route_id"    />
@@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectProRouteProcessList" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">
         <include refid="selectProRouteProcessVo"/>
-        <where>  
+        <where>
             <if test="routeId != null "> and route_id = #{routeId}</if>
             <if test="processId != null "> and process_id = #{processId}</if>
             <if test="processCode != null  and processCode != ''"> and process_code = #{processCode}</if>
@@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         order by order_num asc
     </select>
-    
+
     <select id="selectProRouteProcessByRecordId" parameterType="Long" resultMap="ProRouteProcessResult">
         <include refid="selectProRouteProcessVo"/>
         where record_id = #{recordId}
@@ -64,17 +64,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkOrderNumExists" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">
         <include refid="selectProRouteProcessVo"/>
-        where route_id = #{routeId} and order_num = #{orderNum} limit 1
+        where route_id = #{routeId} and order_num = #{orderNum} offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkProcessExists" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">
         <include refid="selectProRouteProcessVo"/>
-        where route_id = #{routeId} and process_id = #{processId} limit 1
+        where route_id = #{routeId} and process_id = #{processId} offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkUpdateFlagUnique" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">
         <include refid="selectProRouteProcessVo"/>
-        where route_id = #{routeId} and key_flag = 'Y' limit 1
+        where route_id = #{routeId} and key_flag = 'Y' offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="findPreProcess" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">
@@ -86,11 +86,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 AND order_num &lt; (
                     SELECT order_num
                     FROM pro_route_process
-                    WHERE route_id = #{routeId} limit 1
+                    WHERE route_id = #{routeId} offset 0 rows fetch next 1 rows only
                 )
             </otherwise>
         </choose>
-        ORDER BY order_num DESC LIMIT 1
+        ORDER BY order_num DESC offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="findNextProcess" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">
@@ -102,11 +102,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 AND order_num &gt; (
                 SELECT order_num
                 FROM pro_route_process
-                WHERE route_id = #{routeId} limit 1
+                WHERE route_id = #{routeId} offset 0 rows fetch next 1 rows only
                 )
             </otherwise>
         </choose>
-        ORDER BY order_num ASC LIMIT 1
+        ORDER BY order_num ASC offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertProRouteProcess" parameterType="ProRouteProcess" useGeneratedKeys="true" keyProperty="recordId">
@@ -198,7 +198,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteProRouteProcessByRecordIds" parameterType="String">
-        delete from pro_route_process where record_id in 
+        delete from pro_route_process where record_id in
         <foreach item="recordId" collection="array" open="(" separator="," close=")">
             #{recordId}
         </foreach>
@@ -208,4 +208,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from pro_route_process where route_id = #{routeId}
     </delete>
 
-</mapper>
+</mapper>

+ 6 - 6
ktg-mes/src/main/resources/mapper/pro/ProRouteProductMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.pro.mapper.ProRouteProductMapper">
-    
+
     <resultMap type="ProRouteProduct" id="ProRouteProductResult">
         <result property="recordId"    column="record_id"    />
         <result property="routeId"    column="route_id"    />
@@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectProRouteProductList" parameterType="ProRouteProduct" resultMap="ProRouteProductResult">
         <include refid="selectProRouteProductVo"/>
-        <where>  
+        <where>
             <if test="routeId != null "> and route_id = #{routeId}</if>
             <if test="itemId != null "> and item_id = #{itemId}</if>
             <if test="itemCode != null  and itemCode != ''"> and item_code = #{itemCode}</if>
@@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="timeUnitType != null  and timeUnitType != ''"> and time_unit_type = #{timeUnitType}</if>
         </where>
     </select>
-    
+
     <select id="selectProRouteProductByRecordId" parameterType="Long" resultMap="ProRouteProductResult">
         <include refid="selectProRouteProductVo"/>
         where record_id = #{recordId}
@@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkItemUnique" parameterType="ProRouteProduct" resultMap="ProRouteProductResult">
         <include refid="selectProRouteProductVo"/>
-        where item_id = #{itemId} limit 1
+        where item_id = #{itemId} offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertProRouteProduct" parameterType="ProRouteProduct" useGeneratedKeys="true" keyProperty="recordId">
@@ -130,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteProRouteProductByRecordIds" parameterType="String">
-        delete from pro_route_product where record_id in 
+        delete from pro_route_product where record_id in
         <foreach item="recordId" collection="array" open="(" separator="," close=")">
             #{recordId}
         </foreach>
@@ -140,4 +140,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from pro_route_product where route_id = #{routeId}
     </delete>
 
-</mapper>
+</mapper>

+ 6 - 6
ktg-mes/src/main/resources/mapper/pro/ProTaskIssueMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.pro.mapper.ProTaskIssueMapper">
-    
+
     <resultMap type="ProTaskIssue" id="ProTaskIssueResult">
         <result property="recordId"    column="record_id"    />
         <result property="taskId"    column="task_id"    />
@@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectProTaskIssueList" parameterType="ProTaskIssue" resultMap="ProTaskIssueResult">
         <include refid="selectProTaskIssueVo"/>
-        <where>  
+        <where>
             <if test="taskId != null "> and task_id = #{taskId}</if>
             <if test="workorderId != null "> and workorder_id = #{workorderId}</if>
             <if test="workstationId != null "> and workstation_id = #{workstationId}</if>
@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="quantityUsed != null "> and quantity_used = #{quantityUsed}</if>
         </where>
     </select>
-    
+
     <select id="selectProTaskIssueByRecordId" parameterType="Long" resultMap="ProTaskIssueResult">
         <include refid="selectProTaskIssueVo"/>
         where record_id = #{recordId}
@@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         and task_id = #{taskId}
         and source_doc_type = #{sourceDocType}
         and source_line_id = #{sourceLineId}
-        limit 1
+        offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertProTaskIssue" parameterType="ProTaskIssue" useGeneratedKeys="true" keyProperty="recordId">
@@ -168,9 +168,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteProTaskIssueByRecordIds" parameterType="String">
-        delete from pro_task_issue where record_id in 
+        delete from pro_task_issue where record_id in
         <foreach item="recordId" collection="array" open="(" separator="," close=")">
             #{recordId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 4 - 4
ktg-mes/src/main/resources/mapper/pro/ProTaskMapper.xml

@@ -111,14 +111,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="quantityUnquanlify != null "> and t.quantity_unquanlify = #{quantityUnquanlify}</if>
         </where>
     </select>
-    
+
     <select id="selectProTaskByTaskId" parameterType="Long" resultMap="ProTaskResult">
         <include refid="selectProTaskVo"/>
         where task_id = #{taskId}
     </select>
 
     <select id="selectProTaskProcessViewByWorkorder" parameterType="Long" resultMap="ProTaskResult">
-        select a.process_id,a.process_code,a.process_name,IFNULL(b.quantity,0) as quantity,IFNULL(b.quantity_produced,0) as quantity_produced,IFNULL(b.quantity_quanlify,0) as quantity_quanlify,IFNULL(b.quantity_unquanlify,0) as quantity_unquanlify
+        select a.process_id,a.process_code,a.process_name,ISNULL(b.quantity,0) as quantity,ISNULL(b.quantity_produced,0) as quantity_produced,ISNULL(b.quantity_quanlify,0) as quantity_quanlify,ISNULL(b.quantity_unquanlify,0) as quantity_unquanlify
         from (
                  select t.*
                  from pro_workorder pw
@@ -307,9 +307,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteProTaskByTaskIds" parameterType="String">
-        delete from pro_task where task_id in 
+        delete from pro_task where task_id in
         <foreach item="taskId" collection="array" open="(" separator="," close=")">
             #{taskId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 6 - 6
ktg-mes/src/main/resources/mapper/pro/ProWorkorderMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.pro.mapper.ProWorkorderMapper">
-    
+
     <resultMap type="ProWorkorder" id="ProWorkorderResult">
         <result property="workorderId"    column="workorder_id"    />
         <result property="workorderCode"    column="workorder_code"    />
@@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectProWorkorderList" parameterType="ProWorkorder" resultMap="ProWorkorderResult">
         <include refid="selectProWorkorderVo"/>
-        <where>  
+        <where>
             <if test="workorderCode != null  and workorderCode != ''"> and workorder_code = #{workorderCode}</if>
             <if test="workorderName != null  and workorderName != ''"> and workorder_name like concat('%', #{workorderName}, '%')</if>
             <if test="workorderType != null and workorderType !=''"> and workorder_type = #{workorderType}</if>
@@ -79,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         order by create_time desc
     </select>
-    
+
     <select id="selectProWorkorderByWorkorderId" parameterType="Long" resultMap="ProWorkorderResult">
         <include refid="selectProWorkorderVo"/>
         where workorder_id = #{workorderId}
@@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkWorkorderCodeUnique" parameterType="ProWorkorder" resultMap="ProWorkorderResult">
         <include refid="selectProWorkorderVo"/>
-        where workorder_code = #{workorderCode} limit 1
+        where workorder_code = #{workorderCode} offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertProWorkorder" parameterType="ProWorkorder" useGeneratedKeys="true" keyProperty="workorderId">
@@ -215,9 +215,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteProWorkorderByWorkorderIds" parameterType="String">
-        delete from pro_workorder where workorder_id in 
+        delete from pro_workorder where workorder_id in
         <foreach item="workorderId" collection="array" open="(" separator="," close=")">
             #{workorderId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 6 - 6
ktg-mes/src/main/resources/mapper/qc/QcIqcMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.qc.mapper.QcIqcMapper">
-    
+
     <resultMap type="QcIqc" id="QcIqcResult">
         <result property="iqcId"    column="iqc_id"    />
         <result property="iqcCode"    column="iqc_code"    />
@@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectQcIqcList" parameterType="QcIqc" resultMap="QcIqcResult">
         <include refid="selectQcIqcVo"/>
-        <where>  
+        <where>
             <if test="iqcCode != null  and iqcCode != ''"> and iqc_code = #{iqcCode}</if>
             <if test="iqcName != null  and iqcName != ''"> and iqc_name like concat('%', #{iqcName}, '%')</if>
             <if test="templateId != null "> and template_id = #{templateId}</if>
@@ -94,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         order by create_time desc
     </select>
-    
+
     <select id="selectQcIqcByIqcId" parameterType="Long" resultMap="QcIqcResult">
         <include refid="selectQcIqcVo"/>
         where iqc_id = #{iqcId}
@@ -102,7 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkIqcCodeUnique" parameterType="QcIqc" resultMap="QcIqcResult">
         <include refid="selectQcIqcVo"/>
-        where iqc_code = #{iqcCode} limit 1
+        where iqc_code = #{iqcCode} offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertQcIqc" parameterType="QcIqc" useGeneratedKeys="true" keyProperty="iqcId">
@@ -272,9 +272,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteQcIqcByIqcIds" parameterType="String">
-        delete from qc_iqc where iqc_id in 
+        delete from qc_iqc where iqc_id in
         <foreach item="iqcId" collection="array" open="(" separator="," close=")">
             #{iqcId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 7 - 7
ktg-mes/src/main/resources/mapper/qc/QcTemplateMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.qc.mapper.QcTemplateMapper">
-    
+
     <resultMap type="QcTemplate" id="QcTemplateResult">
         <result property="templateId"    column="template_id"    />
         <result property="templateCode"    column="template_code"    />
@@ -27,14 +27,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectQcTemplateList" parameterType="QcTemplate" resultMap="QcTemplateResult">
         <include refid="selectQcTemplateVo"/>
-        <where>  
+        <where>
             <if test="templateCode != null  and templateCode != ''"> and template_code = #{templateCode}</if>
             <if test="templateName != null  and templateName != ''"> and template_name like concat('%', #{templateName}, '%')</if>
             <if test="qcTypes != null  and qcTypes != ''"> and qc_types = #{qcTypes}</if>
             <if test="enableFlag != null  and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
         </where>
     </select>
-    
+
     <select id="selectQcTemplateByTemplateId" parameterType="Long" resultMap="QcTemplateResult">
         <include refid="selectQcTemplateVo"/>
         where template_id = #{templateId}
@@ -50,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         from qc_template t
         left join qc_template_product tl on t.template_id = tl.template_id
         where t.qc_types like concat('%',#{qcTypes},'%') and tl.item_id = #{itemId}
-        limit 1;
+        offset 0 rows fetch next 1 rows only;
     </select>
 
     <select id="findTemplateByProductIdAndQcType" parameterType="QcMobParam" resultMap="QcTemplateResult">
@@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                             on t.template_id = p.template_id
         where p.item_id = #{itemId}
           and t.qc_types like concat('%',#{qcType},'%')
-        limit 1
+        offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertQcTemplate" parameterType="QcTemplate" useGeneratedKeys="true" keyProperty="templateId">
@@ -122,9 +122,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteQcTemplateByTemplateIds" parameterType="String">
-        delete from qc_template where template_id in 
+        delete from qc_template where template_id in
         <foreach item="templateId" collection="array" open="(" separator="," close=")">
             #{templateId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 9 - 9
ktg-mes/src/main/resources/mapper/tm/TmToolMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.tm.mapper.TmToolMapper">
-    
+
     <resultMap type="TmTool" id="TmToolResult">
         <result property="toolId"    column="tool_id"    />
         <result property="toolCode"    column="tool_code"    />
@@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectTmToolList" parameterType="TmTool" resultMap="TmToolResult">
         <include refid="selectTmToolVo"/>
-        <where>  
+        <where>
             <if test="toolCode != null  and toolCode != ''"> and tool_code = #{toolCode}</if>
             <if test="toolName != null  and toolName != ''"> and tool_name like concat('%', #{toolName}, '%')</if>
             <if test="brand != null  and brand != ''"> and brand = #{brand}</if>
@@ -54,17 +54,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null  and status != ''"> and status = #{status}</if>
         </where>
     </select>
-    
+
     <select id="selectTmToolByToolId" parameterType="Long" resultMap="TmToolResult">
         <include refid="selectTmToolVo"/>
         where tool_id = #{toolId}
     </select>
-        
+
 	<select id="checkToolCodeUnique" parameterType="TmTool" resultMap="TmToolResult">
         <include refid="selectTmToolVo"/>
-        where tool_code = #{toolCode} limit 1
-    </select>	
-		
+        where tool_code = #{toolCode} offset 0 rows fetch next 1 rows only
+    </select>
+
     <insert id="insertTmTool" parameterType="TmTool" useGeneratedKeys="true" keyProperty="toolId">
         insert into tm_tool
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -156,9 +156,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteTmToolByToolIds" parameterType="String">
-        delete from tm_tool where tool_id in 
+        delete from tm_tool where tool_id in
         <foreach item="toolId" collection="array" open="(" separator="," close=")">
             #{toolId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 7 - 7
ktg-mes/src/main/resources/mapper/tm/TmToolTypeMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.tm.mapper.TmToolTypeMapper">
-    
+
     <resultMap type="TmToolType" id="TmToolTypeResult">
         <result property="toolTypeId"    column="tool_type_id"    />
         <result property="toolTypeCode"    column="tool_type_code"    />
@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectTmToolTypeList" parameterType="TmToolType" resultMap="TmToolTypeResult">
         <include refid="selectTmToolTypeVo"/>
-        <where>  
+        <where>
             <if test="toolTypeCode != null  and toolTypeCode != ''"> and tool_type_code = #{toolTypeCode}</if>
             <if test="toolTypeName != null  and toolTypeName != ''"> and tool_type_name like concat('%', #{toolTypeName}, '%')</if>
             <if test="codeFlag != null  and codeFlag != ''"> and code_flag = #{codeFlag}</if>
@@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maintenPeriod != null "> and mainten_period = #{maintenPeriod}</if>
         </where>
     </select>
-    
+
     <select id="selectTmToolTypeByToolTypeId" parameterType="Long" resultMap="TmToolTypeResult">
         <include refid="selectTmToolTypeVo"/>
         where tool_type_id = #{toolTypeId}
@@ -44,12 +44,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkToolTypeCodeUnique" parameterType="TmToolType" resultMap="TmToolTypeResult">
         <include refid="selectTmToolTypeVo"/>
-        where tool_type_code = #{toolTypeCode} limit 1
+        where tool_type_code = #{toolTypeCode} offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkToolTypeNameUnique" parameterType="TmToolType" resultMap="TmToolTypeResult">
         <include refid="selectTmToolTypeVo"/>
-        where tool_type_name = #{toolTypeName} limit 1
+        where tool_type_name = #{toolTypeName} offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertTmToolType" parameterType="TmToolType" useGeneratedKeys="true" keyProperty="toolTypeId">
@@ -114,9 +114,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteTmToolTypeByToolTypeIds" parameterType="String">
-        delete from tm_tool_type where tool_type_id in 
+        delete from tm_tool_type where tool_type_id in
         <foreach item="toolTypeId" collection="array" open="(" separator="," close=")">
             #{toolTypeId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 7 - 7
ktg-mes/src/main/resources/mapper/wm/WmIssueHeaderMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.wm.mapper.WmIssueHeaderMapper">
-    
+
     <resultMap type="WmIssueHeader" id="WmIssueHeaderResult">
         <result property="issueId"    column="issue_id"    />
         <result property="issueCode"    column="issue_code"    />
@@ -81,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectWmIssueHeaderList" parameterType="WmIssueHeader" resultMap="WmIssueHeaderResult">
         <include refid="selectWmIssueHeaderVo"/>
-        <where>  
+        <where>
             <if test="issueCode != null  and issueCode != ''"> and issue_code = #{issueCode}</if>
             <if test="issueName != null  and issueName != ''"> and issue_name like concat('%', #{issueName}, '%')</if>
             <if test="workstationId != null "> and workstation_id = #{workstationId}</if>
@@ -109,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         order by create_time desc
     </select>
-    
+
     <select id="selectWmIssueHeaderByIssueId" parameterType="Long" resultMap="WmIssueHeaderResult">
         <include refid="selectWmIssueHeaderVo"/>
         where issue_id = #{issueId}
@@ -117,7 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkIssueCodeUnique" parameterType="WmIssueHeader" resultMap="WmIssueHeaderResult">
         <include refid="selectWmIssueHeaderVo"/>
-        where issue_code = #{issueCode} limit 1
+        where issue_code = #{issueCode} offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="getTxBeans" parameterType="Long" resultMap="IssueTxBeanResult">
@@ -131,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                            ON ir.issue_id = irl.`issue_id`
         WHERE ir.`issue_id` = #{issueId}
     </select>
-        
+
     <insert id="insertWmIssueHeader" parameterType="WmIssueHeader" useGeneratedKeys="true" keyProperty="issueId">
         insert into wm_issue_header
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -251,9 +251,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteWmIssueHeaderByIssueIds" parameterType="String">
-        delete from wm_issue_header where issue_id in 
+        delete from wm_issue_header where issue_id in
         <foreach item="issueId" collection="array" open="(" separator="," close=")">
             #{issueId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 6 - 6
ktg-mes/src/main/resources/mapper/wm/WmMaterialStockMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.wm.mapper.WmMaterialStockMapper">
-    
+
     <resultMap type="WmMaterialStock" id="WmMaterialStockResult">
         <result property="materialStockId"    column="material_stock_id"    />
         <result property="itemTypeId"    column="item_type_id"    />
@@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectWmMaterialStockList" parameterType="WmMaterialStock" resultMap="WmMaterialStockResult">
         <include refid="selectWmMaterialStockVo"/>
-        <where>  
+        <where>
             <if test="itemTypeId != null "> AND (item_type_id = #{itemTypeId} OR item_type_id in (select item_type_id from md_item_type where find_in_set(#{itemTypeId},ancestors)))</if>
             <if test="itemId != null "> and item_id = #{itemId}</if>
             <if test="itemCode != null  and itemCode != ''"> and item_code = #{itemCode}</if>
@@ -122,7 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             order by recpt_date asc
         </where>
     </select>
-    
+
     <select id="selectWmMaterialStockByMaterialStockId" parameterType="Long" resultMap="WmMaterialStockResult">
         <include refid="selectWmMaterialStockVo"/>
         where material_stock_id = #{materialStockId}
@@ -142,7 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="workorderId !=null">and workorder_id = #{workorderId}</if>
             <if test="workorderCode !=null">and workorder_code = #{workorderCode}</if>
         </where>
-        and 1=1 limit 1
+        and 1=1 offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertWmMaterialStock" parameterType="WmMaterialStock" useGeneratedKeys="true" keyProperty="materialStockId">
@@ -270,9 +270,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteWmMaterialStockByMaterialStockIds" parameterType="String">
-        delete from wm_material_stock where material_stock_id in 
+        delete from wm_material_stock where material_stock_id in
         <foreach item="materialStockId" collection="array" open="(" separator="," close=")">
             #{materialStockId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 16 - 16
ktg-mes/src/main/resources/mapper/wm/WmStockTakingResultMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.wm.mapper.WmStockTakingResultMapper">
-    
+
     <resultMap type="WmStockTakingResult" id="WmStockTakingResultResult">
         <result property="resultId"    column="result_id"    />
         <result property="takingId"    column="taking_id"    />
@@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectWmStockTakingResultList" parameterType="WmStockTakingResult" resultMap="WmStockTakingResultResult">
         <include refid="selectWmStockTakingResultVo"/>
-        <where>  
+        <where>
             <if test="takingId != null "> and taking_id = #{takingId}</if>
             <if test="itemId != null "> and item_id = #{itemId}</if>
             <if test="itemCode != null  and itemCode != ''"> and item_code = #{itemCode}</if>
@@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="takingStatus != null  and takingStatus != ''"> and taking_status = #{takingStatus}</if>
         </where>
     </select>
-    
+
     <select id="selectWmStockTakingResultByResultId" parameterType="Long" resultMap="WmStockTakingResultResult">
         <include refid="selectWmStockTakingResultVo"/>
         where result_id = #{resultId}
@@ -55,8 +55,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <insert id="calculateOpenWmStockTakingResult" parameterType="Long" useGeneratedKeys="true">
         insert into wm_stock_taking_result (taking_id,item_id,item_code,item_name,specification,taking_quantity,quantity,taking_status)
         select sl.taking_id,sl.item_id,sl.item_code,sl.item_name,sl.specification,taking_quantity,quantity,
-               case when IFNULL(taking_quantity,0) &gt; IFNULL(quantity,0) then 'PROFIT'
-                    when   IFNULL(taking_quantity,0) &lt; IFNULL(quantity,0) then 'LOSS'
+               case when ISNULL(taking_quantity,0) &gt; ISNULL(quantity,0) then 'PROFIT'
+                    when   ISNULL(taking_quantity,0) &lt; ISNULL(quantity,0) then 'LOSS'
                     else 'NORMAL' end as taking_status
         from wm_stock_taking_line sl
         where sl.taking_id =  #{takingId}
@@ -64,10 +64,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <insert id="calculateWmStockTakingResult" parameterType="Long" useGeneratedKeys="true">
         insert into wm_stock_taking_result (item_id,item_code,item_name,specification,taking_quantity,quantity,taking_status)
-        select IFNULL(m.item_id,t.item_id) as item_id, IFNULL(m.item_code,t.item_code) as item_code,IFNULL(m.item_name,t.item_name) as item_name,IFNULL(m.specification,t.specification) as specification,
-               IFNULL(t.taking_quantity,0) as taking_quantity,IFNULL(m.onhand,0) as quantity,
-               case when IFNULL(t.taking_quantity,0) &gt; IFNULL(m.onhand,0) then 'PROFIT'
-                    when   IFNULL(t.taking_quantity,0) &lt; IFNULL(m.onhand,0) then 'LOSS'
+        select ISNULL(m.item_id,t.item_id) as item_id, ISNULL(m.item_code,t.item_code) as item_code,ISNULL(m.item_name,t.item_name) as item_name,ISNULL(m.specification,t.specification) as specification,
+               ISNULL(t.taking_quantity,0) as taking_quantity,ISNULL(m.onhand,0) as quantity,
+               case when ISNULL(t.taking_quantity,0) &gt; ISNULL(m.onhand,0) then 'PROFIT'
+                    when   ISNULL(t.taking_quantity,0) &lt; ISNULL(m.onhand,0) then 'LOSS'
                     else 'NORMAL' end as taking_status
         from (
                  select sl.item_id,sl.item_code,sl.item_name,sl.specification,sum(sl.taking_quantity) as taking_quantity
@@ -91,10 +91,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
         union
 
-        select IFNULL(t.item_id,m.item_id) as item_id,IFNULL(t.item_code,m.item_code) as item_code,IFNULL(t.item_name,m.item_name) as item_name,IFNULL(t.specification,m.specification) as specification,
-               IFNULL(t.taking_quantity,0) as taking_quantity,IFNULL(m.onhand,0) as quantity,
-               case when IFNULL(t.taking_quantity,0) &gt; IFNULL(m.onhand,0) then 'PROFIT'
-                    when   IFNULL(t.taking_quantity,0) &lt; IFNULL(m.onhand,0) then 'LOSS'
+        select ISNULL(t.item_id,m.item_id) as item_id,ISNULL(t.item_code,m.item_code) as item_code,ISNULL(t.item_name,m.item_name) as item_name,ISNULL(t.specification,m.specification) as specification,
+               ISNULL(t.taking_quantity,0) as taking_quantity,ISNULL(m.onhand,0) as quantity,
+               case when ISNULL(t.taking_quantity,0) &gt; ISNULL(m.onhand,0) then 'PROFIT'
+                    when   ISNULL(t.taking_quantity,0) &lt; ISNULL(m.onhand,0) then 'LOSS'
                     else 'NORMAL' end as taking_status
         from (
                  select ms.item_id,ms.item_code,ms.item_name,ms.specification,sum(ms.quantity_onhand) as onhand
@@ -116,7 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                                and t.item_code = m.item_code
         where m.onhand !=0
     </insert>
-        
+
     <insert id="insertWmStockTakingResult" parameterType="WmStockTakingResult" useGeneratedKeys="true" keyProperty="resultId">
         insert into wm_stock_taking_result
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -194,7 +194,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteWmStockTakingResultByResultIds" parameterType="String">
-        delete from wm_stock_taking_result where result_id in 
+        delete from wm_stock_taking_result where result_id in
         <foreach item="resultId" collection="array" open="(" separator="," close=")">
             #{resultId}
         </foreach>
@@ -203,4 +203,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <delete id="deleteWmStockTakingResultByTakingId" parameterType="Long">
         delete from wm_stock_taking_result where taking_id = #{takingId}
     </delete>
-</mapper>
+</mapper>

+ 8 - 8
ktg-mes/src/main/resources/mapper/wm/WmStorageLocationMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.wm.mapper.WmStorageLocationMapper">
-    
+
     <resultMap type="WmStorageLocation" id="WmStorageLocationResult">
         <result property="locationId"    column="location_id"    />
         <result property="locationCode"    column="location_code"    />
@@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectWmStorageLocationList" parameterType="WmStorageLocation" resultMap="WmStorageLocationResult">
         <include refid="selectWmStorageLocationVo"/>
-        <where>  
+        <where>
             <if test="locationCode != null  and locationCode != ''"> and location_code = #{locationCode}</if>
             <if test="locationName != null  and locationName != ''"> and location_name like concat('%', #{locationName}, '%')</if>
             <if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
@@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="areaFlag != null  and areaFlag != ''"> and area_flag = #{areaFlag}</if>
         </where>
     </select>
-    
+
     <select id="selectWmStorageLocationByLocationId" parameterType="Long" resultMap="WmStorageLocationResult">
         <include refid="selectWmStorageLocationVo"/>
         where location_id = #{locationId}
@@ -45,17 +45,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectWmStorageLocationByLocationCode" parameterType="String" resultMap="WmStorageLocationResult">
         <include refid="selectWmStorageLocationVo"/>
-        where location_code = #{locationCode} limit 1
+        where location_code = #{locationCode} offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkLocationCodeUnique" parameterType="WmStorageLocation" resultMap="WmStorageLocationResult">
         <include refid="selectWmStorageLocationVo"/>
-        where location_code = #{locationCode} and warehouse_id = #{warehouseId} limit 1
+        where location_code = #{locationCode} and warehouse_id = #{warehouseId} offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkLocationNameUnique" parameterType="WmStorageLocation" resultMap="WmStorageLocationResult">
         <include refid="selectWmStorageLocationVo"/>
-        where location_name = #{locationName} and warehouse_id = #{warehouseId} limit 1
+        where location_name = #{locationName} and warehouse_id = #{warehouseId} offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertWmStorageLocation" parameterType="WmStorageLocation" useGeneratedKeys="true" keyProperty="locationId">
@@ -123,7 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteWmStorageLocationByLocationIds" parameterType="String">
-        delete from wm_storage_location where location_id in 
+        delete from wm_storage_location where location_id in
         <foreach item="locationId" collection="array" open="(" separator="," close=")">
             #{locationId}
         </foreach>
@@ -132,4 +132,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <delete id="deleteByWarehouseId" parameterType="Long">
         delete from wm_storage_location where warehouse_id = #{warehouseId}
     </delete>
-</mapper>
+</mapper>

+ 8 - 8
ktg-mes/src/main/resources/mapper/wm/WmWarehouseMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ktg.mes.wm.mapper.WmWarehouseMapper">
-    
+
     <resultMap type="WmWarehouse" id="WmWarehouseResult">
         <id property="warehouseId"    column="warehouse_id"    />
         <result property="warehouseCode"    column="warehouse_code"    />
@@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectWmWarehouseList" parameterType="WmWarehouse" resultMap="WmWarehouseResult">
         <include refid="selectWmWarehouseVo"/>
-        <where>  
+        <where>
             <if test="warehouseCode != null  and warehouseCode != ''"> and warehouse_code = #{warehouseCode}</if>
             <if test="warehouseName != null  and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
             <if test="location != null  and location != ''"> and location = #{location}</if>
@@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           LEFT JOIN wm_storage_location l ON w.warehouse_id = l.warehouse_id
           LEFT JOIN wm_storage_area a ON l.location_id = a.location_id AND a.enable_flag = 'Y'
     </select>
-    
+
     <select id="selectWmWarehouseByWarehouseId" parameterType="Long" resultMap="WmWarehouseResult">
         <include refid="selectWmWarehouseVo"/>
         where warehouse_id = #{warehouseId}
@@ -78,17 +78,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectWmWarehouseByWarehouseCode" parameterType="String" resultMap="WmWarehouseResult">
         <include refid="selectWmWarehouseVo"/>
-        where warehouse_code = #{warehouseCode} limit 1
+        where warehouse_code = #{warehouseCode} offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkWarehouseCodeUnique" parameterType="WmWarehouse" resultMap="WmWarehouseResult">
         <include refid="selectWmWarehouseVo"/>
-        where warehouse_code = #{warehouseCode} limit 1
+        where warehouse_code = #{warehouseCode} offset 0 rows fetch next 1 rows only
     </select>
 
     <select id="checkWarehouseNameUnique" parameterType="WmWarehouse" resultMap="WmWarehouseResult">
         <include refid="selectWmWarehouseVo"/>
-        where warehouse_name = #{warehouseName} limit 1
+        where warehouse_name = #{warehouseName} offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertWmWarehouse" parameterType="WmWarehouse" useGeneratedKeys="true" keyProperty="warehouseId">
@@ -156,9 +156,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteWmWarehouseByWarehouseIds" parameterType="String">
-        delete from wm_warehouse where warehouse_id in 
+        delete from wm_warehouse where warehouse_id in
         <foreach item="warehouseId" collection="array" open="(" separator="," close=")">
             #{warehouseId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 1 - 1
ktg-system/src/main/resources/mapper/system/SysConfigMapper.xml

@@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
         <include refid="selectConfigVo"/>
-        where config_key = #{configKey} limit 1
+        where config_key = #{configKey} offset 0 rows fetch next 1 rows only
     </select>
 
     <insert id="insertConfig" parameterType="SysConfig">

+ 2 - 2
ktg-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<select id="hasChildByDeptId" parameterType="Long" resultType="int">
 		select count(1) from sys_dept
-		where del_flag = '0' and parent_id = #{deptId} limit 1
+		where del_flag = '0' and parent_id = #{deptId} offset 0 rows fetch next 1 rows only
 	</select>
 
 	<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
@@ -82,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<select id="checkDeptNameUnique" resultMap="SysDeptResult">
 	    <include refid="selectDeptVo"/>
-		where dept_name=#{deptName} and parent_id = #{parentId} limit 1
+		where dept_name=#{deptName} and parent_id = #{parentId} offset 0 rows fetch next 1 rows only
 	</select>
 
     <insert id="insertDept" parameterType="SysDept">

+ 1 - 1
ktg-system/src/main/resources/mapper/system/SysDictTypeMapper.xml

@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
 		<include refid="selectDictTypeVo"/>
-		where dict_type = #{dictType} limit 1
+		where dict_type = #{dictType} offset 0 rows fetch next 1 rows only
 	</select>
 
 	<delete id="deleteDictTypeById" parameterType="Long">

+ 2 - 2
ktg-system/src/main/resources/mapper/system/SysMenuMapper.xml

@@ -28,7 +28,7 @@
 	</resultMap>
 
 	<sql id="selectMenuVo">
-        select menu_id, menu_name, parent_id, order_num, path, component, [query], is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
+        select menu_id, menu_name, parent_id, order_num, path, component, [query], is_frame, is_cache, menu_type, visible, status, ISNULL(perms,'') as perms, icon, create_time
 		from sys_menu
     </sql>
 
@@ -122,7 +122,7 @@
 
 	<select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult">
 		<include refid="selectMenuVo"/>
-		where menu_name=#{menuName} and parent_id = #{parentId} limit 1
+		where menu_name=#{menuName} and parent_id = #{parentId} offset 0 rows fetch next 1 rows only
 	</select>
 
 	<update id="updateMenu" parameterType="SysMenu">

+ 2 - 2
ktg-system/src/main/resources/mapper/system/SysPostMapper.xml

@@ -64,12 +64,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
 		<include refid="selectPostVo"/>
-		 where post_name=#{postName} limit 1
+		 where post_name=#{postName} offset 0 rows fetch next 1 rows only
 	</select>
 
 	<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
 		<include refid="selectPostVo"/>
-		 where post_code=#{postCode} limit 1
+		 where post_code=#{postCode} offset 0 rows fetch next 1 rows only
 	</select>
 
 	<update id="updatePost" parameterType="SysPost">

+ 2 - 2
ktg-system/src/main/resources/mapper/system/SysRoleMapper.xml

@@ -86,12 +86,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
 		<include refid="selectRoleVo"/>
-		 where r.role_name=#{roleName} limit 1
+		 where r.role_name=#{roleName} order by r.role_id asc offset 0 rows fetch next 1 rows only
 	</select>
 
 	<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
 		<include refid="selectRoleVo"/>
-		 where r.role_key=#{roleKey} limit 1
+		 where r.role_key=#{roleKey} order by r.role_id asc offset 0 rows fetch next 1 rows only
 	</select>
 
  	<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">

+ 29 - 6
ktg-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -58,8 +58,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
 
     <select id="selectUserList" parameterType="SysUser" resultType="SysUser">
-		select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader,
-		max(uu.unit_id) as unit_id, max(t.unit_name) unit_name
+		<!-- select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status,
+		       u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, Rand(d.dept_name), Rand(d.leader),
+		max(uu.unit_id) as unit_id, max(t.unit_name) unit_name -->
+		select
+		u.user_id,
+		max(u.dept_id) AS dept_id,
+		max(u.nick_name) AS nick_name,
+		max(u.user_name) AS user_name,
+		max(u.email) AS email,
+		max(u.avatar) AS avatar,
+		max(u.phonenumber) AS phonenumber,
+		max(u.PASSWORD) AS PASSWORD,
+		max(u.sex) AS sex,
+		max(u.STATUS) AS STATUS,
+		max(u.del_flag) AS del_flag,
+		max(u.login_ip) AS login_ip,
+		max(u.login_date) AS login_date,
+		max(u.create_by) ascreate_by,
+		max(u.create_time) AS create_time,
+		max(u.remark) AS remark,
+		max(d.dept_name) AS dept_name,
+		max(d.leader) AS leader,
+		max(uu.unit_id) AS unit_id,
+		max(t.unit_name) unit_name
 		from sys_user u
 		left join sys_dept d on u.dept_id = d.dept_id
 		left join is_user_unit uu on uu.user_id = u.user_id
@@ -157,15 +179,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 
 	<select id="checkUserNameUnique" parameterType="String" resultType="int">
-		select count(1) from sys_user where user_name = #{userName} limit 1
+		select TOP 1 count(1) from sys_user where user_name = #{userName}
 	</select>
 
 	<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
-		select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
+		select TOP 1 user_id, phonenumber from sys_user where phonenumber = #{phonenumber}
 	</select>
 
 	<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
-		select user_id, email from sys_user where email = #{email} limit 1
+		select TOP 1 user_id, email from sys_user where email = #{email}
 	</select>
 
 	<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
@@ -252,7 +274,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		select u.workstation_id from is_user_workstation u where u.user_id = #{userId}
 	</select>
 	<select id="getChildWorkstations" resultType="java.lang.Long">
-		SELECT workstation_id FROM is_workstation WHERE workstation_id = #{userWorkstationId} or find_in_set( #{userWorkstationId} , ancestors )
+		SELECT workstation_id FROM is_workstation WHERE workstation_id = #{userWorkstationId} OR EXISTS (SELECT 1 FROM STRING_SPLIT(ancestors, ',') WHERE value = #{userWorkstationId})
+
 	</select>
     <select id="getUserBlackList" resultType="com.ktg.system.domain.vo.UserBlackVo">
 		select * from is_blacklist where user_id = #{userId}

+ 1 - 1
ktg-system/src/main/resources/mapper/system/SysUserRoleMapper.xml

@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</delete>
 
 	<select id="getUserRoleName" resultType="java.lang.String">
-		select GROUP_CONCAT(r.role_name SEPARATOR ', ') AS role_name
+		select STRING_AGG(r.role_name, ', ') AS role_name
 		from sys_user_role u
 		left join sys_role r on u.role_id = r.role_id
 		where u.user_id = #{userId}

+ 1 - 1
pom.xml

@@ -23,7 +23,7 @@
         <swagger.version>3.0.0</swagger.version>
         <kaptcha.version>2.3.2</kaptcha.version>
         <mybatis-spring-boot.version>2.2.2</mybatis-spring-boot.version>
-        <pagehelper.boot.version>1.4.1</pagehelper.boot.version>
+        <pagehelper.boot.version>1.4.6</pagehelper.boot.version>
         <fastjson.version>1.2.80</fastjson.version>
         <oshi.version>6.1.2</oshi.version>
         <jna.version>5.10.0</jna.version>