Parcourir la source

安全检查CRUD

Memory_LG il y a 11 mois
Parent
commit
d1826fa2a6
14 fichiers modifiés avec 371 ajouts et 287 suppressions
  1. 1 7
      src/main/java/com/sooka/sponest/data/housingconstruction/controller/CenterdataTHousingconstructionSafetyinspectionrecordsController.java
  2. 8 86
      src/main/java/com/sooka/sponest/data/housingconstruction/domain/CenterdataTHousingconstructionAttach.java
  3. 1 1
      src/main/java/com/sooka/sponest/data/housingconstruction/domain/CenterdataTHousingconstructionSafetyinspectionitem.java
  4. 20 80
      src/main/java/com/sooka/sponest/data/housingconstruction/domain/CenterdataTHousingconstructionSafetyinspectionrecords.java
  5. 24 62
      src/main/java/com/sooka/sponest/data/housingconstruction/domain/CenterdataTHousingconstructionSafetyinspectionrecordsdetail.java
  6. 2 0
      src/main/java/com/sooka/sponest/data/housingconstruction/mapper/CenterdataTHousingconstructionAttachMapper.java
  7. 8 0
      src/main/java/com/sooka/sponest/data/housingconstruction/mapper/CenterdataTHousingconstructionSafetyinspectionrecordsMapper.java
  8. 2 0
      src/main/java/com/sooka/sponest/data/housingconstruction/mapper/CenterdataTHousingconstructionSafetyinspectionrecordsdetailMapper.java
  9. 1 1
      src/main/java/com/sooka/sponest/data/housingconstruction/service/ICenterdataTHousingconstructionSafetyinspectionrecordsService.java
  10. 2 0
      src/main/java/com/sooka/sponest/data/housingconstruction/service/impl/CenterdataTHousingconstructionSafetyinspectionitemServiceImpl.java
  11. 163 18
      src/main/java/com/sooka/sponest/data/housingconstruction/service/impl/CenterdataTHousingconstructionSafetyinspectionrecordsServiceImpl.java
  12. 16 22
      src/main/resources/mapper/housingconstruction/CenterdataTHousingconstructionAttachMapper.xml
  13. 101 10
      src/main/resources/mapper/housingconstruction/CenterdataTHousingconstructionSafetyinspectionrecordsMapper.xml
  14. 22 0
      src/main/resources/mapper/housingconstruction/CenterdataTHousingconstructionSafetyinspectionrecordsdetailMapper.xml

+ 1 - 7
src/main/java/com/sooka/sponest/data/housingconstruction/controller/CenterdataTHousingconstructionSafetyinspectionrecordsController.java

@@ -30,7 +30,6 @@ public class CenterdataTHousingconstructionSafetyinspectionrecordsController ext
     /**
      * 查询住建-安全检查记录列表
      */
