邱宇豪
2023-11-07 26d0470f278de9b7094dc0569ce0d741567f2c8c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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.RegionHazardInformMapper">
    <resultMap id="BaseResultMap" type="com.thhy.secure.modules.biz.regionHazardInform.entity.RegionHazardInformEntity">
      <id column="id" jdbcType="VARCHAR" property="id" />
        <result column="region" jdbcType="VARCHAR" property="region" />
        <result column="level_type" jdbcType="INTEGER" property="levelType" />
        <result column="region_color" jdbcType="VARCHAR" property="regionColor" />
        <result column="create_user" jdbcType="VARCHAR" property="createUser" />
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
        <result column="company_id" jdbcType="VARCHAR" property="companyId" />
        <result column="is_use" jdbcType="INTEGER" property="isUse" />
  </resultMap>
  <insert id="insertTRegionHazardInform" >
    insert into t_region_hazard_inform
    <trim prefix="(" suffix=")" suffixOverrides=",">
          <if test="id != null">
              id,
          </if>
          <if test="region != null">
            region,
          </if>
          <if test="levelType != null">
              level_type,
          </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>
        <if test="isUse != null">
            is_use,
        </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="levelType!= null">
            #{levelType,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>
        <if test="isUse != null">
            #{isUse,jdbcType=INTEGER},
        </if>
    </trim>
  </insert>
 
  <select id="findAllRegionHazardInform" parameterType="com.thhy.secure.modules.biz.regionHazardInform.dto.TRegionHazardInformDto" resultType="com.thhy.secure.modules.biz.regionHazardInform.entity.RegionHazardInformEntity">
          SELECT
              id,
              region,
              level_type,
              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="levelType!=null and levelType!='' ">
          and level_type=#{levelType}
        </if>
        order by create_time desc
  </select>
  <select id="findEntity" parameterType="java.lang.String" resultType="com.thhy.secure.modules.biz.regionHazardInform.entity.RegionHazardInformEntity">
      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="levelType != null">
            level_type = #{levelType,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>
    <update id="delete" parameterType="java.lang.String">
        update t_region_hazard_inform set is_use = 2 where id = #{id,jdbcType=VARCHAR}
    </update>
</mapper>