MaterialMapper.xml
2.01 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
<?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.general.material.mapper.MaterialMapper">
<select id="selectNameBycode" resultType="com.huaheng.pc.general.material.domain.Material">
select name,barcode,masterUnit from material where code = #{code}
</select>
<select id="selectNameByListCode" resultType="com.huaheng.pc.general.material.domain.Material">
select * from material where code in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="selectNameByListUserdef1" resultType="com.huaheng.pc.general.material.domain.Material">
select * from material where userDef1 in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<insert id="insertList" parameterType="com.huaheng.pc.general.material.domain.Material" keyProperty="id" useGeneratedKeys="true" >
INSERT INTO material(
code,
barcode,
name,
warehouseId,
warehouseCode,
companyId,
companyCode,
specification,
masterUnit,
assistUnit,
convertRate,
type,
userDef1,
createdBy,
lastUpdatedBy
)values
<foreach collection="materials" item="item" index="index" separator=",">
(
#{item.code},
#{item.barcode},
#{item.name},
#{item.warehouseId},
#{item.warehouseCode},
#{item.companyId},
#{item.companyCode},
#{item.specification},
#{item.masterUnit},
#{item.assistUnit},
#{item.convertRate},
#{item.type},
#{item.userDef1},
#{item.createdBy},
#{item.lastUpdatedBy}
)
</foreach>
</insert>
</mapper>