AfmsDataSamplingMapper.xml
5.2 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
91
92
93
<?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.AfmsDataSamplingMapper">
<resultMap type="AfmsDataSampling" id="AfmsDataSamplingResult">
<result property="id" column="id" />
<result property="sampling_time" column="sampling_time" />
<result property="pond_id" column="pond_id" />
<result property="species" column="species" />
<result property="sample_count" column="sample_count" />
<result property="sample_weight" column="sample_weight" />
<result property="average_length" column="average_length" />
<result property="average_specification" column="average_specification" />
<result property="estimated_pond_weight" column="estimated_pond_weight" />
<result property="image_path" column="image_path" />
</resultMap>
<sql id="selectAfmsDataSamplingVo">
select `id`, `sampling_time`, `pond_id`, `species`, `sample_count`, `sample_weight`, `average_length`, `average_specification`, `estimated_pond_weight`, `image_path` from afms_data_sampling
</sql>
<select id="selectAfmsDataSamplingList" parameterType="AfmsDataSampling" resultMap="AfmsDataSamplingResult">
<include refid="selectAfmsDataSamplingVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="params.beginSampling_time != null and params.beginSampling_time != '' and params.endSampling_time != null and params.endSampling_time != ''"> and sampling_time between #{params.beginSampling_time} and #{params.endSampling_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="sample_count != null "> and sample_count = #{sample_count}</if>
<if test="image_path != null and image_path != ''"> and image_path like concat('%', #{image_path}, '%')</if>
</where>
</select>
<select id="selectAfmsDataSamplingById" parameterType="Integer" resultMap="AfmsDataSamplingResult">
<include refid="selectAfmsDataSamplingVo"/>
where id = #{id}
</select>
<insert id="insertAfmsDataSampling" parameterType="AfmsDataSampling" useGeneratedKeys="true" keyProperty="id">
insert into afms_data_sampling
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sampling_time != null">sampling_time,</if>
<if test="pond_id != null">pond_id,</if>
<if test="species != null and species != ''">species,</if>
<if test="sample_count != null">sample_count,</if>
<if test="sample_weight != null">sample_weight,</if>
<if test="average_length != null">average_length,</if>
<if test="average_specification != null">average_specification,</if>
<if test="estimated_pond_weight != null">estimated_pond_weight,</if>
<if test="image_path != null">image_path,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sampling_time != null">#{sampling_time},</if>
<if test="pond_id != null">#{pond_id},</if>
<if test="species != null and species != ''">#{species},</if>
<if test="sample_count != null">#{sample_count},</if>
<if test="sample_weight != null">#{sample_weight},</if>
<if test="average_length != null">#{average_length},</if>
<if test="average_specification != null">#{average_specification},</if>
<if test="estimated_pond_weight != null">#{estimated_pond_weight},</if>
<if test="image_path != null">#{image_path},</if>
</trim>
</insert>
<update id="updateAfmsDataSampling" parameterType="AfmsDataSampling">
update afms_data_sampling
<trim prefix="SET" suffixOverrides=",">
<if test="sampling_time != null">sampling_time = #{sampling_time},</if>
<if test="pond_id != null">pond_id = #{pond_id},</if>
<if test="species != null and species != ''">species = #{species},</if>
<if test="sample_count != null">sample_count = #{sample_count},</if>
<if test="sample_weight != null">sample_weight = #{sample_weight},</if>
<if test="average_length != null">average_length = #{average_length},</if>
<if test="average_specification != null">average_specification = #{average_specification},</if>
<if test="estimated_pond_weight != null">estimated_pond_weight = #{estimated_pond_weight},</if>
<if test="image_path != null">image_path = #{image_path},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAfmsDataSamplingById" parameterType="Integer">
delete from afms_data_sampling where id = #{id}
</delete>
<delete id="deleteAfmsDataSamplingByIds" parameterType="String">
delete from afms_data_sampling where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>