张磊磊
2023-11-08 2b2d292c1a274aa95aab8c2ac20530e54a503923
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
219
220
221
222
223
224
225
<?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.materials.modules.biz.concret.mapper.TSteelConsumptionMapper">
  <resultMap id="BaseResultMap" type="com.thhy.materials.modules.biz.concret.entity.TSteelConsumption">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Apr 18 09:29:47 CST 2023.
    -->
    <id column="consumption_id" jdbcType="VARCHAR" property="consumptionId" />
    <result column="size_id" jdbcType="VARCHAR" property="sizeId" />
    <result column="reinforcement_id" jdbcType="VARCHAR" property="reinforcementId" />
    <result column="block_id" jdbcType="VARCHAR" property="blockId" />
    <result column="pro_id" jdbcType="VARCHAR" property="proId" />
    <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="consumptionInsert" >
    insert into t_steel_consumption
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="consumptionId != null">
        consumption_id,
      </if>
      <if test="sizeId != null">
        size_id,
      </if>
      <if test="reinforcementId != null">
        reinforcement_id,
      </if>
      <if test="blockId != null">
        block_id,
      </if>
      <if test="proId != null">
        pro_id,
      </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="consumptionId != null">
        #{consumptionId,jdbcType=VARCHAR},
      </if>
      <if test="sizeId != null">
        #{sizeId,jdbcType=VARCHAR},
      </if>
      <if test="reinforcementId != null">
        #{reinforcementId,jdbcType=VARCHAR},
      </if>
      <if test="blockId != null">
        #{blockId,jdbcType=VARCHAR},
      </if>
      <if test="proId != null">
        #{proId,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="steelNeedInsert">
    insert into t_steel_need
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="consumptionId != null">
        consumption_id,
      </if>
      <if test="steelId != null">
        steel_id,
      </if>
      <if test="needNum != null">
        need_num,
      </if>
      <if test="coefficient != null">
        coefficient,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id},
      </if>
      <if test="consumptionId != null">
        #{consumptionId,jdbcType=VARCHAR},
      </if>
      <if test="steelId != null">
        #{steelId,jdbcType=VARCHAR},
      </if>
      <if test="needNum != null">
        #{needNum,jdbcType=VARCHAR},
      </if>
      <if test="coefficient != null">
        #{coefficient,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
 
  <select id="consumptionList" resultType="com.thhy.materials.modules.biz.concret.entity.TSteelConsumption">
        select tsc.consumption_id as consumptionId,
         tsc.size_id as sizeId,
         tsc.reinforcement_id as reinforcementId,
         tsc.block_id as blockId,
         tsc.pro_id as proId,
         tsc.create_time as createTime,
        sd.dict_name as sizeName,sdr.dict_name as reinforcementName,
         sdb.dict_name as blockName,sp.pro_name as proName
         from  t_steel_consumption tsc
        left join sys_dict sd on sd.dict_id=tsc.size_id
        left join sys_dict sdr on sdr.dict_id=tsc.reinforcement_id
        left join sys_dict sdb on sdb.dict_id=tsc.block_id
        left join sys_project sp on sp.pro_id=tsc.pro_id
        where tsc.is_use=1
        <if test="proId!=null and proId!='' ">
            and tsc.pro_id=#{proId}
        </if>
        <if test="sizeId!=null and sizeId!='' ">
          and tsc.size_id=#{sizeId}
        </if>
        <if test="reinforcementId!=null and reinforcementId!='' ">
          and tsc.reinforcement_id=#{reinforcementId}
        </if>
        <if test="blockId!=null and blockId!='' ">
          and tsc.block_id=#{blockId}
        </if>
        <if test="companyId!=null and companyId!='' ">
          and sp.company_id=#{companyId}
        </if>
        order by  tsc.create_time desc
  </select>
  <select id="consumptionInfo" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.concret.entity.TSteelConsumption">
    select tsc.consumption_id as consumptionId,
         tsc.size_id as sizeId,
         tsc.reinforcement_id as reinforcementId,
         tsc.block_id as blockId,
         tsc.pro_id as proId,
         tsc.create_time as createTime,
    sd.dict_name as sizeName,sdr.dict_name as reinforcementName,
    sdb.dict_name as blockName,sp.pro_name as proName
    from  t_steel_consumption tsc
    left join sys_dict sd on sd.dict_id=tsc.size_id
    left join sys_dict sdr on sdr.dict_id=tsc.reinforcement_id
    left join sys_dict sdb on sdb.dict_id=tsc.block_id
    left join sys_project sp on sp.pro_id=tsc.pro_id
    where tsc.is_use=1 and tsc.consumption_id=#{consumptionId}
  </select>
 
  <select id="steelNeedList" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.concret.entity.TSteelNeed">
        select
         consumption_id as consumptionId,
         steel_id as steelId,
         need_num as needNum,
         coefficient as coefficient
         from t_steel_need where  consumption_id=#{consumptionId}
  </select>
  <update id="consumptionDel" parameterType="java.lang.String">
    update t_steel_consumption set
    is_use=2
    where  consumption_id=#{consumptionId}
  </update>
  <delete id="consumptionNeedDel" parameterType="java.lang.String">
    delete from t_steel_need where  consumption_id=#{consumptionId}
  </delete>
  <update id="consumptionUpdate">
    update t_steel_consumption
    <set>
      <if test="sizeId != null">
        size_id = #{sizeId,jdbcType=VARCHAR},
      </if>
      <if test="reinforcementId != null">
        reinforcement_id = #{reinforcementId,jdbcType=VARCHAR},
      </if>
      <if test="blockId != null">
        block_id = #{blockId,jdbcType=VARCHAR},
      </if>
      <if test="proId != null">
        pro_id = #{proId,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 consumption_id = #{consumptionId,jdbcType=VARCHAR}
  </update>
 
  <select id="allByOne" resultType="java.lang.String">
    select  consumption_id as consumptionId from t_steel_consumption where is_use=1
    <if test="sizeId!=null and sizeId!='' ">
      and size_id=#{sizeId}
    </if>
    <if test="reinforcementId!=null and reinforcementId!='' ">
      and reinforcement_id=#{reinforcementId}
    </if>
    <if test="blockId!=null and blockId!='' ">
      and block_id=#{blockId}
    </if>
    <if test="proId!=null and proId!='' ">
      and pro_id=#{proId}
    </if>
  </select>
 
  
</mapper>