邱宇豪
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?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.TBigOverhaulMapper">
  <resultMap id="BaseResultMap" type="com.thhy.engineering.modules.biz.device.entity.TBigOverhaul">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue May 16 19:57:45 CST 2023.
    -->
    <id column="big_overhaul_id" jdbcType="VARCHAR" property="bigOverhaulId" />
    <result column="big_device_id" jdbcType="VARCHAR" property="bigDeviceId" />
    <result column="str_time" jdbcType="TIMESTAMP" property="strTime" />
    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
    <result column="effect_num" jdbcType="VARCHAR" property="effectNum" />
    <result column="consume_cost" jdbcType="VARCHAR" property="consumeCost" />
    <result column="is_use" jdbcType="INTEGER" property="isUse" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="create_user" jdbcType="VARCHAR" property="createUser" />
  </resultMap>
 
  <insert id="overhaulInsert">
    insert into t_big_overhaul
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="bigOverhaulId != null">
        big_overhaul_id,
      </if>
      <if test="bigDeviceId != null">
        big_device_id,
      </if>
      <if test="strTime != null">
        str_time,
      </if>
      <if test="endTime != null">
        end_time,
      </if>
      <if test="effectNum != null">
        effect_num,
      </if>
      <if test="consumeCost != null">
        consume_cost,
      </if>
      <if test="isUse != null">
        is_use,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="notes != null">
        notes,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="bigOverhaulId != null">
        #{bigOverhaulId,jdbcType=VARCHAR},
      </if>
      <if test="bigDeviceId != null">
        #{bigDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="strTime != null">
        #{strTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="effectNum != null">
        #{effectNum,jdbcType=VARCHAR},
      </if>
      <if test="consumeCost != null">
        #{consumeCost,jdbcType=VARCHAR},
      </if>
      <if test="isUse != null">
        #{isUse,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="notes != null">
        #{notes,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
 
  <select id="overhaulList"  resultType="com.thhy.engineering.modules.biz.device.entity.TBigOverhaul">
        SELECT
    tbo.big_overhaul_id as bigOverhaulId,
    tbo.big_device_id as bigDeviceId,
    tbo.str_time as strTime,
    tbo.end_time as endTime,
    tbo.effect_num as effectNum,
    tbo.consume_cost as consumeCost,
    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,
    tbo.notes as notes
FROM
    t_big_overhaul tbo
    LEFT JOIN t_big_device tbd ON tbo.big_device_id = tbd.big_device_id
    left join sys_dict sd on tbd.big_type=sd.dict_id
    where tbo.is_use=1
    <if test="companyId!=null and companyId!='' ">
      and tbd.company_id=#{companyId}
    </if>
    <if test="bigDeviceId!=null and bigDeviceId!='' ">
      and tbo.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="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
        and ((tbo.str_time between #{strTime} and #{endTime}) or (tbo.end_time between #{strTime} and #{endTime}) )
    </if>
    order by tbo.create_time desc
  </select>
  <select id="overhaulInfo" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.device.entity.TBigOverhaul">
        SELECT
    tbo.big_overhaul_id as bigOverhaulId,
    tbo.big_device_id as bigDeviceId,
    tbo.str_time as strTime,
    tbo.end_time as endTime,
    tbo.effect_num as effectNum,
    tbo.consume_cost as consumeCost,
    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,
    tbo.notes as notes
FROM
    t_big_overhaul tbo
    LEFT JOIN t_big_device tbd ON tbo.big_device_id = tbd.big_device_id
    left join sys_dict sd on tbd.big_type=sd.dict_id
    where tbo.is_use=1 and tbo.big_overhaul_id=#{bigOverhaulId}
  </select>
  <update id="overhaulDel" parameterType="java.lang.String">
    update t_big_overhaul set
    is_use=2
    where  big_overhaul_id=#{bigOverhaulId}
  </update>
  <update id="overhaulUpdate" >
    update t_big_overhaul
    <set>
      <if test="bigDeviceId != null">
        big_device_id = #{bigDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="strTime != null">
        str_time = #{strTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        end_time = #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="effectNum != null">
        effect_num = #{effectNum,jdbcType=VARCHAR},
      </if>
      <if test="consumeCost != null">
        consume_cost = #{consumeCost,jdbcType=VARCHAR},
      </if>
      <if test="isUse != null">
        is_use = #{isUse,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="notes != null">
        notes = #{notes,jdbcType=VARCHAR},
      </if>
    </set>
    where big_overhaul_id = #{bigOverhaulId,jdbcType=VARCHAR}
  </update>
  <insert id="overhaulPathInsert" >
    insert into t_big_overhaul_path
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="overhaulPathId != null">
        overhaul_path_id,
      </if>
      <if test="bigOverhaulId != null">
        big_overhaul_id,
      </if>
      <if test="overhaulPath != null">
        overhaul_path,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="overhaulPathId != null">
        #{overhaulPathId,jdbcType=VARCHAR},
      </if>
      <if test="bigOverhaulId != null">
        #{bigOverhaulId,jdbcType=VARCHAR},
      </if>
      <if test="overhaulPath != null">
        #{overhaulPath,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="overhaulPath" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.device.entity.TBigOverhaulPath">
        select
        overhaul_path_id as overhaulPathId,
        big_overhaul_id as bigOverhaulId,
        overhaul_path as overhaulPath
        from t_big_overhaul_path where  big_overhaul_id=#{bigOverhaulId}
  </select>
  <delete id="overhaulPathDel" parameterType="java.lang.String">
    delete from t_big_overhaul_path where  big_overhaul_id=#{bigOverhaulId}
  </delete>
</mapper>