hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionHazardInform/controller/TRegionHazardInformController.java
对比新文件 @@ -0,0 +1,49 @@ package com.thhy.secure.modules.biz.regionHazardInform.controller; import com.thhy.general.common.BasicResult; import com.thhy.secure.modules.biz.regionHazardInform.dto.TRegionHazardInformDto; import com.thhy.secure.modules.biz.regionHazardInform.entity.TRegionHazardInformEntity; import com.thhy.secure.modules.biz.regionHazardInform.service.TRegionHazardInformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * @Author QiuYuHao * @CreateDate 2023-09-26 13:32:08 * 危险源告知控制层 */ @RestController @RequestMapping(value = "regionHazardInform") public class TRegionHazardInformController { @Autowired private TRegionHazardInformService service; @PostMapping(value = "findAll") public BasicResult findAll(TRegionHazardInformDto tRegionHazardInformDto){ return service.findAll(tRegionHazardInformDto); } @GetMapping(value = "findEntity") public BasicResult findEntity(String id){ return service.findEntity(id); } @PostMapping(value = "insert") public BasicResult insert(TRegionHazardInformEntity tRegionHazardInformEntity){ return service.insert(tRegionHazardInformEntity); } @PostMapping(value = "update") public BasicResult update(TRegionHazardInformEntity tRegionHazardInformEntity){ return service.update(tRegionHazardInformEntity); } @GetMapping(value = "delete") public BasicResult delete(String id){ return service.delete(id); } } hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionHazardInform/dto/TRegionHazardInformDto.java
对比新文件 @@ -0,0 +1,16 @@ package com.thhy.secure.modules.biz.regionHazardInform.dto; import lombok.Data; /** * @Author QiuYuHao * @CreateDate 2023-09-26 13:33:54 * 危险源告知dto */ @Data public class TRegionHazardInformDto { private Integer level;//安全等级 private Integer pageNum; private Integer pageSize; private String companyId; } hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionHazardInform/entity/TRegionHazardInformEntity.java
对比新文件 @@ -0,0 +1,24 @@ package com.thhy.secure.modules.biz.regionHazardInform.entity; import com.thhy.general.annotations.Idkey; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * @Author QiuYuHao * @CreateDate 2023-09-26 13:35:42 * 危险告知实体 */ @Data public class TRegionHazardInformEntity implements Serializable { @Idkey(value = "id") private String id; private String region; private Integer level; private String regionColor; private String companyId; private String createUser; private Date createTime; } hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionHazardInform/mapper/TRegionHazardInformMapper.java
对比新文件 @@ -0,0 +1,26 @@ package com.thhy.secure.modules.biz.regionHazardInform.mapper; import com.thhy.secure.modules.biz.regionHazardInform.dto.TRegionHazardInformDto; import com.thhy.secure.modules.biz.regionHazardInform.entity.TRegionHazardInformEntity; import org.apache.ibatis.annotations.Mapper; import java.util.List; /** * @Author QiuYuHao * @CreateDate 2023-09-26 13:39:01 * 危险告知mapper */ @Mapper public interface TRegionHazardInformMapper { List<TRegionHazardInformEntity> findAll(TRegionHazardInformDto tRegionHazardInformDto); TRegionHazardInformEntity findEntity(String id); void insert(TRegionHazardInformEntity tRegionHazardInformEntity); void update(TRegionHazardInformEntity tRegionHazardInformEntity); void delete(String id); } hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionHazardInform/service/TRegionHazardInformService.java
对比新文件 @@ -0,0 +1,25 @@ package com.thhy.secure.modules.biz.regionHazardInform.service; import com.thhy.general.common.BasicResult; import com.thhy.secure.modules.biz.regionHazardInform.dto.TRegionHazardInformDto; import com.thhy.secure.modules.biz.regionHazardInform.entity.TRegionHazardInformEntity; import java.util.List; /** * @Author QiuYuHao * @CreateDate 2023-09-26 13:42:53 * 危险告知源接口 */ public interface TRegionHazardInformService { BasicResult findAll(TRegionHazardInformDto tRegionHazardInformDto); BasicResult findEntity(String id); BasicResult insert(TRegionHazardInformEntity tRegionHazardInformEntity); BasicResult update(TRegionHazardInformEntity tRegionHazardInformEntity); BasicResult delete(String id); } hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionHazardInform/service/impl/TRegionHazardInformServiceImpl.java
对比新文件 @@ -0,0 +1,65 @@ package com.thhy.secure.modules.biz.regionHazardInform.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.thhy.general.common.BasicResult; import com.thhy.general.config.SysUserInfo; import com.thhy.general.utils.UserInfoUtils; import com.thhy.secure.modules.biz.regionHazardInform.dto.TRegionHazardInformDto; import com.thhy.secure.modules.biz.regionHazardInform.entity.TRegionHazardInformEntity; import com.thhy.secure.modules.biz.regionHazardInform.mapper.TRegionHazardInformMapper; import com.thhy.secure.modules.biz.regionHazardInform.service.TRegionHazardInformService; import org.checkerframework.checker.units.qual.A; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * @Author QiuYuHao * @CreateDate 2023-09-26 13:44:04 * 危险告知源逻辑实现 */ @Service public class TRegionHazardInformServiceImpl implements TRegionHazardInformService { @Autowired private TRegionHazardInformMapper tRegionHazardInformMapper; @Override public BasicResult findAll(TRegionHazardInformDto tRegionHazardInformDto) { SysUserInfo userInfo = UserInfoUtils.getInstance().getUserInfo(); tRegionHazardInformDto.setCompanyId(userInfo.getCompanyId()); PageHelper.startPage(tRegionHazardInformDto.getPageNum(), tRegionHazardInformDto.getPageSize()); List<TRegionHazardInformEntity> all = this.tRegionHazardInformMapper.findAll(tRegionHazardInformDto); PageInfo<TRegionHazardInformEntity> pageInfo = new PageInfo<>(all); return BasicResult.success(pageInfo); } @Override public BasicResult findEntity(String id) { TRegionHazardInformEntity entity = this.tRegionHazardInformMapper.findEntity(id); return BasicResult.success(entity); } @Override public BasicResult insert(TRegionHazardInformEntity tRegionHazardInformEntity) { SysUserInfo userInfo = UserInfoUtils.getInstance().getUserInfo(); tRegionHazardInformEntity.setCompanyId(userInfo.getCompanyId()); tRegionHazardInformEntity.setCreateUser(userInfo.getRealName()); this.tRegionHazardInformMapper.insert(tRegionHazardInformEntity); return BasicResult.success(); } @Override public BasicResult update(TRegionHazardInformEntity tRegionHazardInformEntity) { this.tRegionHazardInformMapper.update(tRegionHazardInformEntity); return BasicResult.success(); } @Override public BasicResult delete(String id) { this.tRegionHazardInformMapper.delete(id); return BasicResult.success(); } } hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionWarranty/controller/TRegionWarrantyController.java
对比新文件 @@ -0,0 +1,48 @@ package com.thhy.secure.modules.biz.regionWarranty.controller; import com.thhy.general.common.BasicResult; import com.thhy.secure.modules.biz.regionWarranty.dto.TRegionWarrantyDto; import com.thhy.secure.modules.biz.regionWarranty.entity.TRegionWarrantyEntity; import com.thhy.secure.modules.biz.regionWarranty.service.TRegionWarrantyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** * @Author QiuYuHao * @CreateDate 2023-09-26 14:20:54 * 区域包保控制层 */ @RestController @RequestMapping(value = "tRegionWarranty") public class TRegionWarrantyController { @Autowired private TRegionWarrantyService tRegionWarrantyService; @PostMapping(value = "insert") BasicResult insert(@RequestBody TRegionWarrantyEntity tRegionWarrantyEntity){ return tRegionWarrantyService.insert(tRegionWarrantyEntity); } @GetMapping(value = "delete") BasicResult delete(@RequestParam String id){ return tRegionWarrantyService.delete(id); } @PostMapping(value = "update") BasicResult update(@RequestBody TRegionWarrantyEntity tRegionWarrantyEntity){ return tRegionWarrantyService.update(tRegionWarrantyEntity); } @PostMapping(value = "findAll") BasicResult findAll(@RequestBody TRegionWarrantyDto tRegionWarrantyDto){ return tRegionWarrantyService.findAll(tRegionWarrantyDto); } @GetMapping(value = "findEntity") BasicResult findEntity(@RequestParam String id){ return tRegionWarrantyService.findEntity(id); } } hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionWarranty/dto/TRegionWarrantyDto.java
对比新文件 @@ -0,0 +1,15 @@ package com.thhy.secure.modules.biz.regionWarranty.dto; import lombok.Data; /** * @Author QiuYuHao * @CreateDate 2023-09-26 14:22:22 * 区域包保dto */ @Data public class TRegionWarrantyDto { private Integer pageNum; private Integer pageSize; private String regionHazardInformId;//区域名称id } hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionWarranty/entity/TRegionWarrantyEntity.java
对比新文件 @@ -0,0 +1,33 @@ package com.thhy.secure.modules.biz.regionWarranty.entity; import lombok.Data; import java.io.Serializable; import java.util.Date; import java.util.List; /** * @Author QiuYuHao * @CreateDate 2023-09-26 14:28:10 * 区域包保实体 */ @Data public class TRegionWarrantyEntity implements Serializable { private String id; private String regionHazardInformId;//区域id private String region;//区域名称 private String riskSourceSituation;//危险情况 private String countermeasures;//应对措施 private String createUser; private String companyId; private Date createTime; private List<String> leader;//领导id集合 private List<String> staff;//员工id集合 private List<TRegionWarrantyUserEntity> leaderList;//领导集合 private List<TRegionWarrantyUserEntity> staffList;//领导集合 } hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionWarranty/entity/TRegionWarrantyUserEntity.java
对比新文件 @@ -0,0 +1,19 @@ package com.thhy.secure.modules.biz.regionWarranty.entity; import com.thhy.general.annotations.Idkey; import lombok.Data; /** * @Author QiuYuHao * @CreateDate 2023-09-26 14:39:29 * 中间表 */ @Data public class TRegionWarrantyUserEntity { @Idkey("id") private String id; private String regionWarrantyId;//区域包保表id private Integer userType; private String userId;//1是领导 2是小组成员 private String realName;//姓名 } hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionWarranty/mapper/TRegionWarrantyMapper.java
对比新文件 @@ -0,0 +1,48 @@ package com.thhy.secure.modules.biz.regionWarranty.mapper; import com.thhy.secure.modules.biz.regionWarranty.dto.TRegionWarrantyDto; import com.thhy.secure.modules.biz.regionWarranty.entity.TRegionWarrantyEntity; import com.thhy.secure.modules.biz.regionWarranty.entity.TRegionWarrantyUserEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; /** * @Author QiuYuHao * @CreateDate 2023-09-26 14:38:26 * 区域包保mapper */ @Mapper public interface TRegionWarrantyMapper { void insert(TRegionWarrantyEntity tRegionWarrantyEntity); /** * 添加中间表 * @param tRegionWarrantyUserEntity */ void insertMiddleTable(TRegionWarrantyUserEntity tRegionWarrantyUserEntity); void delete(String id); /** * 删除中间表 * @param id */ void deleteMiddleTable(String id); void update(TRegionWarrantyEntity tRegionWarrantyEntity); List<TRegionWarrantyEntity> findAll(TRegionWarrantyDto tRegionWarrantyDto); TRegionWarrantyEntity findEntity(String id); /** * 查询中间表 * @param regionWarrantyId * @param userType * @return */ List<TRegionWarrantyUserEntity> findMiddleTable(@Param("regionWarrantyId") String regionWarrantyId, @Param("userType") Integer userType); } hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionWarranty/service/TRegionWarrantyService.java
对比新文件 @@ -0,0 +1,24 @@ package com.thhy.secure.modules.biz.regionWarranty.service; import com.thhy.general.common.BasicResult; import com.thhy.secure.modules.biz.regionWarranty.dto.TRegionWarrantyDto; import com.thhy.secure.modules.biz.regionWarranty.entity.TRegionWarrantyEntity; import com.thhy.secure.modules.biz.regionWarranty.entity.TRegionWarrantyUserEntity; import java.util.List; /** * @Author QiuYuHao * @CreateDate 2023-09-26 14:48:39 * 区域包保interface */ public interface TRegionWarrantyService { BasicResult insert(TRegionWarrantyEntity tRegionWarrantyEntity); BasicResult delete(String id); BasicResult update(TRegionWarrantyEntity tRegionWarrantyEntity); BasicResult findAll(TRegionWarrantyDto tRegionWarrantyDto); BasicResult findEntity(String id); } hd/pipe/secure/src/main/java/com/thhy/secure/modules/biz/regionWarranty/service/impl/TRegionWarrantyServiceImpl.java
对比新文件 @@ -0,0 +1,111 @@ package com.thhy.secure.modules.biz.regionWarranty.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.thhy.general.common.BasicResult; import com.thhy.general.utils.UUIDUtils; import com.thhy.secure.modules.biz.regionWarranty.dto.TRegionWarrantyDto; import com.thhy.secure.modules.biz.regionWarranty.entity.TRegionWarrantyEntity; import com.thhy.secure.modules.biz.regionWarranty.entity.TRegionWarrantyUserEntity; import com.thhy.secure.modules.biz.regionWarranty.mapper.TRegionWarrantyMapper; import com.thhy.secure.modules.biz.regionWarranty.service.TRegionWarrantyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; /** * @Author QiuYuHao * @CreateDate 2023-09-26 14:49:45 * 区域包保实现 */ @Service public class TRegionWarrantyServiceImpl implements TRegionWarrantyService { @Autowired private TRegionWarrantyMapper tRegionWarrantyMapper; @Override public BasicResult insert(TRegionWarrantyEntity tRegionWarrantyEntity) { String id = UUIDUtils.create();// tRegionWarrantyEntity.setId(id); tRegionWarrantyMapper.insert(tRegionWarrantyEntity); //新增领导 List<String> leader = tRegionWarrantyEntity.getLeader(); leader.forEach(s->{ TRegionWarrantyUserEntity t = new TRegionWarrantyUserEntity(); t.setRegionWarrantyId(id); t.setUserId(s); t.setUserType(1); tRegionWarrantyMapper.insertMiddleTable(t); }); //员工 List<String> staff = tRegionWarrantyEntity.getStaff(); staff.forEach(s -> { TRegionWarrantyUserEntity t = new TRegionWarrantyUserEntity(); t.setRegionWarrantyId(id); t.setUserId(s); t.setUserType(2); tRegionWarrantyMapper.insertMiddleTable(t); }); return BasicResult.success(); } @Override public BasicResult delete(String id) { tRegionWarrantyMapper.delete(id); tRegionWarrantyMapper.deleteMiddleTable(id); return BasicResult.success(); } @Override public BasicResult update(TRegionWarrantyEntity tRegionWarrantyEntity) { tRegionWarrantyMapper.deleteMiddleTable(tRegionWarrantyEntity.getId()); //领导 List<String> leader = tRegionWarrantyEntity.getLeader(); leader.forEach(s->{ TRegionWarrantyUserEntity t = new TRegionWarrantyUserEntity(); t.setRegionWarrantyId(tRegionWarrantyEntity.getId()); t.setUserId(s); t.setUserType(1); tRegionWarrantyMapper.insertMiddleTable(t); }); //员工 List<String> staff = tRegionWarrantyEntity.getStaff(); staff.forEach(s -> { TRegionWarrantyUserEntity t = new TRegionWarrantyUserEntity(); t.setRegionWarrantyId(tRegionWarrantyEntity.getId()); t.setUserId(s); t.setUserType(2); tRegionWarrantyMapper.insertMiddleTable(t); }); tRegionWarrantyMapper.update(tRegionWarrantyEntity); return null; } @Override public BasicResult findAll(TRegionWarrantyDto tRegionWarrantyDto) { PageHelper.startPage(tRegionWarrantyDto.getPageNum(), tRegionWarrantyDto.getPageSize()); List<TRegionWarrantyEntity> all = tRegionWarrantyMapper.findAll(tRegionWarrantyDto); all.forEach(tRegionWarrantyEntity -> { tRegionWarrantyEntity.setLeaderList(tRegionWarrantyMapper.findMiddleTable(tRegionWarrantyEntity.getId(),1)); tRegionWarrantyEntity.setStaffList(tRegionWarrantyMapper.findMiddleTable(tRegionWarrantyEntity.getId(),2)); }); PageInfo<TRegionWarrantyEntity> info = new PageInfo(all); return BasicResult.success(info); } @Override public BasicResult findEntity(String id) { TRegionWarrantyEntity entity = tRegionWarrantyMapper.findEntity(id); List<TRegionWarrantyUserEntity> leaderList = tRegionWarrantyMapper.findMiddleTable(id,1); entity.setLeaderList(leaderList); List<TRegionWarrantyUserEntity> staffList= tRegionWarrantyMapper.findMiddleTable(id,2); entity.setStaffList(staffList); return BasicResult.success(entity); } } hd/pipe/secure/src/main/resources/mapping/TRegionHazardInformMapper.xml
对比新文件 @@ -0,0 +1,125 @@ <?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.thhy.secure.modules.biz.regionHazardInform.mapper.TRegionHazardInformMapper"> <resultMap id="BaseResultMap" type="com.thhy.secure.modules.biz.regionHazardInform.entity.TRegionHazardInformEntity"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. This element was generated on Fri Jun 02 10:07:36 CST 2023. --> <id column="id" jdbcType="VARCHAR" property="id" /> <result column="region" jdbcType="VARCHAR" property="region" /> <result column="level" jdbcType="INTEGER" property="level" /> <result column="region_color" jdbcType="VARCHAR" property="regionColor" /> <result column="company_id" jdbcType="VARCHAR" property="companyId" /> <result column="create_user" jdbcType="VARCHAR" property="createUser" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> </resultMap> <insert id="insert" > insert into t_region_hazard_inform <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null"> id, </if> <if test="region != null"> region, </if> <if test="level != null"> `level`, </if> <if test="regionColor != null"> region_color, </if> <if test="createTime != null"> create_time, </if> <if test="createUser != null"> create_user, </if> <if test="companyId != null"> company_id, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null"> #{id,jdbcType=VARCHAR}, </if> <if test="region != null"> #{region,jdbcType=VARCHAR}, </if> <if test="level != null"> #{level,jdbcType=INTEGER}, </if> <if test="regionColor != null"> #{regionColor,jdbcType=VARCHAR}, </if> <if test="createTime != null"> #{createTime,jdbcType=TIMESTAMP}, </if> <if test="createUser != null"> #{createUser,jdbcType=VARCHAR}, </if> <if test="companyId != null"> #{companyId,jdbcType=VARCHAR}, </if> </trim> </insert> <select id="findAll" parameterType="com.thhy.secure.modules.biz.regionHazardInform.dto.TRegionHazardInformDto" resultMap="BaseResultMap"> SELECT id, region, `level`, region_color, company_id, create_user, create_time, is_use FROM t_region_hazard_inform WHERE is_use = 1 <if test="companyId!=null and companyId!='' "> and company_id=#{companyId} </if> <if test="level!=null and level!='' "> and `level`=#{level} </if> order by create_time desc </select> <select id="findEntity" parameterType="java.lang.String" resultType="com.thhy.secure.modules.biz.regionHazardInform.entity.TRegionHazardInformEntity"> SELECT id, region, `level`, region_color, company_id, create_user, create_time, is_use FROM t_region_hazard_inform WHERE is_use = 1 and id = #{id,jdbcType=VARCHAR} </select> <update id="update"> update t_region_hazard_inform <set> <if test="level != null"> level = #{level,jdbcType=INTEGER}, </if> <if test="region != null"> region = #{region,jdbcType=VARCHAR}, </if> <if test="regionColor != null"> region_color = #{regionColor,jdbcType=VARCHAR}, </if> </set> where id = #{id,jdbcType=VARCHAR} </update> <delete id="delete"> update t_region_hazard_inform set is_use = 2 where id = #{id,jdbcType=VARCHAR} </delete> </mapper> hd/pipe/secure/src/main/resources/mapping/TRegionWarrantyMapper.xml
对比新文件 @@ -0,0 +1,168 @@ <?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.thhy.secure.modules.biz.regionWarranty.mapper.TRegionWarrantyMapper"> <resultMap id="com.thhy.secure.modules.biz.regionWarranty.entity.TRegionWarrantyEntity" type="com.thhy.secure.modules.biz.regionWarranty.entity.TRegionWarrantyEntity"> <result column="region" jdbcType="VARCHAR" property="region" /> <result column="region_hazard_inform_id" jdbcType="VARCHAR" property="regionHazardInformId" /> <result column="risk_source_situation" jdbcType="VARCHAR" property="riskSourceSituation" /> <result column="countermeasures" jdbcType="VARCHAR" property="countermeasures" /> <result column="company_id" jdbcType="VARCHAR" property="companyId" /> <result column="create_user" jdbcType="VARCHAR" property="createUser" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> </resultMap> <insert id="insert" > insert into t_region_warranty <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null"> id, </if> <if test="regionHazardInformId != null"> region_hazard_inform_id, </if> <if test="riskSourceSituation != null"> risk_source_situation, </if> <if test="countermeasures != null"> countermeasures, </if> <if test="createTime != null"> create_time, </if> <if test="createUser != null"> create_user, </if> <if test="companyId != null"> company_id, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null"> #{id,jdbcType=VARCHAR}, </if> <if test="regionHazardInformId != null"> #{regionHazardInformId,jdbcType=VARCHAR}, </if> <if test="riskSourceSituation != null"> #{riskSourceSituation,jdbcType=VARCHAR}, </if> <if test="countermeasures != null"> #{countermeasures,jdbcType=VARCHAR}, </if> <if test="createTime != null"> #{createTime,jdbcType=TIMESTAMP}, </if> <if test="createUser != null"> #{createUser,jdbcType=VARCHAR}, </if> <if test="companyId != null"> #{companyId,jdbcType=VARCHAR}, </if> </trim> </insert> <select id="findAll" parameterType="com.thhy.secure.modules.biz.regionWarranty.dto.TRegionWarrantyDto" resultMap="com.thhy.secure.modules.biz.regionWarranty.entity.TRegionWarrantyEntity"> SELECT a.id, a.region_hazard_inform_id regionHazardInformId, a.risk_source_situation riskSourceSituation, a.countermeasures countermeasures, a.create_time createTime, a.create_user createUser, b.region FROM t_region_warranty a LEFT JOIN t_region_hazard_inform b ON b.id = a.region_hazard_inform_id WHERE is_use = 1 <if test="companyId!=null and companyId!='' "> and a.company_id=#{companyId} </if> <if test="regionHazardInformId!=null and regionHazardInformId!='' "> and b.id = #{regionHazardInformId} </if> order by a.create_time desc </select> <select id="findEntity" parameterType="java.lang.String" resultType="com.thhy.secure.modules.biz.regionWarranty.entity.TRegionWarrantyEntity"> SELECT a.id, a.region_hazard_inform_id regionHazardInformId, a.risk_source_situation riskSourceSituation, a.countermeasures countermeasures, a.create_time createTime, a.create_user createUser, b.region FROM t_region_warranty a LEFT JOIN t_region_hazard_inform b ON b.id = a.region_hazard_inform_id WHERE is_use = 1 and a.id = #{id,jdbcType=VARCHAR} </select> <update id="update"> update t_region_warranty <set> <if test="regionHazardInformId != null"> #{regionHazardInformId,jdbcType=VARCHAR}, </if> <if test="riskSourceSituation != null"> #{riskSourceSituation,jdbcType=VARCHAR}, </if> <if test="countermeasures != null"> #{countermeasures,jdbcType=VARCHAR}, </if> </set> where id = #{id,jdbcType=VARCHAR} </update> <delete id="delete"> update t_region_warranty set is_use = 2 where id = #{id,jdbcType=VARCHAR} </delete> <insert id="insertMiddleTable" > insert into t_region_warranty_user <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null"> id, </if> <if test="regionWarrantyId != null"> region_warranty_id, </if> <if test="userType != null"> user_type, </if> <if test="userId != null"> user_id, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null"> #{id}, </if> <if test="regionWarrantyId != null"> #{regionWarrantyId}, </if> <if test="userType != null"> #{userType}, </if> <if test="userId != null"> #{userId}, </if> </trim> </insert> <delete id="deleteMiddleTable"> delete from t_region_warranty_user where region_warranty_id = #{id,jdbcType=VARCHAR} </delete> <select id="findMiddleTable" parameterType="java.lang.String" resultType="com.thhy.secure.modules.biz.regionWarranty.entity.TRegionWarrantyUserEntity"> SELECT a.id, a.region_warranty_id regionWarrantyId, a.user_id userId, a.user_type userType, b.real_name as realName FROM t_region_warranty_user a LEFT JOIN sys_plat_user b ON b.user_id = a.user_id WHERE a.region_warranty_id = #{regionWarrantyId} and a.user_type = #{userType} </select> </mapper>