chenshudong недель назад: 4
Родитель
Сommit
3bd9ad2082

+ 1 - 1
airport-admin/src/main/java/com/sundot/airport/web/controller/equipment/EquipmentLedgerController.java

@@ -96,7 +96,7 @@ public class EquipmentLedgerController extends BaseController {
96
     @PutMapping
96
     @PutMapping
97
     public AjaxResult edit(@RequestBody EquipmentLedger equipmentLedger) {
97
     public AjaxResult edit(@RequestBody EquipmentLedger equipmentLedger) {
98
         equipmentLedger.setUpdateBy(getUsername());
98
         equipmentLedger.setUpdateBy(getUsername());
99
-        return toAjax(equipmentLedgerService.updateEquipmentLedger(equipmentLedger));
99
+        return toAjax(equipmentLedgerService.updateEquipmentLedger(equipmentLedger, true));
100
     }
100
     }
101
 
101
 
102
     /**
102
     /**

+ 8 - 0
airport-equipment/src/main/java/com/sundot/airport/equipment/mapper/EquipmentLedgerMapper.java

@@ -45,6 +45,14 @@ public interface EquipmentLedgerMapper extends BaseMapper<EquipmentLedger> {
45
     public int updateEquipmentLedger(EquipmentLedger equipmentLedger);
45
     public int updateEquipmentLedger(EquipmentLedger equipmentLedger);
46
 
46
 
47
     /**
47
     /**
48
+     * 修改设备台账-允许置空
49
+     *
50
+     * @param equipmentLedger 设备台账
51
+     * @return 结果
52
+     */
53
+    public int updateEquipmentLedgerAndNull(EquipmentLedger equipmentLedger);
54
+
55
+    /**
48
      * 删除设备台账
56
      * 删除设备台账
49
      *
57
      *
50
      * @param id 设备台账主键
58
      * @param id 设备台账主键

+ 1 - 1
airport-equipment/src/main/java/com/sundot/airport/equipment/service/IEquipmentLedgerService.java

@@ -42,7 +42,7 @@ public interface IEquipmentLedgerService extends IService<EquipmentLedger> {
42
      * @param equipmentLedger 设备台账
42
      * @param equipmentLedger 设备台账
43
      * @return 结果
43
      * @return 结果
44
      */
44
      */
45
-    public int updateEquipmentLedger(EquipmentLedger equipmentLedger);
45
+    public int updateEquipmentLedger(EquipmentLedger equipmentLedger, boolean allowNull);
46
 
46
 
47
     /**
47
     /**
48
      * 批量删除设备台账
48
      * 批量删除设备台账

+ 7 - 2
airport-equipment/src/main/java/com/sundot/airport/equipment/service/impl/EquipmentLedgerServiceImpl.java

@@ -160,9 +160,14 @@ public class EquipmentLedgerServiceImpl extends ServiceImpl<EquipmentLedgerMappe
160
      */
160
      */
161
     @Transactional(rollbackFor = Exception.class)
161
     @Transactional(rollbackFor = Exception.class)
162
     @Override
162
     @Override
163
-    public int updateEquipmentLedger(EquipmentLedger equipmentLedger) {
163
+    public int updateEquipmentLedger(EquipmentLedger equipmentLedger, boolean allowNull) {
164
         equipmentLedger.setUpdateTime(DateUtils.getNowDate());
164
         equipmentLedger.setUpdateTime(DateUtils.getNowDate());
165
-        int result = equipmentLedgerMapper.updateEquipmentLedger(equipmentLedger);
165
+        int result;
166
+        if (allowNull) {
167
+            result = equipmentLedgerMapper.updateEquipmentLedgerAndNull(equipmentLedger);
168
+        } else {
169
+            result = equipmentLedgerMapper.updateEquipmentLedger(equipmentLedger);
170
+        }
166
         // 删除旧数据
171
         // 删除旧数据
167
         LambdaQueryWrapper<EquipmentInspectionRecord> recordOldQueryWrapper = new LambdaQueryWrapper<>();
172
         LambdaQueryWrapper<EquipmentInspectionRecord> recordOldQueryWrapper = new LambdaQueryWrapper<>();
168
         recordOldQueryWrapper.eq(EquipmentInspectionRecord::getSourceId, equipmentLedger.getId());
173
         recordOldQueryWrapper.eq(EquipmentInspectionRecord::getSourceId, equipmentLedger.getId());

+ 46 - 0
airport-equipment/src/main/resources/mapper/equipment/EquipmentLedgerMapper.xml

@@ -346,6 +346,52 @@
346
         where id = #{id}
346
         where id = #{id}
347
     </update>
347
     </update>
348
 
348
 
349
+    <update id="updateEquipmentLedgerAndNull" parameterType="EquipmentLedger">
350
+        update equipment_ledger
351
+        <trim prefix="SET" suffixOverrides=",">
352
+            tenant_id = #{tenantId},
353
+            revision = #{revision},
354
+            create_by = #{createBy},
355
+            create_time = #{createTime},
356
+            update_by = #{updateBy},
357
+            update_time = #{updateTime},
358
+            remark = #{remark},
359
+            <if test="equipmentCode != null and equipmentCode != ''">equipment_code = #{equipmentCode},</if>
360
+            <if test="equipmentName != null and equipmentName != ''">equipment_name = #{equipmentName},</if>
361
+            equipment_type = #{equipmentType},
362
+            equipment_category = #{equipmentCategory},
363
+            equipment_brand = #{equipmentBrand},
364
+            equipment_model = #{equipmentModel},
365
+            <if test="equipmentSerialNumber != null and equipmentSerialNumber != ''">
366
+                equipment_serial_number = #{equipmentSerialNumber},
367
+            </if>
368
+            manufacturer = #{manufacturer},
369
+            manufacturing_date = #{manufacturingDate},
370
+            acceptance_date = #{acceptanceDate},
371
+            commissioning_date = #{commissioningDate},
372
+            initial_acceptance_status = #{initialAcceptanceStatus},
373
+            usage_status = #{usageStatus},
374
+            scrapping_date = #{scrappingDate},
375
+            installation_location = #{installationLocation},
376
+            terminl_code = #{terminlCode},
377
+            terminl_name = #{terminlName},
378
+            regional_code = #{regionalCode},
379
+            regional_name = #{regionalName},
380
+            channel_code = #{channelCode},
381
+            channel_name = #{channelName},
382
+            inspection_self_check_date = #{inspectionSelfCheckDate},
383
+            inspection_self_check_cycle = #{inspectionSelfCheckCycle},
384
+            next_inspection_due_date = #{nextInspectionDueDate},
385
+            inspection_team_leader_id = #{inspectionTeamLeaderId},
386
+            inspection_team_leader_name = #{inspectionTeamLeaderName},
387
+            inspection_team_member1_id = #{inspectionTeamMember1Id},
388
+            inspection_team_member1_name = #{inspectionTeamMember1Name},
389
+            inspection_team_member2_id = #{inspectionTeamMember2Id},
390
+            inspection_team_member2_name = #{inspectionTeamMember2Name}
391
+        </trim>
392
+        where id = #{id}
393
+    </update>
394
+
349
     <delete id="deleteEquipmentLedgerById" parameterType="Long">
395
     <delete id="deleteEquipmentLedgerById" parameterType="Long">
350
         delete
396
         delete
351
         from equipment_ledger
397
         from equipment_ledger