对比新文件 |
| | |
| | | <?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="BaseResultMap" |
| | | 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> |