张磊磊
2023-11-14 322aaa6fa1bbfb406263d93241723797b98420f7
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?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.TMaterialReleaseMappper">
  <resultMap id="BaseResultMap" type="com.thhy.materials.modules.biz.concret.entity.TMaterialRelease">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Sep 15 10:50:37 CST 2023.
    -->
    <id column="material_release_id" jdbcType="VARCHAR" property="materialReleaseId" />
    <result column="material_release_time" jdbcType="VARCHAR" property="materialReleaseTime" />
    <result column="create_user" jdbcType="VARCHAR" property="createUser" />
    <result column="quantity" jdbcType="DOUBLE" property="quantity" />
    <result column="company_id" jdbcType="VARCHAR" property="companyId" />
  </resultMap>
 
  <insert id="materialReleaseInsert" useGeneratedKeys="true" keyProperty="materialReleaseId" parameterType="java.util.Map">
    insert into t_material_release
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="materialReleaseId != null">
        material_release_id,
      </if>
      <if test="materialReleaseTime != null">
        material_release_time,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="quantity != null">
        quantity,
      </if>
      <if test="companyId != null">
        company_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="materialReleaseId != null">
        #{materialReleaseId,jdbcType=VARCHAR},
      </if>
      <if test="materialReleaseTime != null">
        #{materialReleaseTime,jdbcType=VARCHAR},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="quantity != null">
        #{quantity,jdbcType=DOUBLE},
      </if>
      <if test="companyId != null">
        #{companyId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
 
  <insert id="releaseDataInsert" >
    insert into t_release_data
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="releaseDataId != null">
        release_data_id,
      </if>
      <if test="materialReleaseId != null">
        material_release_id,
      </if>
      <if test="dictId != null">
        dict_id,
      </if>
      <if test="releaseData != null">
        release_data,
      </if>
      <if test="releaseType != null">
        release_type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="releaseDataId != null">
        #{releaseDataId,jdbcType=VARCHAR},
      </if>
      <if test="materialReleaseId != null">
        #{materialReleaseId,jdbcType=VARCHAR},
      </if>
      <if test="dictId != null">
        #{dictId,jdbcType=VARCHAR},
      </if>
      <if test="releaseData != null">
        #{releaseData},
      </if>
      <if test="releaseType != null">
        #{releaseType,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
 
  <select id="materialReleaseList" resultType="com.thhy.materials.modules.biz.concret.entity.TMaterialRelease">
 
        select
    material_release_id as materialReleaseId,
    material_release_time as materialReleaseTime,
    quantity as quantity
        from
        t_material_release
        where is_use=1
        <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
            and material_release_time between #{strTime} and #{endTime}
        </if>
        order by material_release_time desc
  </select>
 
  <select id="materialDataList" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.concret.entity.TReleaseData" >
        select
         dict_id as dictId,
        -- FORMAT(release_data, 4) as releaseData,
         release_data as releaseData,
         release_type as releaseType
         from t_release_data
        where
        material_release_id =#{materialReleaseId}
        order by release_type asc
  </select>
 
  <update id="materialReleaseUpdate" >
    update t_material_release
    <set>
      <if test="materialReleaseTime != null">
        material_release_time = #{materialReleaseTime,jdbcType=VARCHAR},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="quantity != null">
        quantity = #{quantity,jdbcType=DOUBLE},
      </if>
      <if test="companyId != null">
        company_id = #{companyId,jdbcType=VARCHAR},
      </if>
    </set>
    where material_release_id = #{materialReleaseId,jdbcType=VARCHAR}
  </update>
 
  <delete id="releaseDataDel" parameterType="java.lang.String">
     delete from t_release_data
    where material_release_id = #{materialReleaseId,jdbcType=VARCHAR}
  </delete>
 
  <update id="materialReleaseDel" parameterType="java.lang.String">
    update t_material_release set
    is_use=2
    where material_release_id=#{materialReleaseId}
  </update>
  <select id="pieceList" resultType="com.thhy.materials.modules.biz.concret.entity.dto.PieceDto">
    select by_id as byId from  t_piece
    where 1=1
    <if test="byId!=null and byId!='' ">
      and by_id=#{byId}
    </if>
    ORDER BY  by_id desc
  </select>
  <select id="materialRew" resultType="com.thhy.materials.modules.biz.concret.entity.TRawMaterial">
    select Storage as storage,
    Material as material,
    RecAmnt as recamnt,
    PlanAmnt as planamnt,
    FactAmnt as factamnt
     from  t_raw_material
    where  Piece=#{byId}
  </select>
  <insert id="mixingInsert" >
    insert into t_mixing
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="mixingId != null">
        mixing_id,
      </if>
      <if test="material != null">
        material,
      </if>
      <if test="spec != null">
        spec,
      </if>
      <if test="producer != null">
        producer,
      </if>
      <if test="stove != null">
        stove,
      </if>
      <if test="inNum != null">
        in_num,
      </if>
      <if test="inDate != null">
        in_date,
      </if>
      <if test="inspectState != null">
        inspect_state,
      </if>
      <if test="reportNumber != null">
        report_number,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="mixingId != null">
        #{mixingId,jdbcType=VARCHAR},
      </if>
      <if test="material != null">
        #{material,jdbcType=VARCHAR},
      </if>
      <if test="spec != null">
        #{spec,jdbcType=VARCHAR},
      </if>
      <if test="producer != null">
        #{producer,jdbcType=VARCHAR},
      </if>
      <if test="stove != null">
        #{stove,jdbcType=VARCHAR},
      </if>
      <if test="inNum != null">
        #{inNum,jdbcType=VARCHAR},
      </if>
      <if test="inDate != null">
        #{inDate,jdbcType=VARCHAR},
      </if>
      <if test="inspectState != null">
        #{inspectState,jdbcType=INTEGER},
      </if>
      <if test="reportNumber != null">
        #{reportNumber,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="mixingList" resultType="com.thhy.materials.modules.biz.concret.entity.TMixing">
        select
        mixing_id as mixingId,
        material as material,
        spec as spec,
        producer as producer,
        stove as stove,
        in_num as inNum,
        in_date as inDate,
        inspect_state as inspectState,
        report_number as reportNumber
        from t_mixing
        order by in_date desc
  </select>
</mapper>