AfmsInventorySeedPurchaseMapper.xml
3.8 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
<?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.zhonglai.luhui.afms.mapper.AfmsInventorySeedPurchaseMapper">
<resultMap type="AfmsInventorySeedPurchase" id="AfmsInventorySeedPurchaseResult">
<result property="id" column="id" />
<result property="seed_id" column="seed_id" />
<result property="purchase_time" column="purchase_time" />
<result property="quantity" column="quantity" />
<result property="unit_price" column="unit_price" />
<result property="total_price" column="total_price" />
</resultMap>
<sql id="selectAfmsInventorySeedPurchaseVo">
select `id`, `seed_id`, `purchase_time`, `quantity`, `unit_price`, `total_price` from afms_inventory_seed_purchase
</sql>
<select id="selectAfmsInventorySeedPurchaseList" parameterType="AfmsInventorySeedPurchase" resultMap="AfmsInventorySeedPurchaseResult">
<include refid="selectAfmsInventorySeedPurchaseVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="seed_id != null "> and seed_id = #{seed_id}</if>
<if test="params.beginPurchase_time != null and params.beginPurchase_time != '' and params.endPurchase_time != null and params.endPurchase_time != ''"> and purchase_time between #{params.beginPurchase_time} and #{params.endPurchase_time}</if>
<if test="quantity != null "> and quantity = #{quantity}</if>
</where>
</select>
<select id="selectAfmsInventorySeedPurchaseById" parameterType="Integer" resultMap="AfmsInventorySeedPurchaseResult">
<include refid="selectAfmsInventorySeedPurchaseVo"/>
where id = #{id}
</select>
<insert id="insertAfmsInventorySeedPurchase" parameterType="AfmsInventorySeedPurchase" useGeneratedKeys="true" keyProperty="id">
insert into afms_inventory_seed_purchase
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="seed_id != null">seed_id,</if>
<if test="purchase_time != null">purchase_time,</if>
<if test="quantity != null">quantity,</if>
<if test="unit_price != null">unit_price,</if>
<if test="total_price != null">total_price,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="seed_id != null">#{seed_id},</if>
<if test="purchase_time != null">#{purchase_time},</if>
<if test="quantity != null">#{quantity},</if>
<if test="unit_price != null">#{unit_price},</if>
<if test="total_price != null">#{total_price},</if>
</trim>
</insert>
<update id="updateAfmsInventorySeedPurchase" parameterType="AfmsInventorySeedPurchase">
update afms_inventory_seed_purchase
<trim prefix="SET" suffixOverrides=",">
<if test="seed_id != null">seed_id = #{seed_id},</if>
<if test="purchase_time != null">purchase_time = #{purchase_time},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="unit_price != null">unit_price = #{unit_price},</if>
<if test="total_price != null">total_price = #{total_price},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAfmsInventorySeedPurchaseById" parameterType="Integer">
delete from afms_inventory_seed_purchase where id = #{id}
</delete>
<delete id="deleteAfmsInventorySeedPurchaseByIds" parameterType="String">
delete from afms_inventory_seed_purchase where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>