AfmsRevenueHarvestDetailMapper.xml
4.1 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
<?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.AfmsRevenueHarvestDetailMapper">
<resultMap type="AfmsRevenueHarvestDetail" id="AfmsRevenueHarvestDetailResult">
<result property="id" column="id" />
<result property="harvest_id" column="harvest_id" />
<result property="specification_range" column="specification_range" />
<result property="unit_price" column="unit_price" />
<result property="weight" column="weight" />
<result property="quantity" column="quantity" />
<result property="harvest_value" column="harvest_value" />
</resultMap>
<sql id="selectAfmsRevenueHarvestDetailVo">
select `id`, `harvest_id`, `specification_range`, `unit_price`, `weight`, `quantity`, `harvest_value` from afms_revenue_harvest_detail
</sql>
<select id="selectAfmsRevenueHarvestDetailList" parameterType="AfmsRevenueHarvestDetail" resultMap="AfmsRevenueHarvestDetailResult">
<include refid="selectAfmsRevenueHarvestDetailVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="harvest_id != null "> and harvest_id = #{harvest_id}</if>
<if test="specification_range != null and specification_range != ''"> and specification_range like concat('%', #{specification_range}, '%')</if>
<if test="quantity != null "> and quantity = #{quantity}</if>
</where>
</select>
<select id="selectAfmsRevenueHarvestDetailById" parameterType="Integer" resultMap="AfmsRevenueHarvestDetailResult">
<include refid="selectAfmsRevenueHarvestDetailVo"/>
where id = #{id}
</select>
<insert id="insertAfmsRevenueHarvestDetail" parameterType="AfmsRevenueHarvestDetail" useGeneratedKeys="true" keyProperty="id">
insert into afms_revenue_harvest_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="harvest_id != null">harvest_id,</if>
<if test="specification_range != null and specification_range != ''">specification_range,</if>
<if test="unit_price != null">unit_price,</if>
<if test="weight != null">weight,</if>
<if test="quantity != null">quantity,</if>
<if test="harvest_value != null">harvest_value,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="harvest_id != null">#{harvest_id},</if>
<if test="specification_range != null and specification_range != ''">#{specification_range},</if>
<if test="unit_price != null">#{unit_price},</if>
<if test="weight != null">#{weight},</if>
<if test="quantity != null">#{quantity},</if>
<if test="harvest_value != null">#{harvest_value},</if>
</trim>
</insert>
<update id="updateAfmsRevenueHarvestDetail" parameterType="AfmsRevenueHarvestDetail">
update afms_revenue_harvest_detail
<trim prefix="SET" suffixOverrides=",">
<if test="harvest_id != null">harvest_id = #{harvest_id},</if>
<if test="specification_range != null and specification_range != ''">specification_range = #{specification_range},</if>
<if test="unit_price != null">unit_price = #{unit_price},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="harvest_value != null">harvest_value = #{harvest_value},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAfmsRevenueHarvestDetailById" parameterType="Integer">
delete from afms_revenue_harvest_detail where id = #{id}
</delete>
<delete id="deleteAfmsRevenueHarvestDetailByIds" parameterType="String">
delete from afms_revenue_harvest_detail where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>