| gkhy-admin/src/main/java/com/gkhy/web/controller/system/SysProfileController.java | ●●●●● patch | view | raw | blame | history | |
| gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspection.java | ●●●●● patch | view | raw | blame | history | |
| gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspectionDept.java | ●●●●● patch | view | raw | blame | history | |
| gkhy-system/src/main/java/com/gkhy/system/mapper/DailySafetyInspectionDeptMapper.java | ●●●●● patch | view | raw | blame | history | |
| gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java | ●●●●● patch | view | raw | blame | history | |
| gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionDeptMapper.xml | ●●●●● patch | view | raw | blame | history | |
| gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml | ●●●●● patch | view | raw | blame | history |
gkhy-admin/src/main/java/com/gkhy/web/controller/system/SysProfileController.java
@@ -86,7 +86,7 @@ * 重置密码 */ @Log(title = "个人信息", businessType = BusinessType.UPDATE) @PutMapping("/updatePwd") @PostMapping("/updatePwd") public AjaxResult updatePwd(@RequestBody Map<String, String> params) { String oldPassword = params.get("oldPassword"); gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspection.java
@@ -56,11 +56,10 @@ @ApiModelProperty(value = "被检查部门/研究组",required = true) @TableField("research_group") @NotNull(message = "被检查部门/研究组不能为空") private Long researchGroup; @TableField(exist = false) @ApiModelProperty("被检查部门/研究组名称") @ApiModelProperty(value = "被检查部门/研究组名称",hidden = true) private String researchGroupName; @@ -153,4 +152,8 @@ @ApiModelProperty(value = "是否存在隐患 0否1是") @TableField(exist = false) private Integer haveMainHazard; @ApiModelProperty(value = "部门信息") @TableField(exist = false) private List<DailySafetyInspectionDept> dailySafetyInspectionDepts; } gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspectionDept.java
New file @@ -0,0 +1,41 @@ package com.gkhy.system.domain; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; import java.io.Serializable; /** * <p> * 日常检查人员表 * </p> * * @author hh * @since 2025-09-08 10:36:52 */ @Getter @Setter @TableName("daily_safety_inspection_dept") @ApiModel(value = "DailySafetyInspectionDept对象", description = "日常检查部门表") public class DailySafetyInspectionDept implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty("主表id") @TableId("daily_safety_inspection_id") private Long dailySafetyInspectionId; @ApiModelProperty("部门id") @TableField("dept_id") private Long deptId; @TableField("dept_name") private String deptName; } gkhy-system/src/main/java/com/gkhy/system/mapper/DailySafetyInspectionDeptMapper.java
New file @@ -0,0 +1,20 @@ package com.gkhy.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gkhy.system.domain.DailySafetyInspectionDept; import com.gkhy.system.domain.DailySafetyInspectionUser; import org.apache.ibatis.annotations.Mapper; /** * <p> * 日常检查人员表 Mapper 接口 * </p> * * @author hh * @since 2025-09-08 10:36:52 */ @Mapper public interface DailySafetyInspectionDeptMapper extends BaseMapper<DailySafetyInspectionDept> { } gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java
@@ -9,7 +9,9 @@ import com.gkhy.common.exception.ServiceException; import com.gkhy.common.utils.SecurityUtils; import com.gkhy.system.domain.DailySafetyInspection; import com.gkhy.system.domain.DailySafetyInspectionDept; import com.gkhy.system.domain.DailySafetyInspectionUser; import com.gkhy.system.mapper.DailySafetyInspectionDeptMapper; import com.gkhy.system.mapper.DailySafetyInspectionMapper; import com.gkhy.system.mapper.DailySafetyInspectionUserMapper; import com.gkhy.system.mapper.SysDeptMapper; @@ -40,6 +42,9 @@ private DailySafetyInspectionUserMapper dailySafetyInspectionUserMapper; @Autowired private DailySafetyInspectionDeptMapper dailySafetyInspectionDeptMapper; @Autowired private SysDeptMapper sysDeptMapper; @Override @@ -54,14 +59,14 @@ // if (ObjectUtil.isEmpty(dailySafetyInspectionUsers)) { // throw new ServiceException("参检人员不能为空"); // } Long researchGroup = inspection.getResearchGroup(); SysDept sysDept = sysDeptMapper.selectDeptById(researchGroup); if (sysDept == null) { throw new ServiceException("部门不存在"); } if (!"1".equals(sysDept.getSafety())){ throw new ServiceException("所选部门未开启安全检查"); } // Long researchGroup = inspection.getResearchGroup(); // SysDept sysDept = sysDeptMapper.selectDeptById(researchGroup); // if (sysDept == null) { // throw new ServiceException("部门不存在"); // } // if (!"1".equals(sysDept.getSafety())){ // throw new ServiceException("所选部门未开启安全检查"); // } int i = 0; if (inspection.getId() == null) { @@ -72,6 +77,9 @@ inspection.setUpdateTime(LocalDateTime.now()); inspection.setUpdateBy(SecurityUtils.getUsername()); i = dailySafetyInspectionMapper.updateById(inspection); } if (i > 0){ saveDailySafetyInspectionDept(inspection.getDailySafetyInspectionDepts(),inspection.getId()); } // if (i > 0) { // saveDailySafetyInspectionUser(dailySafetyInspectionUsers, inspection.getId()); @@ -90,7 +98,17 @@ }); } private void saveDailySafetyInspectionDept(List<DailySafetyInspectionDept> dailySafetyInspectionDepts, Long id) { DailySafetyInspectionDept dept = new DailySafetyInspectionDept(); dept.setDailySafetyInspectionId(id); dailySafetyInspectionDeptMapper.deleteById(dept); dailySafetyInspectionDepts.forEach(dept1 -> { dept1.setDailySafetyInspectionId(id); dailySafetyInspectionDeptMapper.insert(dept1); }); } @Override public int deleteDailySafetyInspection(Long id) { gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionDeptMapper.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.gkhy.system.mapper.DailySafetyInspectionDeptMapper"> </mapper> gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml
@@ -1,8 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.gkhy.system.mapper.DailySafetyInspectionMapper"> <resultMap id="BaseResultMap" type="com.gkhy.system.domain.DailySafetyInspection"> <id column="id" property="id" /> <result column="check_date" property="checkDate" /> @@ -27,7 +25,8 @@ <result column="check_type" property="checkType" /> <!-- <collection property="dailySafetyInspectionUsers" ofType="com.gkhy.system.domain.DailySafetyInspectionUser" column="id = id" select="selectDailySafetyInspectionUsers" />--> <collection property="dailySafetyInspectionDepts" ofType="com.gkhy.system.domain.DailySafetyInspectionDept" column="id = id" select="selectDailySafetyInspectionDepts"/> </resultMap> <resultMap id="dailySafetyInspectionUsers" type="com.gkhy.system.domain.DailySafetyInspectionUser"> @@ -36,8 +35,25 @@ <result column="check_user" property="checkUser" /> </resultMap> <resultMap id="dailySafetyInspectionDepts" type="com.gkhy.system.domain.DailySafetyInspectionDept"> <result column="daily_safety_inspection_id" property="dailySafetyInspectionId"/> <result column="dept_id" property="deptId"/> <result column="dept_name" property="deptName"/> </resultMap> <select id="selectDailySafetyInspectionDepts" resultMap="dailySafetyInspectionDepts"> select a.daily_safety_inspection_id, a.dept_id, b.dept_name from daily_safety_inspection_dept a left join sys_dept b on a.dept_id = b.dept_id where a.daily_safety_inspection_id = #{id} </select> <select id="selectDailySafetyInspectionUsers" resultMap="dailySafetyInspectionUsers"> select * from daily_safety_inspection_user where daily_safety_inspection_id = #{id} select * from daily_safety_inspection_user where daily_safety_inspection_id = #{id} </select> @@ -46,17 +62,19 @@ select a.*,b.dept_name as research_group_name from daily_safety_inspection a left join sys_dept b on a.research_group = b.dept_id where a.del_flag = '0' <if test="researchGroup != null "> and a.research_group = #{researchGroup} </if> where a.del_flag = 0 <!-- <if test="researchGroup != null ">--> <!-- and a.research_group = #{researchGroup}--> <!-- </if>--> <if test="checkType != null "> and a.check_type = #{checkType} </if> <if test="checkBeginDate != null "><!-- 开始时间检索 --> <if test="checkBeginDate != null "> <!-- 开始时间检索 --> AND date_format(a.check_date,'%Y%m%d') >= date_format(#{checkBeginDate},'%Y%m%d') </if> <if test="checkEndDate != null "><!-- 结束时间检索 --> <if test="checkEndDate != null "> <!-- 结束时间检索 --> AND date_format(a.check_date,'%Y%m%d') <= date_format(#{checkEndDate},'%Y%m%d') </if> <if test="haveMainHazard != null and haveMainHazard == 0 "> @@ -68,6 +86,14 @@ <if test="checkUser != null and checkUser != ''"> and a.check_user like concat('%',#{checkUser},'%') </if> <if test="researchGroup != null "> and a.id in ( select distinct daily_safety_inspection_id from daily_safety_inspection_dept where dept_id = #{researchGroup} ) </if> <!-- <if test="searchCheckUserIds != null and !searchCheckUserIds.isEmpty()">--> <!-- and a.id in (--> <!-- select distinct daily_safety_inspection_id from daily_safety_inspection_user--> @@ -81,6 +107,11 @@ <select id="getCheckCount" parameterType="long" resultType="int"> select count(*) from daily_safety_inspection where del_flag = 0 and research_group = #{deptId} and date_format(check_date,'%Y%m') = date_format(now(),'%Y%m') select count(*) from daily_safety_inspection_dept a inner join daily_safety_inspection b on a.daily_safety_inspection_id = b.id where b.del_flag = 0 and a.dept_id = #{deptId} and date_format(b.check_date, '%Y%m') = date_format(now(), '%Y%m') </select> </mapper>