guarantee-lsq 2 жил өмнө
parent
commit
3568b8e005

+ 2 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/sb/SbChangeRecordVO.java

@@ -92,5 +92,7 @@ public class SbChangeRecordVO extends BaseVO implements Serializable {
      */
     private Integer changeType;
 
+    private String sbName;
+
 
 }

+ 55 - 55
platform-dao/src/main/resources/mapper/sb/SbChangeRecordMapper.xml

@@ -2,120 +2,120 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.platform.dao.mapper.sb.SbChangeRecordMapper">
     <sql id="Base_Column_List">
-                             change.id,
-                                     change.created_user_id,
-                                     change.created_user_name,
-                                     change.update_user_id,
-                                     change.update_user_name,
-                                     change.sb_id,
-                                     change.content,
-                                     change.old_position_id,
-                                     change.position_id,
-                                     change.sb_no_id,
-                                     change.old_parent_id,
-                                     change.parent_id,
-                                     change.created_time,
-                                     change.update_time,
-                                     change.start_time,
-                                     change.end_time,
-                                     change.change_type
+                             sbChange.id,
+                                     sbChange.created_user_id,
+                                     sbChange.created_user_name,
+                                     sbChange.update_user_id,
+                                     sbChange.update_user_name,
+                                     sbChange.sb_id,
+                                     sbChange.content,
+                                     sbChange.old_position_id,
+                                     sbChange.position_id,
+                                     sbChange.sb_no_id,
+                                     sbChange.old_parent_id,
+                                     sbChange.parent_id,
+                                     sbChange.created_time,
+                                     sbChange.update_time,
+                                     sbChange.start_time,
+                                     sbChange.end_time,
+                                     sbChange.change_type
                         </sql>
     <sql id="Ref_Column_List">
-                                                                                                                                                                                                                                                         change.sb_id,
-                                     change.content,
-                                     change.old_position_id,
-                                     change.position_id,
-                                     change.sb_no_id,
-                                     change.old_parent_id,
-                                     change.parent_id,
-                                                                                                                             change.start_time,
-                                     change.end_time,
-                                     change.change_type
+                                                                                                                                                                                                                                                         sbChange.sb_id,
+                                     sbChange.content,
+                                     sbChange.old_position_id,
+                                     sbChange.position_id,
+                                     sbChange.sb_no_id,
+                                     sbChange.old_parent_id,
+                                     sbChange.parent_id,
+                                                                                                                             sbChange.start_time,
+                                     sbChange.end_time,
+                                     sbChange.change_type
                                 </sql>
     <sql id="List_Condition">
         <if test="id != null and id != ''">
-            and change.id = #{id}
+            and sbChange.id = #{id}
         </if>
         <if test="createdUserId != null and createdUserId != ''">
-            and change.created_user_id = #{createdUserId}
+            and sbChange.created_user_id = #{createdUserId}
         </if>
         <if test="createdUserName != null and createdUserName != ''">
-            and change.created_user_name = #{createdUserName}
+            and sbChange.created_user_name = #{createdUserName}
         </if>
         <if test="updateUserId != null and updateUserId != ''">
-            and change.update_user_id = #{updateUserId}
+            and sbChange.update_user_id = #{updateUserId}
         </if>
         <if test="updateUserName != null and updateUserName != ''">
-            and change.update_user_name = #{updateUserName}
+            and sbChange.update_user_name = #{updateUserName}
         </if>
         <if test="sbId != null and sbId != ''">
-            and change.sb_id = #{sbId}
+            and sbChange.sb_id = #{sbId}
         </if>
         <if test="content != null and content != ''">
-            and change.content = #{content}
+            and sbChange.content = #{content}
         </if>
         <if test="oldPositionId != null and oldPositionId != ''">
-            and change.old_position_id = #{oldPositionId}
+            and sbChange.old_position_id = #{oldPositionId}
         </if>
         <if test="positionId != null and positionId != ''">
-            and change.position_id = #{positionId}
+            and sbChange.position_id = #{positionId}
         </if>
         <if test="sbNoId != null and sbNoId != ''">
-            and change.sb_no_id = #{sbNoId}
+            and sbChange.sb_no_id = #{sbNoId}
         </if>
         <if test="oldParentId != null and oldParentId != ''">
-            and change.old_parent_id = #{oldParentId}
+            and sbChange.old_parent_id = #{oldParentId}
         </if>
         <if test="parentId != null and parentId != ''">
-            and change.parent_id = #{parentId}
+            and sbChange.parent_id = #{parentId}
         </if>
         <if test="createdTimeStart != null">
-            and change.created_time <![CDATA[>=]]>; #{createdTimeStart}
+            and sbChange.created_time <![CDATA[>=]]>; #{createdTimeStart}
         </if>
         <if test="createdTimeEnd != null">
-            and change.created_time <![CDATA[<=]]> #{createdTimeEnd}
+            and sbChange.created_time <![CDATA[<=]]> #{createdTimeEnd}
         </if>
         <if test="createdTime != null">
-            and change.created_time = #{createdTime}
+            and sbChange.created_time = #{createdTime}
         </if>
         <if test="updateTimeStart != null">
-            and change.update_time <![CDATA[>=]]>; #{updateTimeStart}
+            and sbChange.update_time <![CDATA[>=]]>; #{updateTimeStart}
         </if>
         <if test="updateTimeEnd != null">
-            and change.update_time <![CDATA[<=]]> #{updateTimeEnd}
+            and sbChange.update_time <![CDATA[<=]]> #{updateTimeEnd}
         </if>
         <if test="updateTime != null">
-            and change.update_time = #{updateTime}
+            and sbChange.update_time = #{updateTime}
         </if>
         <if test="startTimeStart != null">
