MaterialMapper.xml
8.74 KB
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
<?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.huaheng.pc.config.material.mapper.MaterialMapper">
<resultMap id="BaseResultMap" type="com.huaheng.pc.config.material.domain.Material">
<!--@mbg.generated-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="companyCode" jdbcType="VARCHAR" property="companyCode" />
<result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="spec" jdbcType="VARCHAR" property="spec" />
<result column="unit" jdbcType="VARCHAR" property="unit" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="abcClass" jdbcType="VARCHAR" property="abcClass" />
<result column="daysToExpire" jdbcType="INTEGER" property="daysToExpire" />
<result column="locatingRule" jdbcType="VARCHAR" property="locatingRule" />
<result column="allocationRule" jdbcType="VARCHAR" property="allocationRule" />
<result column="replenishmentRule" jdbcType="VARCHAR" property="replenishmentRule" />
<result column="emptyLocRule" jdbcType="VARCHAR" property="emptyLocRule" />
<result column="receivingFlow" jdbcType="VARCHAR" property="receivingFlow" />
<result column="shippingFlow" jdbcType="VARCHAR" property="shippingFlow" />
<result column="attributeTemplateCode" jdbcType="VARCHAR" property="attributeTemplateCode" />
<result column="trackSerialNum" jdbcType="INTEGER" property="trackSerialNum" />
<result column="autoGenSerialNum" jdbcType="INTEGER" property="autoGenSerialNum" />
<result column="autoGenSerialNumFormat" jdbcType="VARCHAR" property="autoGenSerialNumFormat" />
<result column="snTemplateCode" jdbcType="VARCHAR" property="snTemplateCode" />
<result column="expiringDays" jdbcType="INTEGER" property="expiringDays" />
<result column="minShelfLifeDays" jdbcType="INTEGER" property="minShelfLifeDays" />
<result column="enable" jdbcType="BIT" property="enable" />
<result column="created" jdbcType="TIMESTAMP" property="created" />
<result column="createdBy" jdbcType="VARCHAR" property="createdBy" />
<result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" />
<result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy" />
<result column="version" jdbcType="INTEGER" property="version" />
<result column="userDef1" jdbcType="VARCHAR" property="userDef1" />
<result column="userDef2" jdbcType="VARCHAR" property="userDef2" />
<result column="userDef3" jdbcType="VARCHAR" property="userDef3" />
<result column="userDef4" jdbcType="VARCHAR" property="userDef4" />
<result column="userDef5" jdbcType="VARCHAR" property="userDef5" />
<result column="userDef6" jdbcType="VARCHAR" property="userDef6" />
<result column="userDef7" jdbcType="VARCHAR" property="userDef7" />
<result column="userDef8" jdbcType="VARCHAR" property="userDef8" />
<result column="isMix" jdbcType="BIT" property="isMix" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, code, companyCode, warehouseCode, `name`, spec, unit, `type`, abcClass, daysToExpire,
locatingRule, allocationRule, replenishmentRule, emptyLocRule, receivingFlow, shippingFlow,
attributeTemplateCode, trackSerialNum, autoGenSerialNum, autoGenSerialNumFormat,
snTemplateCode, expiringDays, minShelfLifeDays, `enable`, created, createdBy, lastUpdated,
lastUpdatedBy, version, userDef1, userDef2, userDef3, userDef4, userDef5, userDef6,
userDef7, userDef8, isMix
</sql>
<select id="findAllByCode" resultMap="BaseResultMap" parameterType="java.lang.String">
select * from material where code = #{code,jdbcType=VARCHAR}
</select>
<update id="truncateTable">
truncate table material
</update>
<select id="findLatest" resultMap="BaseResultMap" parameterType="java.lang.String">
select * from material order by id desc limit 10
</select>
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO material
(code,name,spec,unit,type,
created,createdBy,isColor,isMix,
isProPackaging,isLevel,isCustProductSize,
isProductSchedule,isBatchManage,square,pieceWeight,
daysToExpire,trackSerialNum,autoGenSerialNum,minShelfLifeDays,
companyCode,warehouseCode)
VALUES
<foreach collection="list" item="material" separator=",">
(
#{material.code},#{material.name},#{material.spec},#{material.unit},#{material.type},
#{material.created},#{material.createdBy},#{material.isColor},#{material.isMix},#{material.isProPackaging},#{material.isLevel},
#{material.isCustProductSize},#{material.isProductSchedule},#{material.isBatchManage},#{material.square},#{material.pieceWeight},
#{material.daysToExpire},#{material.trackSerialNum},#{material.autoGenSerialNum},#{material.minShelfLifeDays}
,#{material.companyCode},#{material.warehouseCode}
)
</foreach>
</insert>
<update id="modifyById" parameterType="java.util.List">
update material
<trim prefix="set" suffixOverrides=",">
<trim prefix="name =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.name!=null">
when deleted=0 and id=#{item.id}
then #{item.name}
</if>
</foreach>
</trim>
<trim prefix="spec =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.spec!=null">
when deleted=0 and id=#{item.id}
then #{item.spec}
</if>
</foreach>
</trim>
<trim prefix="pieceWeight =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.pieceWeight!=null">
when deleted=0 and id=#{item.id}
then #{item.pieceWeight}
</if>
</foreach>
</trim>
<trim prefix="isProPackaging =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.isProPackaging!=null">
when deleted=0 and id=#{item.id}
then #{item.isProPackaging}
</if>
</foreach>
</trim>
<trim prefix="isColor =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.isColor!=null">
when deleted=0 and id=#{item.id}
then #{item.isColor}
</if>
</foreach>
</trim>
<trim prefix="isLevel =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.isLevel!=null">
when deleted=0 and id=#{item.id}
then #{item.isLevel}
</if>
</foreach>
</trim>
<trim prefix="isCustProductSize =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.isCustProductSize!=null">
when deleted=0 and id=#{item.id}
then #{item.isCustProductSize}
</if>
</foreach>
</trim>
<trim prefix="isProductSchedule =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.isProductSchedule!=null">
when deleted=0 and id=#{item.id}
then #{item.isProductSchedule}
</if>
</foreach>
</trim>
<trim prefix="isBatchManage =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.isBatchManage!=null">
when deleted=0 and id=#{item.id}
then #{item.isBatchManage}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
#{item.id}
</foreach>
</update>
<select id="getWarehourePieData" resultType="com.huaheng.api.tv.domain.ProjectBean">
<![CDATA[select '一个月' name, count(id) nums
from inventory_detail
where to_days(date_format(now(),'%Y-%m-%d')) - TO_DAYS(date_format(created,'%Y-%m-%d')) >=30
UNION
select '三个月' name, count(id) nums
from inventory_detail
where to_days(date_format(now(),'%Y-%m-%d')) - TO_DAYS(date_format(created,'%Y-%m-%d')) >=90
UNION
select '六个月' name, count(id) nums
from inventory_detail
where to_days(date_format(now(),'%Y-%m-%d')) - TO_DAYS(date_format(created,'%Y-%m-%d')) >=180
UNION
select '一年' name, count(id) nums
from inventory_detail
where to_days(date_format(now(),'%Y-%m-%d')) - TO_DAYS(date_format(created,'%Y-%m-%d')) >=360
]]>
</select>
</mapper>