邱宇豪
2023-11-01 21db563b4f218e04cdf07ee442af76d929e8da3a
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?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.engineering.modules.biz.device.mapper.TBigInspectMapper">
  <resultMap id="BaseResultMap" type="com.thhy.engineering.modules.biz.device.entity.TBigInspect">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue May 16 10:15:55 CST 2023.
    -->
    <id column="big_inspect_id" jdbcType="VARCHAR" property="bigInspectId" />
    <result column="big_device_id" jdbcType="VARCHAR" property="bigDeviceId" />
    <result column="inspect_time" jdbcType="TIMESTAMP" property="inspectTime" />
    <result column="inspect_result" jdbcType="VARCHAR" property="inspectResult" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="create_user" jdbcType="VARCHAR" property="createUser" />
    <result column="is_use" jdbcType="INTEGER" property="isUse" />
  </resultMap>
 
  <insert id="bigInspectInsert" >
    insert into t_big_inspect
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="bigInspectId != null">
        big_inspect_id,
      </if>
      <if test="bigDeviceId != null">
        big_device_id,
      </if>
      <if test="inspectTime != null">
        inspect_time,
      </if>
      <if test="inspectResult != null">
        inspect_result,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="isUse != null">
        is_use,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="bigInspectId != null">
        #{bigInspectId,jdbcType=VARCHAR},
      </if>
      <if test="bigDeviceId != null">
        #{bigDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="inspectTime != null">
        #{inspectTime,jdbcType=TIMESTAMP},
      </if>
      <if test="inspectResult != null">
        #{inspectResult,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="isUse != null">
        #{isUse,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
 
  <insert id="bigInspectTypeInsert">
    insert into t_big_inspect_type
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="inspectTypeId != null">
        inspect_type_id,
      </if>
      <if test="bigInspectId != null">
        big_inspect_id,
      </if>
      <if test="typeId != null">
        type_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="inspectTypeId != null">
        #{inspectTypeId,jdbcType=VARCHAR},
      </if>
      <if test="bigInspectId != null">
        #{bigInspectId,jdbcType=VARCHAR},
      </if>
      <if test="typeId != null">
        #{typeId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
 
  <select id="bigInspectList" resultType="com.thhy.engineering.modules.biz.device.entity.TBigInspect">
       SELECT
    tbi.big_inspect_id as bigInspectId,
    tbd.big_device_name as bigDeviceName,
    tbd.big_device_model as bigDeviceModel,
    tbd.big_number as bigNumber,
    tbd.big_type as bigType,
    sd.dict_name as dictName,
    tbd.big_position as bigPosition,
    tbi.inspect_time as inspectTime,
    tbi.inspect_result as inspectResult,
    tbi.create_user as createUser,
    su.real_name as realName
FROM
    t_big_inspect tbi
    LEFT JOIN t_big_device tbd ON tbi.big_device_id = tbd.big_device_id
    LEFT JOIN sys_dict sd ON tbd.big_type = sd.dict_id
    LEFT JOIN sys_users su ON tbi.create_user = su.user_id
    where tbi.is_use=1
    <if test="companyId!=null and companyId!='' ">
        and tbd.company_id=#{companyId}
    </if>
    <if test="bigDeviceId!=null and bigDeviceId!='' ">
        and tbi.big_device_id=#{bigDeviceId}
    </if>
    <if test="bigDeviceName!=null and bigDeviceName!='' ">
      and tbd.big_device_name like concat('%',#{bigDeviceName},'%')
    </if>
    <if test="bigType!=null and bigType!='' ">
      and tbd.big_type=#{bigType}
    </if>
    <if test="inspectResult!=null and inspectResult!='' ">
      and tbi.inspect_result like concat('%',#{inspectResult},'%')
    </if>
    <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
      and tbi.inspect_time between #{strTime} and #{endTime}
    </if>
    order by tbi.create_time desc
  </select>
  <select id="bigInspectInfo" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.device.entity.TBigInspect">
        SELECT
       tbi.big_inspect_id as bigInspectId,
    tbd.big_device_name as bigDeviceName,
    tbd.big_device_model as bigDeviceModel,
    tbd.big_number as bigNumber,
    tbd.big_type as bigType,
    sd.dict_name as dictName,
    tbd.big_position as bigPosition,
    tbi.inspect_time as inspectTime,
    tbi.big_device_id as bigDeviceId,
    tbi.inspect_result as inspectResult,
    tbi.create_user as createUser,
    su.real_name as realName
FROM
    t_big_inspect tbi
    LEFT JOIN t_big_device tbd ON tbi.big_device_id = tbd.big_device_id
    LEFT JOIN sys_dict sd ON tbd.big_type = sd.dict_id
    LEFT JOIN sys_users su ON tbi.create_user = su.user_id
    where tbi.is_use=1 and  tbi.big_inspect_id=#{bigInspectId}
  </select>
 
  <select id="inspectTypes" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.device.entity.TBigInspectType">
        select
         tbit.inspect_type_id as inspectTypeId,
         tbit.big_inspect_id as bigInspectId,
         tbit.type_id as typeId,
         sd.dict_name as typeName
         from t_big_inspect_type
        tbit  left join  sys_dict sd on tbit.type_id=sd.dict_id
        where tbit.big_inspect_id=#{bigInspectId}
  </select>
  <delete id="bigTypeDel" parameterType="java.lang.String">
    delete from t_big_inspect_type where big_inspect_id=#{bigInspectId}
  </delete>
  <update id="bigInspectDel" parameterType="java.lang.String">
    update t_big_inspect set
    is_use=2
    where big_inspect_id=#{bigInspectId}
  </update>
  <update id="bigInspectUpdate">
    update t_big_inspect
    <set>
      <if test="bigDeviceId != null">
        big_device_id = #{bigDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="inspectTime != null">
        inspect_time = #{inspectTime,jdbcType=TIMESTAMP},
      </if>
      <if test="inspectResult != null">
        inspect_result = #{inspectResult,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="isUse != null">
        is_use = #{isUse,jdbcType=INTEGER},
      </if>
    </set>
    where big_inspect_id = #{bigInspectId,jdbcType=VARCHAR}
  </update>
</mapper>