AfmsDataLossMapper.xml
5.0 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
<?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.AfmsDataLossMapper">
<resultMap type="AfmsDataLoss" id="AfmsDataLossResult">
<result property="id" column="id" />
<result property="loss_record_time" column="loss_record_time" />
<result property="pond_id" column="pond_id" />
<result property="species" column="species" />
<result property="loss_count" column="loss_count" />
<result property="loss_weight" column="loss_weight" />
<result property="loss_specification" column="loss_specification" />
<result property="estimated_reason" column="estimated_reason" />
<result property="image_path" column="image_path" />
</resultMap>
<sql id="selectAfmsDataLossVo">
select `id`, `loss_record_time`, `pond_id`, `species`, `loss_count`, `loss_weight`, `loss_specification`, `estimated_reason`, `image_path` from afms_data_loss
</sql>
<select id="selectAfmsDataLossList" parameterType="AfmsDataLoss" resultMap="AfmsDataLossResult">
<include refid="selectAfmsDataLossVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="params.beginLoss_record_time != null and params.beginLoss_record_time != '' and params.endLoss_record_time != null and params.endLoss_record_time != ''"> and loss_record_time between #{params.beginLoss_record_time} and #{params.endLoss_record_time}</if>
<if test="pond_id != null "> and pond_id = #{pond_id}</if>
<if test="species != null and species != ''"> and species like concat('%', #{species}, '%')</if>
<if test="loss_count != null "> and loss_count = #{loss_count}</if>
<if test="estimated_reason != null and estimated_reason != ''"> and estimated_reason like concat('%', #{estimated_reason}, '%')</if>
<if test="image_path != null and image_path != ''"> and image_path like concat('%', #{image_path}, '%')</if>
</where>
</select>
<select id="selectAfmsDataLossById" parameterType="Integer" resultMap="AfmsDataLossResult">
<include refid="selectAfmsDataLossVo"/>
where id = #{id}
</select>
<insert id="insertAfmsDataLoss" parameterType="AfmsDataLoss" useGeneratedKeys="true" keyProperty="id">
insert into afms_data_loss
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="loss_record_time != null">loss_record_time,</if>
<if test="pond_id != null">pond_id,</if>
<if test="species != null and species != ''">species,</if>
<if test="loss_count != null">loss_count,</if>
<if test="loss_weight != null">loss_weight,</if>
<if test="loss_specification != null">loss_specification,</if>
<if test="estimated_reason != null and estimated_reason != ''">estimated_reason,</if>
<if test="image_path != null">image_path,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="loss_record_time != null">#{loss_record_time},</if>
<if test="pond_id != null">#{pond_id},</if>
<if test="species != null and species != ''">#{species},</if>
<if test="loss_count != null">#{loss_count},</if>
<if test="loss_weight != null">#{loss_weight},</if>
<if test="loss_specification != null">#{loss_specification},</if>
<if test="estimated_reason != null and estimated_reason != ''">#{estimated_reason},</if>
<if test="image_path != null">#{image_path},</if>
</trim>
</insert>
<update id="updateAfmsDataLoss" parameterType="AfmsDataLoss">
update afms_data_loss
<trim prefix="SET" suffixOverrides=",">
<if test="loss_record_time != null">loss_record_time = #{loss_record_time},</if>
<if test="pond_id != null">pond_id = #{pond_id},</if>
<if test="species != null and species != ''">species = #{species},</if>
<if test="loss_count != null">loss_count = #{loss_count},</if>
<if test="loss_weight != null">loss_weight = #{loss_weight},</if>
<if test="loss_specification != null">loss_specification = #{loss_specification},</if>
<if test="estimated_reason != null and estimated_reason != ''">estimated_reason = #{estimated_reason},</if>
<if test="image_path != null">image_path = #{image_path},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAfmsDataLossById" parameterType="Integer">
delete from afms_data_loss where id = #{id}
</delete>
<delete id="deleteAfmsDataLossByIds" parameterType="String">
delete from afms_data_loss where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>