-    @RequiresPermissions("housingconstruction:safetyinspectionrecords:list")
     @GetMapping("/list")
     public TableDataInfo list(CenterdataTHousingconstructionSafetyinspectionrecords centerdataTHousingconstructionSafetyinspectionrecords) {
         startPage();
@@ -41,7 +40,6 @@ public class CenterdataTHousingconstructionSafetyinspectionrecordsController ext
     /**
      * 导出住建-安全检查记录列表
      */
-    @RequiresPermissions("housingconstruction:safetyinspectionrecords:export")
     @Log(title = "住建-安全检查记录", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, CenterdataTHousingconstructionSafetyinspectionrecords centerdataTHousingconstructionSafetyinspectionrecords) {
@@ -53,16 +51,14 @@ public class CenterdataTHousingconstructionSafetyinspectionrecordsController ext
     /**
      * 获取住建-安全检查记录详细信息
      */
-    @RequiresPermissions("housingconstruction:safetyinspectionrecords:query")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id) {
+    public AjaxResult getInfo(@PathVariable("id") String id) {
         return AjaxResult.success(centerdataTHousingconstructionSafetyinspectionrecordsService.selectCenterdataTHousingconstructionSafetyinspectionrecordsById(id));
     }
 
     /**
      * 新增住建-安全检查记录
      */
-    @RequiresPermissions("housingconstruction:safetyinspectionrecords:add")
     @Log(title = "住建-安全检查记录", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody CenterdataTHousingconstructionSafetyinspectionrecords centerdataTHousingconstructionSafetyinspectionrecords) {
@@ -72,7 +68,6 @@ public class CenterdataTHousingconstructionSafetyinspectionrecordsController ext
     /**
      * 修改住建-安全检查记录
      */
-    @RequiresPermissions("housingconstruction:safetyinspectionrecords:edit")
     @Log(title = "住建-安全检查记录", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody CenterdataTHousingconstructionSafetyinspectionrecords centerdataTHousingconstructionSafetyinspectionrecords) {
@@ -82,7 +77,6 @@ public class CenterdataTHousingconstructionSafetyinspectionrecordsController ext
     /**
      * 删除住建-安全检查记录
      */
-    @RequiresPermissions("housingconstruction:safetyinspectionrecords:remove")
     @Log(title = "住建-安全检查记录", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids) {

+ 8 - 86
src/main/java/com/sooka/sponest/data/housingconstruction/domain/CenterdataTHousingconstructionAttach.java

@@ -2,6 +2,10 @@ package com.sooka.sponest.data.housingconstruction.domain;
 
 import com.ruoyi.common.core.annotation.Excel;
 import com.ruoyi.common.core.web.domain.BaseEntity;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
@@ -11,6 +15,10 @@ import org.apache.commons.lang3.builder.ToStringStyle;
  * @author lg
  * @date 2024-07-29
  */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AllArgsConstructor
+@NoArgsConstructor
 public class CenterdataTHousingconstructionAttach extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
@@ -75,93 +83,7 @@ public class CenterdataTHousingconstructionAttach extends BaseEntity {
      */
     private String deptName;
 
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public String getBusId() {
-        return busId;
-    }
-
-    public void setBusId(String busId) {
-        this.busId = busId;
-    }
-
-    public String getDictType() {
-        return dictType;
-    }
-
-    public void setDictType(String dictType) {
-        this.dictType = dictType;
-    }
-
-    public String getDictValue() {
-        return dictValue;
-    }
-
-    public void setDictValue(String dictValue) {
-        this.dictValue = dictValue;
-    }
-
-    public String getAttachPath() {
-        return attachPath;
-    }
-
-    public void setAttachPath(String attachPath) {
-        this.attachPath = attachPath;
-    }
-
-    public String getFileName() {
-        return fileName;
-    }
 
-    public void setFileName(String fileName) {
-        this.fileName = fileName;
-    }
-
-    public Long getAttachSorts() {
-        return attachSorts;
-    }
-
-    public void setAttachSorts(Long attachSorts) {
-        this.attachSorts = attachSorts;
-    }
-
-    public String getCreateName() {
-        return createName;
-    }
-
-    public void setCreateName(String createName) {
-        this.createName = createName;
-    }
-
-    public String getUpdateName() {
-        return updateName;
-    }
-
-    public void setUpdateName(String updateName) {
-        this.updateName = updateName;
-    }
-
-    public Long getDeptId() {
-        return deptId;
-    }
-
-    public void setDeptId(Long deptId) {
-        this.deptId = deptId;
-    }
-
-    public String getDeptName() {
-        return deptName;
-    }
-
-    public void setDeptName(String deptName) {
-        this.deptName = deptName;
-    }
 
     @Override
     public String toString() {

+ 1 - 1
src/main/java/com/sooka/sponest/data/housingconstruction/domain/CenterdataTHousingconstructionSafetyinspectionitem.java

@@ -21,7 +21,7 @@ public class CenterdataTHousingconstructionSafetyinspectionitem extends BaseEnti
     /**
      * 数据id
      */
-    private Long id;
+    private String id;
 
     /**
      * 检查类型

+ 20 - 80
src/main/java/com/sooka/sponest/data/housingconstruction/domain/CenterdataTHousingconstructionSafetyinspectionrecords.java

@@ -2,22 +2,28 @@ package com.sooka.sponest.data.housingconstruction.domain;
 
 import com.ruoyi.common.core.annotation.Excel;
 import com.ruoyi.common.core.web.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
+import java.util.List;
+
 /**
  * 住建-安全检查记录对象 centerdata_t_housingconstruction_safetyinspectionrecords
  *
  * @author LG
  * @date 2024-07-30
  */
+@Data
+@EqualsAndHashCode(callSuper = true)
 public class CenterdataTHousingconstructionSafetyinspectionrecords extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
     /**
      * 序号
      */
-    private Long id;
+    private String id;
 
     /**
      * 检察员id
@@ -50,6 +56,16 @@ public class CenterdataTHousingconstructionSafetyinspectionrecords extends BaseE
     private String enterpriseInspectionType;
 
     /**
+     * 钢瓶id
+     */
+    private String steelcylinderId;
+
+    /**
+     * 钢瓶名称
+     */
+    private String steelcylinderName;
+
+    /**
      * 创建人
      */
     private String createName;
@@ -71,85 +87,7 @@ public class CenterdataTHousingconstructionSafetyinspectionrecords extends BaseE
     @Excel(name = "部门名称")
     private String deptName;
 
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Long getCensorId() {
-        return censorId;
-    }
-
-    public void setCensorId(Long censorId) {
-        this.censorId = censorId;
-    }
-
-    public String getCensorName() {
-        return censorName;
-    }
-
-    public void setCensorName(String censorName) {
-        this.censorName = censorName;
-    }
-
-    public Long getClientId() {
-        return clientId;
-    }
-
-    public void setClientId(Long clientId) {
-        this.clientId = clientId;
-    }
-
-    public String getClientName() {
-        return clientName;
-    }
-
-    public void setClientName(String clientName) {
-        this.clientName = clientName;
-    }
-
-    public String getEnterpriseInspectionType() {
-        return enterpriseInspectionType;
-    }
-
-    public void setEnterpriseInspectionType(String enterpriseInspectionType) {
-        this.enterpriseInspectionType = enterpriseInspectionType;
-    }
-
-    public String getCreateName() {
-        return createName;
-    }
-
-    public void setCreateName(String createName) {
-        this.createName = createName;
-    }
-
-    public String getUpdateName() {
-        return updateName;
-    }
-
-    public void setUpdateName(String updateName) {
-        this.updateName = updateName;
-    }
-
-    public Long getDeptId() {
-        return deptId;
-    }
-
-    public void setDeptId(Long deptId) {
-        this.deptId = deptId;
-    }
-
-    public String getDeptName() {
-        return deptName;
-    }
-
-    public void setDeptName(String deptName) {
-        this.deptName = deptName;
-    }
+    private List<CenterdataTHousingconstructionSafetyinspectionrecordsdetail> detailList;
 
     @Override
     public String toString() {
@@ -160,6 +98,8 @@ public class CenterdataTHousingconstructionSafetyinspectionrecords extends BaseE
                 .append("clientId", getClientId())
                 .append("clientName", getClientName())
                 .append("enterpriseInspectionType", getEnterpriseInspectionType())
+                .append("steelcylinderId", getSteelcylinderId())
+                .append("steelcylinderName", getSteelcylinderName())
                 .append("createTime", getCreateTime())
                 .append("createBy", getCreateBy())
                 .append("createName", getCreateName())

+ 24 - 62
src/main/java/com/sooka/sponest/data/housingconstruction/domain/CenterdataTHousingconstructionSafetyinspectionrecordsdetail.java

@@ -2,15 +2,21 @@ package com.sooka.sponest.data.housingconstruction.domain;
 
 import com.ruoyi.common.core.annotation.Excel;
 import com.ruoyi.common.core.web.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
+import java.util.List;
+
 /**
  * 住建-安全检查记录明细对象 centerdata_t_housingconstruction_safetyinspectionrecordsdetail
  *
  * @author LG
  * @date 2024-07-30
  */
+@Data
+@EqualsAndHashCode(callSuper = true)
 public class CenterdataTHousingconstructionSafetyinspectionrecordsdetail extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
@@ -23,13 +29,25 @@ public class CenterdataTHousingconstructionSafetyinspectionrecordsdetail extends
      * 安全检查记录id
      */
     @Excel(name = "安全检查记录id")
-    private Long recordId;
+    private String recordId;
 
     /**
      * 安全检查项id
      */
     @Excel(name = "安全检查项id")
-    private Long itemId;
+    private String itemId;
+
+
+    /**
+     * 检查项名称
+     */
+    @Excel(name = "安全检查项内容")
+    private String inspectionName;
+
+    /**
+     * 排序
+     */
+    private int inspectionSort;
 
     /**
      * 合格状态
@@ -57,69 +75,11 @@ public class CenterdataTHousingconstructionSafetyinspectionrecordsdetail extends
      */
     private String deptName;
 
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public Long getRecordId() {
-        return recordId;
-    }
-
-    public void setRecordId(Long recordId) {
-        this.recordId = recordId;
-    }
-
-    public Long getItemId() {
-        return itemId;
-    }
-
-    public void setItemId(Long itemId) {
-        this.itemId = itemId;
-    }
-
-    public String getStandardStatus() {
-        return standardStatus;
-    }
-
-    public void setStandardStatus(String standardStatus) {
-        this.standardStatus = standardStatus;
-    }
-
-    public String getCreateName() {
-        return createName;
-    }
-
-    public void setCreateName(String createName) {
-        this.createName = createName;
-    }
 
-    public String getUpdateName() {
-        return updateName;
-    }
 
-    public void setUpdateName(String updateName) {
-        this.updateName = updateName;
-    }
+    private String remark;
 
-    public Long getDeptId() {
-        return deptId;
-    }
-
-    public void setDeptId(Long deptId) {
-        this.deptId = deptId;
-    }
-
-    public String getDeptName() {
-        return deptName;
-    }
-
-    public void setDeptName(String deptName) {
-        this.deptName = deptName;
-    }
+    private List<CenterdataTHousingconstructionAttach> attachList;
 
     @Override
     public String toString() {
@@ -128,6 +88,8 @@ public class CenterdataTHousingconstructionSafetyinspectionrecordsdetail extends
                 .append("recordId", getRecordId())
                 .append("itemId", getItemId())
                 .append("standardStatus", getStandardStatus())
+                .append("inspectionSort", getInspectionSort())
+                .append("remark", getRemark())
                 .append("createTime", getCreateTime())
                 .append("createBy", getCreateBy())
                 .append("createName", getCreateName())

+ 2 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/mapper/CenterdataTHousingconstructionAttachMapper.java

@@ -58,4 +58,6 @@ public interface CenterdataTHousingconstructionAttachMapper {
      * @return 结果
      */
     int deleteCenterdataTHousingconstructionAttachByIds(Long[] ids);
+
+    int insertAttachByList(List<CenterdataTHousingconstructionAttach> attachList);
 }

+ 8 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/mapper/CenterdataTHousingconstructionSafetyinspectionrecordsMapper.java

@@ -20,6 +20,14 @@ public interface CenterdataTHousingconstructionSafetyinspectionrecordsMapper {
     CenterdataTHousingconstructionSafetyinspectionrecords selectCenterdataTHousingconstructionSafetyinspectionrecordsById(Long id);
 
     /**
+     * 查询住建-安全检查记录
+     *
+     * @param id 住建-安全检查记录主键
+     * @return 住建-安全检查记录
+     */
+    CenterdataTHousingconstructionSafetyinspectionrecords queryRedordDetails(String id);
+
+    /**
      * 查询住建-安全检查记录列表
      *
      * @param centerdataTHousingconstructionSafetyinspectionrecords 住建-安全检查记录

+ 2 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/mapper/CenterdataTHousingconstructionSafetyinspectionrecordsdetailMapper.java

@@ -59,4 +59,6 @@ public interface CenterdataTHousingconstructionSafetyinspectionrecordsdetailMapp
      * @return 结果
      */
     int deleteCenterdataTHousingconstructionSafetyinspectionrecordsdetailByIds(String[] ids);
+
+    int insertList(List<CenterdataTHousingconstructionSafetyinspectionrecordsdetail> detailList);
 }

+ 1 - 1
src/main/java/com/sooka/sponest/data/housingconstruction/service/ICenterdataTHousingconstructionSafetyinspectionrecordsService.java

@@ -17,7 +17,7 @@ public interface ICenterdataTHousingconstructionSafetyinspectionrecordsService {
      * @param id 住建-安全检查记录主键
      * @return 住建-安全检查记录
      */
-    CenterdataTHousingconstructionSafetyinspectionrecords selectCenterdataTHousingconstructionSafetyinspectionrecordsById(Long id);
+    CenterdataTHousingconstructionSafetyinspectionrecords selectCenterdataTHousingconstructionSafetyinspectionrecordsById(String id);
 
     /**
      * 查询住建-安全检查记录列表

+ 2 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/service/impl/CenterdataTHousingconstructionSafetyinspectionitemServiceImpl.java

@@ -1,6 +1,7 @@
 package com.sooka.sponest.data.housingconstruction.service.impl;
 
 import com.ruoyi.common.core.utils.DateUtils;
+import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.sooka.sponest.data.housingconstruction.domain.CenterdataTHousingconstructionSafetyinspectionitem;
 import com.sooka.sponest.data.housingconstruction.mapper.CenterdataTHousingconstructionSafetyinspectionitemlMapper;
@@ -51,6 +52,7 @@ public class CenterdataTHousingconstructionSafetyinspectionitemServiceImpl imple
      */
     @Override
     public int insertCenterdataTHousingconstructionSafetyinspectionitem(CenterdataTHousingconstructionSafetyinspectionitem centerdataTHousingconstructionSafetyinspectionitem) {
+        centerdataTHousingconstructionSafetyinspectionitem.setId(IdUtils.fastSimpleUUID());
         centerdataTHousingconstructionSafetyinspectionitem.setCreateTime(DateUtils.getNowDate());
         centerdataTHousingconstructionSafetyinspectionitem.setCreateBy(SecurityUtils.getUserId().toString());
         centerdataTHousingconstructionSafetyinspectionitem.setCreateName(SecurityUtils.getLoginUser().getSysUser().getNickName());

+ 163 - 18
src/main/java/com/sooka/sponest/data/housingconstruction/service/impl/CenterdataTHousingconstructionSafetyinspectionrecordsServiceImpl.java

@@ -1,13 +1,22 @@
 package com.sooka.sponest.data.housingconstruction.service.impl;
 
 import com.ruoyi.common.core.utils.DateUtils;
+import com.ruoyi.common.core.utils.uuid.IdUtils;
+import com.ruoyi.common.security.utils.SecurityUtils;
+import com.sooka.sponest.data.housingconstruction.domain.CenterdataTHousingconstructionAttach;
 import com.sooka.sponest.data.housingconstruction.domain.CenterdataTHousingconstructionSafetyinspectionrecords;
+import com.sooka.sponest.data.housingconstruction.domain.CenterdataTHousingconstructionSafetyinspectionrecordsdetail;
+import com.sooka.sponest.data.housingconstruction.mapper.CenterdataTHousingconstructionAttachMapper;
 import com.sooka.sponest.data.housingconstruction.mapper.CenterdataTHousingconstructionSafetyinspectionrecordsMapper;
+import com.sooka.sponest.data.housingconstruction.mapper.CenterdataTHousingconstructionSafetyinspectionrecordsdetailMapper;
 import com.sooka.sponest.data.housingconstruction.service.ICenterdataTHousingconstructionSafetyinspectionrecordsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
+import java.sql.Array;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * 住建-安全检查记录Service业务层处理
@@ -18,30 +27,41 @@ import java.util.List;
 @Service
 public class CenterdataTHousingconstructionSafetyinspectionrecordsServiceImpl implements ICenterdataTHousingconstructionSafetyinspectionrecordsService {
     @Autowired
-    private CenterdataTHousingconstructionSafetyinspectionrecordsMapper centerdataTHousingconstructionSafetyinspectionrecordsMapper;
+    private CenterdataTHousingconstructionSafetyinspectionrecordsMapper recordsMapper;
+
+    @Autowired
+    private CenterdataTHousingconstructionSafetyinspectionrecordsdetailMapper detailMapper;
+
+    @Autowired
+    private CenterdataTHousingconstructionAttachMapper attachMapper;
+
 
     /**
-     * 查询住建-安全检查记录
+     * 查询住建-安全检查记录列表
      *
-     * @param id 住建-安全检查记录主键
+     * @param centerdataTHousingconstructionSafetyinspectionrecords 住建-安全检查记录
      * @return 住建-安全检查记录
      */
     @Override
-    public CenterdataTHousingconstructionSafetyinspectionrecords selectCenterdataTHousingconstructionSafetyinspectionrecordsById(Long id) {
-        return centerdataTHousingconstructionSafetyinspectionrecordsMapper.selectCenterdataTHousingconstructionSafetyinspectionrecordsById(id);
+    public List<CenterdataTHousingconstructionSafetyinspectionrecords> selectCenterdataTHousingconstructionSafetyinspectionrecordsList(CenterdataTHousingconstructionSafetyinspectionrecords centerdataTHousingconstructionSafetyinspectionrecords) {
+        return recordsMapper.selectCenterdataTHousingconstructionSafetyinspectionrecordsList(centerdataTHousingconstructionSafetyinspectionrecords);
     }
 
+
+
     /**
-     * 查询住建-安全检查记录列表
+     * 查询住建-安全检查记录
      *
-     * @param centerdataTHousingconstructionSafetyinspectionrecords 住建-安全检查记录
+     * @param id 住建-安全检查记录主键
      * @return 住建-安全检查记录
      */
     @Override
-    public List<CenterdataTHousingconstructionSafetyinspectionrecords> selectCenterdataTHousingconstructionSafetyinspectionrecordsList(CenterdataTHousingconstructionSafetyinspectionrecords centerdataTHousingconstructionSafetyinspectionrecords) {
-        return centerdataTHousingconstructionSafetyinspectionrecordsMapper.selectCenterdataTHousingconstructionSafetyinspectionrecordsList(centerdataTHousingconstructionSafetyinspectionrecords);
+    public CenterdataTHousingconstructionSafetyinspectionrecords selectCenterdataTHousingconstructionSafetyinspectionrecordsById(String id) {
+        return recordsMapper.queryRedordDetails(id);
     }
 
+
+
     /**
      * 新增住建-安全检查记录
      *
@@ -50,41 +70,166 @@ public class CenterdataTHousingconstructionSafetyinspectionrecordsServiceImpl im
      */
     @Override
     public int insertCenterdataTHousingconstructionSafetyinspectionrecords(CenterdataTHousingconstructionSafetyinspectionrecords centerdataTHousingconstructionSafetyinspectionrecords) {
-        centerdataTHousingconstructionSafetyinspectionrecords.setCreateTime(DateUtils.getNowDate());
-        return centerdataTHousingconstructionSafetyinspectionrecordsMapper.insertCenterdataTHousingconstructionSafetyinspectionrecords(centerdataTHousingconstructionSafetyinspectionrecords);
+        //生成记录id
+        String recordId = IdUtils.fastSimpleUUID();
+        centerdataTHousingconstructionSafetyinspectionrecords.setId(recordId);
+        //设置创建数据信息
+        Date nowDate = DateUtils.getNowDate();
+        centerdataTHousingconstructionSafetyinspectionrecords.setCreateTime(nowDate);
+        centerdataTHousingconstructionSafetyinspectionrecords.setCreateBy(SecurityUtils.getUserId().toString());
+        centerdataTHousingconstructionSafetyinspectionrecords.setCreateName(SecurityUtils.getLoginUser().getSysUser().getNickName());
+        centerdataTHousingconstructionSafetyinspectionrecords.setUpdateTime(nowDate);
+        //写入安全检查记录明细
+        addDetailList(centerdataTHousingconstructionSafetyinspectionrecords.getDetailList(), recordId);
+        //写入安全检查记录
+        return recordsMapper.insertCenterdataTHousingconstructionSafetyinspectionrecords(centerdataTHousingconstructionSafetyinspectionrecords);
+    }
+
+    /**
+     * 写入安全检查明细表
+     * @param detailList 检查记录明细集合
+     * @param recordId 检查记录id
+     */
+    private void addDetailList(List<CenterdataTHousingconstructionSafetyinspectionrecordsdetail> detailList, String recordId){
+        Date nowDate = DateUtils.getNowDate();
+        detailList.forEach(detail->{
+            //生成记录明细id
+            String uuid = IdUtils.fastSimpleUUID();
+            //设置记录明细id
+            detail.setId(uuid);
+            //设置记录id
+            detail.setRecordId(recordId);
+            //设置创建信息
+            detail.setCreateTime(nowDate);
+            detail.setCreateBy(SecurityUtils.getUserId().toString());
+            detail.setCreateName(SecurityUtils.getLoginUser().getSysUser().getNickName());
+            detail.setUpdateTime(nowDate);
+            //将记录明细表中的附件写入到附件表中
+            addAttachToList(detail.getAttachList(), uuid);
+        });
+        //写入安全检查记录明细
+        detailMapper.insertList(detailList);
+    }
+
+    /**
+     * 写入附件表
+     * @param attachList 附件集合
+     * @param detailId 业务数据id
+     */
+    private void addAttachToList(List<CenterdataTHousingconstructionAttach> attachList, String detailId){
+        if(attachList != null && !attachList.isEmpty()){
+            Date nowDate = DateUtils.getNowDate();
+            attachList.forEach(attach->{
+                //设置业务数据id
+                attach.setBusId(detailId);
+                //设置创建信息
+                attach.setCreateTime(nowDate);
+            });
+            attachMapper.insertAttachByList(attachList);
+        }
     }
 
+
     /**
      * 修改住建-安全检查记录
-     *
      * @param centerdataTHousingconstructionSafetyinspectionrecords 住建-安全检查记录
      * @return 结果
      */
     @Override
     public int updateCenterdataTHousingconstructionSafetyinspectionrecords(CenterdataTHousingconstructionSafetyinspectionrecords centerdataTHousingconstructionSafetyinspectionrecords) {
+        //设置修改数据信息
         centerdataTHousingconstructionSafetyinspectionrecords.setUpdateTime(DateUtils.getNowDate());
-        return centerdataTHousingconstructionSafetyinspectionrecordsMapper.updateCenterdataTHousingconstructionSafetyinspectionrecords(centerdataTHousingconstructionSafetyinspectionrecords);
+        centerdataTHousingconstructionSafetyinspectionrecords.setUpdateBy(SecurityUtils.getUserId().toString());
+        centerdataTHousingconstructionSafetyinspectionrecords.setUpdateName(SecurityUtils.getLoginUser().getSysUser().getNickName());
+        //获取旧数据
+        CenterdataTHousingconstructionSafetyinspectionrecords oldRecords = recordsMapper.queryRedordDetails(centerdataTHousingconstructionSafetyinspectionrecords.getId());
+
+        //比较新旧数据, 属性值不相同则修改。
+        editDetailList(centerdataTHousingconstructionSafetyinspectionrecords.getDetailList(),oldRecords.getDetailList());
+
+        //基本信息禁止修改,只写入修改时间,修改人,修改人id
+        return recordsMapper.updateCenterdataTHousingconstructionSafetyinspectionrecords(centerdataTHousingconstructionSafetyinspectionrecords);
+    }
+
+    /**
+     * 比较新旧记录
+     * 如果新纪录和旧纪录相同,则不执行修改
+     */
+    private void editDetailList(List<CenterdataTHousingconstructionSafetyinspectionrecordsdetail> detailList, List<CenterdataTHousingconstructionSafetyinspectionrecordsdetail> oldDetailList){
+        // 将 oldDetailList 转换为 Map,方便快速查找
+        Map<String, CenterdataTHousingconstructionSafetyinspectionrecordsdetail> oldDetailMap = oldDetailList.stream()
+                .collect(Collectors.toMap(
+                        detail -> detail.getId() + "-" + detail.getItemId(),
+                        Function.identity()
+                ));
+
+        for (CenterdataTHousingconstructionSafetyinspectionrecordsdetail newDetail : detailList) {
+            String key = newDetail.getId() + "-" + newDetail.getItemId();
+            CenterdataTHousingconstructionSafetyinspectionrecordsdetail oldDetail = oldDetailMap.get(key);
+            if (oldDetail != null) {
+                if (!Objects.equals(newDetail.getStandardStatus(), oldDetail.getStandardStatus()) ||
+                        !Objects.equals(newDetail.getRemark(), oldDetail.getRemark())) {
+                    updateDetail(newDetail);
+                }
+                editAttachList(newDetail.getAttachList(), oldDetail.getAttachList());
+            }
+        }
+    }
+
+    /**
+     * 更新安全检查记录数据
+     * @param detail
+     */
+    private void updateDetail(CenterdataTHousingconstructionSafetyinspectionrecordsdetail detail) {
+        detail.setUpdateTime(DateUtils.getNowDate());
+        detail.setUpdateBy(SecurityUtils.getUserId().toString());
+        detail.setUpdateName(SecurityUtils.getLoginUser().getSysUser().getNickName());
+        detailMapper.updateCenterdataTHousingconstructionSafetyinspectionrecordsdetail(detail);
+    }
+
+    /**
+     * 替换附件信息
+     */
+    private void editAttachList(List<CenterdataTHousingconstructionAttach> attachList, List<CenterdataTHousingconstructionAttach> oldAttachList){
+        //旧数据中附件集合不是null, 并且不是空集合, 则执行删除就附件
+        if(oldAttachList != null && !oldAttachList.isEmpty()){
+            // 从 oldAttachList 中提取 ID,并删除旧附件
+            List<Long> idList = oldAttachList.stream()
+                    .filter(Objects::nonNull)
+                    .map(CenterdataTHousingconstructionAttach::getId)
+                    .collect(Collectors.toList());
+
+            attachMapper.deleteCenterdataTHousingconstructionAttachByIds(idList.toArray(new Long[0]));
+        }
+
+        //新数据中的附件集合不是null, 并且不是空集合, 则执行写入附件
+        if(attachList != null && !attachList.isEmpty()){
+            Date nowDate = DateUtils.getNowDate();
+            attachList.forEach(attach->{
+                attach.setCreateTime(nowDate);
+            });
+            //写入新附件
+            attachMapper.insertAttachByList(attachList);
+        }
     }
 
     /**
      * 批量删除住建-安全检查记录
-     *
      * @param ids 需要删除的住建-安全检查记录主键
      * @return 结果
      */
     @Override
     public int deleteCenterdataTHousingconstructionSafetyinspectionrecordsByIds(Long[] ids) {
-        return centerdataTHousingconstructionSafetyinspectionrecordsMapper.deleteCenterdataTHousingconstructionSafetyinspectionrecordsByIds(ids);
+        return recordsMapper.deleteCenterdataTHousingconstructionSafetyinspectionrecordsByIds(ids);
     }
 
     /**
      * 删除住建-安全检查记录信息
-     *
      * @param id 住建-安全检查记录主键
      * @return 结果
      */
     @Override
     public int deleteCenterdataTHousingconstructionSafetyinspectionrecordsById(Long id) {
-        return centerdataTHousingconstructionSafetyinspectionrecordsMapper.deleteCenterdataTHousingconstructionSafetyinspectionrecordsById(id);
+        return recordsMapper.deleteCenterdataTHousingconstructionSafetyinspectionrecordsById(id);
     }
 }

+ 16 - 22
src/main/resources/mapper/housingconstruction/CenterdataTHousingconstructionAttachMapper.xml

@@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectCenterdataTHousingconstructionAttachVo">
-        select id, bus_id, dict_type, dict_value, attach_path, file_name, attach_sorts, create_time, create_by, create_name, update_time, update_by, update_name, dept_id, dept_name from centerdata_t_housingconstruction_attach
+        select id, bus_id, dict_type, dict_value, attach_path, file_name, attach_sorts, create_time from centerdata_t_housingconstruction_attach
     </sql>
 
     <select id="selectCenterdataTHousingconstructionAttachList" parameterType="CenterdataTHousingconstructionAttach" resultMap="CenterdataTHousingconstructionAttachResult">
@@ -54,13 +54,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="fileName != null">file_name,</if>
             <if test="attachSorts != null">attach_sorts,</if>
             <if test="createTime != null">create_time,</if>
-            <if test="createBy != null">create_by,</if>
-            <if test="createName != null">create_name,</if>
-            <if test="updateTime != null">update_time,</if>
-            <if test="updateBy != null">update_by,</if>
-            <if test="updateName != null">update_name,</if>
-            <if test="deptId != null">dept_id,</if>
-            <if test="deptName != null">dept_name,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -71,13 +64,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="fileName != null">#{fileName},</if>
             <if test="attachSorts != null">#{attachSorts},</if>
             <if test="createTime != null">#{createTime},</if>
-            <if test="createBy != null">#{createBy},</if>
-            <if test="createName != null">#{createName},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-            <if test="updateBy != null">#{updateBy},</if>
-            <if test="updateName != null">#{updateName},</if>
-            <if test="deptId != null">#{deptId},</if>
-            <if test="deptName != null">#{deptName},</if>
          </trim>
     </insert>
 
@@ -91,13 +77,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="fileName != null">file_name = #{fileName},</if>
             <if test="attachSorts != null">attach_sorts = #{attachSorts},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
-            <if test="createBy != null">create_by = #{createBy},</if>
-            <if test="createName != null">create_name = #{createName},</if>
-            <if test="updateTime != null">update_time = #{updateTime},</if>
-            <if test="updateBy != null">update_by = #{updateBy},</if>
-            <if test="updateName != null">update_name = #{updateName},</if>
-            <if test="deptId != null">dept_id = #{deptId},</if>
-            <if test="deptName != null">dept_name = #{deptName},</if>
         </trim>
         where id = #{id}
     </update>
@@ -112,4 +91,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <insert id="insertAttachByList" parameterType="list">
+        insert into centerdata_t_housingconstruction_attach
+        (bus_id, dict_type, dict_value, attach_path, file_name, attach_sorts, create_time)
+        values
+        <foreach collection="list" item="attach" open="(" separator="),(" close=")">
+            #{attach.busId},
+            #{attach.dictType},
+            #{attach.dictValue},
+            #{attach.attachPath},
+            #{attach.fileName},
+            #{attach.attachSorts},
+            #{attach.createTime}
+        </foreach>
+    </insert>
 </mapper>

+ 101 - 10
src/main/resources/mapper/housingconstruction/CenterdataTHousingconstructionSafetyinspectionrecordsMapper.xml

@@ -12,6 +12,8 @@
         <result property="clientId" column="client_id"/>
         <result property="clientName" column="client_name"/>
         <result property="enterpriseInspectionType" column="enterprise_inspection_type"/>
+        <result property="steelcylinderId" column="steelcylinder_id"/>
+        <result property="steelcylinderName" column="steelcylinder_name"/>
         <result property="createTime" column="create_time"/>
         <result property="createBy" column="create_by"/>
         <result property="createName" column="create_name"/>
@@ -29,6 +31,8 @@
                client_id,
                client_name,
                enterprise_inspection_type,
+               steelcylinder_id,
+               steelcylinder_name,
                create_time,
                create_by,
                create_name,
@@ -68,11 +72,14 @@
             keyProperty="id">
         insert into centerdata_t_housingconstruction_safetyinspectionrecords
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
             <if test="censorId != null">censor_id,</if>
             <if test="censorName != null">censor_name,</if>
             <if test="clientId != null">client_id,</if>
             <if test="clientName != null">client_name,</if>
             <if test="enterpriseInspectionType != null">enterprise_inspection_type,</if>
+            <if test="steelcylinderId != null">steelcylinder_id,</if>
+            <if test="steelcylinderName != null">steelcylinder_name,</if>
             <if test="createTime != null">create_time,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createName != null">create_name,</if>
@@ -83,11 +90,14 @@
             <if test="deptName != null">dept_name,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
             <if test="censorId != null">#{censorId},</if>
             <if test="censorName != null">#{censorName},</if>
             <if test="clientId != null">#{clientId},</if>
             <if test="clientName != null">#{clientName},</if>
             <if test="enterpriseInspectionType != null">#{enterpriseInspectionType},</if>
+            <if test="steelcylinderId != null">#{steelcylinderId},</if>
+            <if test="steelcylinderName != null">#{steelcylinderName},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createName != null">#{createName},</if>
@@ -103,19 +113,9 @@
             parameterType="CenterdataTHousingconstructionSafetyinspectionrecords">
         update centerdata_t_housingconstruction_safetyinspectionrecords
         <trim prefix="SET" suffixOverrides=",">
-            <if test="censorId != null">censor_id = #{censorId},</if>
-            <if test="censorName != null">censor_name = #{censorName},</if>
-            <if test="clientId != null">client_id = #{clientId},</if>
-            <if test="clientName != null">client_name = #{clientName},</if>
-            <if test="enterpriseInspectionType != null">enterprise_inspection_type = #{enterpriseInspectionType},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
-            <if test="createBy != null">create_by = #{createBy},</if>
-            <if test="createName != null">create_name = #{createName},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateName != null">update_name = #{updateName},</if>
-            <if test="deptId != null">dept_id = #{deptId},</if>
-            <if test="deptName != null">dept_name = #{deptName},</if>
         </trim>
         where id = #{id}
     </update>
@@ -132,4 +132,95 @@
             #{id}
         </foreach>
     </delete>
+
+    <resultMap id="redordDetailsResultMap" type="CenterdataTHousingconstructionSafetyinspectionrecords">
+        <id property="id" column="record_id"/>
+        <result property="censorId" column="censor_id"/>
+        <result property="censorName" column="censor_name"/>
+        <result property="clientId" column="client_id"/>
+        <result property="clientName" column="client_name"/>
+        <result property="enterpriseInspectionType" column="enterprise_inspection_type"/>
+        <result property="steelcylinderId" column="steelcylinder_id"/>
+        <result property="steelcylinderName" column="steelcylinder_name"/>
+        <result property="createTime" column="create_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createName" column="create_name"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateName" column="update_name"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="deptName" column="dept_name"/>
+        <collection property="detailList" ofType="CenterdataTHousingconstructionSafetyinspectionrecordsdetail">
+            <result property="id" column="detail_id"/>
+            <result property="recordId" column="record_id"/>
+            <result property="itemId" column="item_id"/>
+            <result property="inspectionName" column="inspection_name"/>
+            <result property="inspectionSort" column="inspection_sort"/>
+            <result property="standardStatus" column="standard_status"/>
+            <result property="createTime" column="detail_create_time"/>
+            <result property="createBy" column="detail_create_by"/>
+            <result property="createName" column="detail_create_name"/>
+            <result property="updateTime" column="detail_update_time"/>
+            <result property="updateBy" column="detail_update_by"/>
+            <result property="updateName" column="detail_update_name"/>
+            <result property="deptId" column="detail_dept_id"/>
+            <result property="deptName" column="detail_dept_name"/>
+            <collection property="attachList" ofType="CenterdataTHousingconstructionAttach">
+                <result property="id" column="attach_id"/>
+                <result property="busId" column="bus_id"/>
+                <result property="attachPath" column="attach_path"/>
+                <result property="fileName" column="file_name"/>
+                <result property="attachSorts" column="attach_sorts"/>
+            </collection>
+        </collection>
+    </resultMap>
+
+    <select id="queryRedordDetails" parameterType="string" resultMap="redordDetailsResultMap">
+        SELECT
+            record.id as record_id,
+            record.censor_id,
+            record.censor_name,
+            record.client_id,
+            record.client_name,
+            record.enterprise_inspection_type,
+            record.steelcylinder_id,
+            record.steelcylinder_name,
+            record.create_time,
+            record.create_by,
+            record.create_name,
+            record.update_time,
+            record.update_by,
+            record.update_name,
+            record.dept_id,
+            record.dept_name,
+            detail.id as detail_id,
+            detail.standard_status,
+            detail.item_id,
+            item.inspection_name,
+            item.inspection_sort,
+            detail.remark,
+            detail.create_time as detail_create_time,
+            detail.create_by as detail_create_by,
+            detail.create_name as detail_create_name,
+            detail.update_time as detail_update_time,
+            detail.update_by as detail_update_by,
+            detail.update_name as detail_update_name,
+            detail.dept_id as detail_dept_id,
+            detail.dept_name as detail_dept_name,
+            attach.bus_id,
+            attach.id as attach_id,
+            attach.attach_path,
+            attach.file_name,
+            attach.attach_sorts
+        FROM
+            centerdata_t_housingconstruction_safetyinspectionrecords record
+                LEFT JOIN centerdata_t_housingconstruction_safetyinspectionrecordsdetail detail ON detail.record_id = record.id
+                LEFT JOIN centerdata_t_housingconstruction_safetyinspectionitem item ON detail.item_id = item.id
+                LEFT JOIN centerdata_t_housingconstruction_attach attach ON attach.bus_id = detail.id
+        where record.id = #{id}
+        ORDER BY
+            inspection_sort,
+            attach_sorts
+
+    </select>
 </mapper>

+ 22 - 0
src/main/resources/mapper/housingconstruction/CenterdataTHousingconstructionSafetyinspectionrecordsdetailMapper.xml

@@ -95,4 +95,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <insert id="insertList" parameterType="list">
+        insert into centerdata_t_housingconstruction_safetyinspectionrecordsdetail
+        (id, record_id, item_id, standard_status, item_sort, remark, create_time, create_by, create_name, update_time, update_by, update_name, dept_id, dept_name)
+        values
+        <foreach collection="list" item="detail" open="(" separator="),(" close=")">
+            #{detail.id},
+            #{detail.recordId},
+            #{detail.itemId},
+            #{detail.standardStatus},
+            #{detail.itemSort},
+            #{detail.remark},
+            #{detail.createTime},
+            #{detail.createBy},
+            #{detail.createName},
+            #{detail.updateTime},
+            #{detail.updateBy},
+            #{detail.updateName},
+            #{detail.deptId},
+            #{detail.deptName}
+        </foreach>
+    </insert>
 </mapper>