AfmsBasicFeedMapper.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
<?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.AfmsBasicFeedMapper">
<resultMap type="AfmsBasicFeed" id="AfmsBasicFeedResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="brand_id" column="brand_id" />
<result property="category_id" column="category_id" />
<result property="specification_unit" column="specification_unit" />
<result property="supplier" column="supplier" />
<result property="create_time" column="create_time" />
<result property="supplier_id" column="supplier_id" />
</resultMap>
<sql id="selectAfmsBasicFeedVo">
select `id`, `name`, `brand_id`, `category_id`, `specification_unit`, `supplier`, `create_time`, `supplier_id` from afms_basic_feed
</sql>
<select id="selectAfmsBasicFeedList" parameterType="AfmsBasicFeed" resultMap="AfmsBasicFeedResult">
<include refid="selectAfmsBasicFeedVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="brand_id != null "> and brand_id = #{brand_id}</if>
<if test="category_id != null "> and category_id = #{category_id}</if>
<if test="specification_unit != null and specification_unit != ''"> and specification_unit like concat('%', #{specification_unit}, '%')</if>
<if test="supplier != null and supplier != ''"> and supplier like concat('%', #{supplier}, '%')</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>
<if test="supplier_id != null "> and supplier_id = #{supplier_id}</if>
</where>
</select>
<select id="selectAfmsBasicFeedById" parameterType="Integer" resultMap="AfmsBasicFeedResult">
<include refid="selectAfmsBasicFeedVo"/>
where id = #{id}
</select>
<insert id="insertAfmsBasicFeed" parameterType="AfmsBasicFeed" useGeneratedKeys="true" keyProperty="id">
insert into afms_basic_feed
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="brand_id != null">brand_id,</if>
<if test="category_id != null">category_id,</if>
<if test="specification_unit != null and specification_unit != ''">specification_unit,</if>
<if test="supplier != null and supplier != ''">supplier,</if>
<if test="create_time != null">create_time,</if>
<if test="supplier_id != null">supplier_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="brand_id != null">#{brand_id},</if>
<if test="category_id != null">#{category_id},</if>
<if test="specification_unit != null and specification_unit != ''">#{specification_unit},</if>
<if test="supplier != null and supplier != ''">#{supplier},</if>
<if test="create_time != null">#{create_time},</if>
<if test="supplier_id != null">#{supplier_id},</if>
</trim>
</insert>
<update id="updateAfmsBasicFeed" parameterType="AfmsBasicFeed">
update afms_basic_feed
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="brand_id != null">brand_id = #{brand_id},</if>
<if test="category_id != null">category_id = #{category_id},</if>
<if test="specification_unit != null and specification_unit != ''">specification_unit = #{specification_unit},</if>
<if test="supplier != null and supplier != ''">supplier = #{supplier},</if>
<if test="create_time != null">create_time = #{create_time},</if>
<if test="supplier_id != null">supplier_id = #{supplier_id},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAfmsBasicFeedById" parameterType="Integer">
delete from afms_basic_feed where id = #{id}
</delete>
<delete id="deleteAfmsBasicFeedByIds" parameterType="String">
delete from afms_basic_feed where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>