AfmsOperationWaterChangeMapper.xml
4.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
<?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.AfmsOperationWaterChangeMapper">
<resultMap type="AfmsOperationWaterChange" id="AfmsOperationWaterChangeResult">
<result property="id" column="id" />
<result property="record_date" column="record_date" />
<result property="pond_id" column="pond_id" />
<result property="inflow" column="inflow" />
<result property="outflow" column="outflow" />
<result property="photo" column="photo" />
<result property="create_time" column="create_time" />
</resultMap>
<sql id="selectAfmsOperationWaterChangeVo">
select `id`, `record_date`, `pond_id`, `inflow`, `outflow`, `photo`, `create_time` from afms_operation_water_change
</sql>
<select id="selectAfmsOperationWaterChangeList" parameterType="AfmsOperationWaterChange" resultMap="AfmsOperationWaterChangeResult">
<include refid="selectAfmsOperationWaterChangeVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="params.beginRecord_date != null and params.beginRecord_date != '' and params.endRecord_date != null and params.endRecord_date != ''"> and record_date between #{params.beginRecord_date} and #{params.endRecord_date}</if>
<if test="pond_id != null "> and pond_id = #{pond_id}</if>
<if test="photo != null and photo != ''"> and photo like concat('%', #{photo}, '%')</if>
<if test="params.beginCreate_time != null and params.beginCreate_time != '' and params.endCreate_time != null and params.endCreate_time != ''"> and create_time between #{params.beginCreate_time} and #{params.endCreate_time}</if>
</where>
</select>
<select id="selectAfmsOperationWaterChangeById" parameterType="Integer" resultMap="AfmsOperationWaterChangeResult">
<include refid="selectAfmsOperationWaterChangeVo"/>
where id = #{id}
</select>
<insert id="insertAfmsOperationWaterChange" parameterType="AfmsOperationWaterChange" useGeneratedKeys="true" keyProperty="id">
insert into afms_operation_water_change
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record_date != null">record_date,</if>
<if test="pond_id != null">pond_id,</if>
<if test="inflow != null">inflow,</if>
<if test="outflow != null">outflow,</if>
<if test="photo != null and photo != ''">photo,</if>
<if test="create_time != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record_date != null">#{record_date},</if>
<if test="pond_id != null">#{pond_id},</if>
<if test="inflow != null">#{inflow},</if>
<if test="outflow != null">#{outflow},</if>
<if test="photo != null and photo != ''">#{photo},</if>
<if test="create_time != null">#{create_time},</if>
</trim>
</insert>
<update id="updateAfmsOperationWaterChange" parameterType="AfmsOperationWaterChange">
update afms_operation_water_change
<trim prefix="SET" suffixOverrides=",">
<if test="record_date != null">record_date = #{record_date},</if>
<if test="pond_id != null">pond_id = #{pond_id},</if>
<if test="inflow != null">inflow = #{inflow},</if>
<if test="outflow != null">outflow = #{outflow},</if>
<if test="photo != null and photo != ''">photo = #{photo},</if>
<if test="create_time != null">create_time = #{create_time},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAfmsOperationWaterChangeById" parameterType="Integer">
delete from afms_operation_water_change where id = #{id}
</delete>
<delete id="deleteAfmsOperationWaterChangeByIds" parameterType="String">
delete from afms_operation_water_change where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>