张磊磊
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
<?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>
</mapper>