-            and change.start_time <![CDATA[>=]]>; #{startTimeStart}
+            and sbChange.start_time <![CDATA[>=]]>; #{startTimeStart}
         </if>
         <if test="startTimeEnd != null">
-            and change.start_time <![CDATA[<=]]> #{startTimeEnd}
+            and sbChange.start_time <![CDATA[<=]]> #{startTimeEnd}
         </if>
         <if test="startTime != null">
-            and change.start_time = #{startTime}
+            and sbChange.start_time = #{startTime}
         </if>
         <if test="endTimeStart != null">
-            and change.end_time <![CDATA[>=]]>; #{endTimeStart}
+            and sbChange.end_time <![CDATA[>=]]>; #{endTimeStart}
         </if>
         <if test="endTimeEnd != null">
-            and change.end_time <![CDATA[<=]]> #{endTimeEnd}
+            and sbChange.end_time <![CDATA[<=]]> #{endTimeEnd}
         </if>
         <if test="endTime != null">
-            and change.end_time = #{endTime}
+            and sbChange.end_time = #{endTime}
         </if>
         <if test="changeType != null">
-            and change.change_type = #{changeType}
+            and sbChange.change_type = #{changeType}
         </if>
         <if test="keyword != null and keyword != ''">
-            and change.id like concat(concat('%',#{keyword}),'%')
+            and sbChange.id like concat(concat('%',#{keyword}),'%')
         </if>
     </sql>
     <select id="selectList" parameterType="com.platform.dao.dto.sb.SbChangeRecordDTO"
             resultType="com.platform.dao.vo.query.sb.SbChangeRecordVO">
-        select change.*
-        from t_sb_change_record as change
+        select sbChange.*,sb.name as sbName
+        from t_sb_change_record as sbChange left join t_sb_info sb on sbChange.sb_id = sb.id
         <where>
             <include refid="List_Condition"/>
         </where>

+ 12 - 10
platform-service/src/main/java/com/platform/service/sb/impl/SbMeasureLogServiceImpl.java

@@ -168,7 +168,6 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
         sbInfo.setMeasureStatus(YesNoEnum.NO.getValue());// 每次检定后, 检定状态改为正常
         sbInfo.setCheckPeriod(model.getCheckPeriod()); // 检定周期
         // 设备位置变动
-        StringBuilder remark = new StringBuilder();
         boolean insertAllocate = Boolean.FALSE; // 设备位置
         boolean insertParent = Boolean.FALSE; // 父设备
         boolean insertNo = Boolean.FALSE; // 设备位号
@@ -178,25 +177,28 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
         String parentId = getPureString(model.getSbParentId());
         String oldSbPositionNo = getPureString(sbInfo.getPositionNo()); // 设备位号
         String positionNo = getPureString(model.getSbPositionNo());
+        StringBuilder remark1 = new StringBuilder();
+        StringBuilder remark2 = new StringBuilder();
+        StringBuilder remark3 = new StringBuilder();
         if(!oldPositionId.equals(positionId)){
             insertAllocate = Boolean.TRUE;
             sbInfo.setPositionId(positionId);
             String before = oldPositionId == "" ? oldPositionId : sbPositionMapper.selectNameById(oldPositionId);
-            remark.append("设备位置变动【" + before).append("】 ---> ");
+            remark1.append("设备位置变动【" + before).append("】 ---> ");
             String after = positionId == "" ? positionId : sbPositionMapper.selectNameById(positionId);
-            remark.append("【" + after + "】");
+            remark1.append("【" + after + "】");
         }
         if(!oldParentId.equals(parentId)){
             insertParent = Boolean.TRUE;
             sbInfo.setParentId(parentId);
-            remark.append("父设备变动【" + sbInfo.getName()).append("】 ---> ");
+            remark2.append("父设备变动【" + sbInfo.getName()).append("】 ---> ");
             String after = parentId == "" ? parentId : sbInfoMapper.selectNameById(parentId);
-            remark.append("【" + after + "】");
+            remark2.append("【" + after + "】");
         }
         if(!oldSbPositionNo.equals(positionNo)){
             insertNo = Boolean.TRUE;
-            remark.append("设备位号变动【"+sbInfo.getPositionNo()).append("】 ---> ");
-            remark.append("【"+positionNo+"】");
+            remark3.append("设备位号变动【"+sbInfo.getPositionNo()).append("】 ---> ");
+            remark3.append("【"+positionNo+"】");
             // 位号变动,父设备也有可能变动
             SbLocation location = new SbLocation();
             location.setNo(positionNo);
@@ -211,13 +213,13 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
         sysFileService.saveFile(model.getId(), SysFileTypeEnum.Sb_MEASURE_FILES.getValue(), model.getCheckFileList());
         // 写入调拨记录
         if(insertAllocate){
-            handleSbChangeRecord(remark.toString(),model,tempInfo,CommonConstants.CHANGE_TYPE_SB_POSITION);
+            handleSbChangeRecord(remark1.toString(),model,tempInfo,CommonConstants.CHANGE_TYPE_SB_POSITION);
         }
         if(insertParent){
-            handleSbChangeRecord(remark.toString(),model,tempInfo,CommonConstants.CHANGE_TYPE_SB_PARENT);
+            handleSbChangeRecord(remark2.toString(),model,tempInfo,CommonConstants.CHANGE_TYPE_SB_PARENT);
         }
         if(insertNo){
-            handleSbChangeRecord(remark.toString(),model,tempInfo,CommonConstants.CHANGE_TYPE_SB_NO);
+            handleSbChangeRecord(remark3.toString(),model,tempInfo,CommonConstants.CHANGE_TYPE_SB_NO);
         }
         sbInfoMapper.updateByPrimaryKey(sbInfo);
         return sbMeasureLog;