AfmsRevenueHarvestMapper.xml
4.7 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
<?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.AfmsRevenueHarvestMapper">
<resultMap type="AfmsRevenueHarvest" id="AfmsRevenueHarvestResult">
<result property="id" column="id" />
<result property="harvest_date" column="harvest_date" />
<result property="pond_id" column="pond_id" />
<result property="species_id" column="species_id" />
<result property="customer" column="customer" />
<result property="total_weight" column="total_weight" />
<result property="total_price" column="total_price" />
<result property="labor_cost" column="labor_cost" />
<result property="transportation_cost" column="transportation_cost" />
</resultMap>
<sql id="selectAfmsRevenueHarvestVo">
select `id`, `harvest_date`, `pond_id`, `species_id`, `customer`, `total_weight`, `total_price`, `labor_cost`, `transportation_cost` from afms_revenue_harvest
</sql>
<select id="selectAfmsRevenueHarvestList" parameterType="AfmsRevenueHarvest" resultMap="AfmsRevenueHarvestResult">
<include refid="selectAfmsRevenueHarvestVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="params.beginHarvest_date != null and params.beginHarvest_date != '' and params.endHarvest_date != null and params.endHarvest_date != ''"> and harvest_date between #{params.beginHarvest_date} and #{params.endHarvest_date}</if>
<if test="pond_id != null "> and pond_id = #{pond_id}</if>
<if test="species_id != null "> and species_id = #{species_id}</if>
<if test="customer != null and customer != ''"> and customer like concat('%', #{customer}, '%')</if>
</where>
</select>
<select id="selectAfmsRevenueHarvestById" parameterType="Integer" resultMap="AfmsRevenueHarvestResult">
<include refid="selectAfmsRevenueHarvestVo"/>
where id = #{id}
</select>
<insert id="insertAfmsRevenueHarvest" parameterType="AfmsRevenueHarvest" useGeneratedKeys="true" keyProperty="id">
insert into afms_revenue_harvest
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="harvest_date != null">harvest_date,</if>
<if test="pond_id != null">pond_id,</if>
<if test="species_id != null">species_id,</if>
<if test="customer != null and customer != ''">customer,</if>
<if test="total_weight != null">total_weight,</if>
<if test="total_price != null">total_price,</if>
<if test="labor_cost != null">labor_cost,</if>
<if test="transportation_cost != null">transportation_cost,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="harvest_date != null">#{harvest_date},</if>
<if test="pond_id != null">#{pond_id},</if>
<if test="species_id != null">#{species_id},</if>
<if test="customer != null and customer != ''">#{customer},</if>
<if test="total_weight != null">#{total_weight},</if>
<if test="total_price != null">#{total_price},</if>
<if test="labor_cost != null">#{labor_cost},</if>
<if test="transportation_cost != null">#{transportation_cost},</if>
</trim>
</insert>
<update id="updateAfmsRevenueHarvest" parameterType="AfmsRevenueHarvest">
update afms_revenue_harvest
<trim prefix="SET" suffixOverrides=",">
<if test="harvest_date != null">harvest_date = #{harvest_date},</if>
<if test="pond_id != null">pond_id = #{pond_id},</if>
<if test="species_id != null">species_id = #{species_id},</if>
<if test="customer != null and customer != ''">customer = #{customer},</if>
<if test="total_weight != null">total_weight = #{total_weight},</if>
<if test="total_price != null">total_price = #{total_price},</if>
<if test="labor_cost != null">labor_cost = #{labor_cost},</if>
<if test="transportation_cost != null">transportation_cost = #{transportation_cost},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAfmsRevenueHarvestById" parameterType="Integer">
delete from afms_revenue_harvest where id = #{id}
</delete>
<delete id="deleteAfmsRevenueHarvestByIds" parameterType="String">
delete from afms_revenue_harvest where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>