邱宇豪
2023-11-01 9100d3fa53c50ba5c5ca3972724a9f8ad905eea0
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
199
200
<?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.TBigMaintenanceMapper">
  <resultMap id="BaseResultMap" type="com.thhy.engineering.modules.biz.device.entity.TBigMaintenance">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue May 16 13:08:23 CST 2023.
    -->
    <id column="big_maintenance_id" jdbcType="VARCHAR" property="bigMaintenanceId" />
    <result column="maintenance_number" jdbcType="VARCHAR" property="maintenanceNumber" />
    <result column="maintenance_time" jdbcType="TIMESTAMP" property="maintenanceTime" />
    <result column="responsibility_people" jdbcType="VARCHAR" property="responsibilityPeople" />
    <result column="responsibility_phone" jdbcType="VARCHAR" property="responsibilityPhone" />
    <result column="situation" jdbcType="VARCHAR" property="situation" />
    <result column="maintenance_notes" jdbcType="VARCHAR" property="maintenanceNotes" />
    <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>
 
 
  <select id="maintenanceByOne" parameterType="java.lang.String" resultType="java.lang.String">
    select big_maintenance_id from  t_big_maintenance where is_use=1
    and maintenance_number=#{maintenanceNumber}
  </select>
  
  <insert id="maintenanceInsert" >
    insert into t_big_maintenance
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="bigMaintenanceId != null">
        big_maintenance_id,
      </if>
      <if test="maintenanceNumber != null">
        maintenance_number,
      </if>
      <if test="maintenanceTime != null">
        maintenance_time,
      </if>
      <if test="responsibilityPeople != null">
        responsibility_people,
      </if>
      <if test="responsibilityPhone != null">
        responsibility_phone,
      </if>
      <if test="situation != null">
        situation,
      </if>
      <if test="maintenanceNotes != null">
        maintenance_notes,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="isUse != null">
        is_use,
      </if>
      <if test="bigDeviceId != null">
        big_device_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="bigMaintenanceId != null">
        #{bigMaintenanceId,jdbcType=VARCHAR},
      </if>
      <if test="maintenanceNumber != null">
        #{maintenanceNumber,jdbcType=VARCHAR},
      </if>
      <if test="maintenanceTime != null">
        #{maintenanceTime,jdbcType=TIMESTAMP},
      </if>
      <if test="responsibilityPeople != null">
        #{responsibilityPeople,jdbcType=VARCHAR},
      </if>
      <if test="responsibilityPhone != null">
        #{responsibilityPhone,jdbcType=VARCHAR},
      </if>
      <if test="situation != null">
        #{situation,jdbcType=VARCHAR},
      </if>
      <if test="maintenanceNotes != null">
        #{maintenanceNotes,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>
      <if test="bigDeviceId != null">
        #{bigDeviceId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="maintenanceList" resultType="com.thhy.engineering.modules.biz.device.entity.TBigMaintenance">
        SELECT
    tbm.big_maintenance_id as bigMaintenanceId,
    tbm.maintenance_number as maintenanceNumber,
    tbm.maintenance_time as maintenanceTime,
    tbm.responsibility_people as responsibilityPeople,
    tbm.responsibility_phone as responsibilityPhone,
    tbm.situation as situation,
    tbm.maintenance_notes as maintenanceNotes,
    tbm.big_device_id as bigDeviceId,
    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 bigTypeName,
    spu.real_name as realName,
    tbm.create_time as createTime
FROM
    t_big_maintenance tbm
    LEFT JOIN t_big_device tbd ON tbm.big_device_id = tbd.big_device_id
    left join sys_dict sd on tbd.big_type=sd.dict_id
    left join  sys_plat_user spu on tbm.responsibility_people=spu.user_id
    where  tbm.is_use=1
    <if test="companyId!=null and companyId!='' ">
      and tbd.company_id=#{companyId}
    </if>
    <if test="bigDeviceId!=null and bigDeviceId!='' ">
      and tbm.big_device_id=#{bigDeviceId}
    </if>
    <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
      and tbm.maintenance_time between #{strTime} and #{endTime}
    </if>
    order by  tbm.create_time desc
  </select>
  <select id="maintenanceInfo" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.device.entity.TBigMaintenance">
        SELECT
    tbm.big_maintenance_id as bigMaintenanceId,
    tbm.maintenance_number as maintenanceNumber,
    tbm.maintenance_time as maintenanceTime,
    tbm.responsibility_people as responsibilityPeople,
    tbm.responsibility_phone as responsibilityPhone,
    tbm.situation as situation,
    tbm.maintenance_notes as maintenanceNotes,
    tbm.big_device_id as bigDeviceId,
    tbd.big_device_name as bigDeviceName,
    tbd.big_device_id as bigDeviceId,
    tbd.big_device_model as bigDeviceModel,
    tbd.big_number as bigNumber,
    tbd.big_type as  bigType,
    sd.dict_name as bigTypeName,
    spu.real_name as realName
FROM
    t_big_maintenance tbm
    LEFT JOIN t_big_device tbd ON tbm.big_device_id = tbd.big_device_id
    left join sys_dict sd on tbd.big_type=sd.dict_id
    left join sys_plat_user spu on tbm.responsibility_people=spu.user_id
    where  tbm.is_use=1 and tbm.big_maintenance_id=#{bigMaintenanceId}
  </select>
  <update id="maintenanceDel" parameterType="java.lang.String">
    update  t_big_maintenance set
    is_use=2
    where big_maintenance_id=#{bigMaintenanceId}
  </update>
  <update id="maintenanceUpdate" >
    update t_big_maintenance
    <set>
      <if test="maintenanceNumber != null">
        maintenance_number = #{maintenanceNumber,jdbcType=VARCHAR},
      </if>
      <if test="maintenanceTime != null">
        maintenance_time = #{maintenanceTime,jdbcType=TIMESTAMP},
      </if>
      <if test="responsibilityPeople != null">
        responsibility_people = #{responsibilityPeople,jdbcType=VARCHAR},
      </if>
      <if test="responsibilityPhone != null">
        responsibility_phone = #{responsibilityPhone,jdbcType=VARCHAR},
      </if>
      <if test="situation != null">
        situation = #{situation,jdbcType=VARCHAR},
      </if>
      <if test="maintenanceNotes != null">
        maintenance_notes = #{maintenanceNotes,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>
      <if test="bigDeviceId != null">
        big_device_id = #{bigDeviceId,jdbcType=INTEGER},
      </if>
    </set>
    where big_maintenance_id = #{bigMaintenanceId,jdbcType=VARCHAR}
  </update>
</mapper>