|
|
1
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
2
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
3
|
+<mapper namespace="com.yohobuy.ufo.dal.brand.BrandMapper">
|
|
|
4
|
+
|
|
|
5
|
+ <resultMap id="brandMap" type="com.yohobuy.ufo.model.brand.Brand">
|
|
|
6
|
+ </resultMap>
|
|
|
7
|
+
|
|
|
8
|
+ <sql id="queryColumns">
|
|
|
9
|
+ id, brand_name, brand_name_en, brand_log, brand_search, status, create_time
|
|
|
10
|
+ </sql>
|
|
|
11
|
+
|
|
|
12
|
+ <insert id="insertBrand" parameterType="com.yohobuy.ufo.model.brand.Brand">
|
|
|
13
|
+ insert into brand(id, brand_name, brand_name_en, brand_log, brand_search, status, create_time, edit_time, edit_pid)
|
|
|
14
|
+ values (#{id}, #{brandName}, #{brandNameEn}, #{brandLogo}, #{brandSearch}, #{status}, #{createTime}, #{editTime}, #{editPid})
|
|
|
15
|
+ </insert>
|
|
|
16
|
+
|
|
|
17
|
+ <update id="updateBrandStatus">
|
|
|
18
|
+ update brand set status = #{status}, edit_time = #{editTime}, edit_pid = #{editPid} where id = #{id}
|
|
|
19
|
+ </update>
|
|
|
20
|
+
|
|
|
21
|
+ <update id="updateBrand">
|
|
|
22
|
+ update brand
|
|
|
23
|
+ <set>
|
|
|
24
|
+ <if test="brand.brandName != null and brand.brandName !=''">
|
|
|
25
|
+ brand_name = #{brand.brandName},
|
|
|
26
|
+ </if>
|
|
|
27
|
+ <if test="brand.brandNameEn != null and brand.brandNameEn != ''">
|
|
|
28
|
+ brand_name_en = #{brand.brandNameEn},
|
|
|
29
|
+ </if>
|
|
|
30
|
+ <if test="brand.brandLogo != null and brand.brandLogo != ''">
|
|
|
31
|
+ brand_log = #{brand.brandLogo},
|
|
|
32
|
+ </if>
|
|
|
33
|
+ <if test="brand.brandSearch != null and brand.brandSearch !=''">
|
|
|
34
|
+ brand_search = #{brand.brandSearch},
|
|
|
35
|
+ </if>
|
|
|
36
|
+ <if test="brand.status != null and brand.status != ''">
|
|
|
37
|
+ status = #{brand.status},
|
|
|
38
|
+ </if>
|
|
|
39
|
+ <if test="brand.createTime != null">
|
|
|
40
|
+ create_time = #{brand.createTime},
|
|
|
41
|
+ </if>
|
|
|
42
|
+ <if test="brand.editTime != null">
|
|
|
43
|
+ edit_time = #{brand.editTime},
|
|
|
44
|
+ </if>
|
|
|
45
|
+ <if test="brand.editPid != null">
|
|
|
46
|
+ edit_pid = #{brand.editPid}
|
|
|
47
|
+ </if>
|
|
|
48
|
+ </set>
|
|
|
49
|
+ where id = #{brand.id}
|
|
|
50
|
+ </update>
|
|
|
51
|
+
|
|
|
52
|
+ <select id="selectOneById" resultMap="brandMap">
|
|
|
53
|
+ select <include refid="queryColumns" />
|
|
|
54
|
+ from brand where id = #{id}
|
|
|
55
|
+ </select>
|
|
|
56
|
+
|
|
|
57
|
+
|
|
|
58
|
+ <select id="selectBrandCount" resultType="integer">
|
|
|
59
|
+ select count(*)
|
|
|
60
|
+ from brand
|
|
|
61
|
+ <where>
|
|
|
62
|
+ <if test="brand.brandName != null and brand.brandName != ''">
|
|
|
63
|
+ brand_name like concat('%', #{brand.brandName}, '%') or brand_name_en like concat('%', #{brand.brandName}, '%')
|
|
|
64
|
+ </if>
|
|
|
65
|
+ <if test="brand.status != null">
|
|
|
66
|
+ status = #{brand.status}
|
|
|
67
|
+ </if>
|
|
|
68
|
+ </where>
|
|
|
69
|
+ </select>
|
|
|
70
|
+
|
|
|
71
|
+ <select id="getBrandPageList" resultMap="brandMap">
|
|
|
72
|
+ select <include refid="queryColumns"/>
|
|
|
73
|
+ from brand
|
|
|
74
|
+ <where>
|
|
|
75
|
+ <if test="brand.brandName != null and brand.brandName != ''">
|
|
|
76
|
+ brand_name like concat('%', #{brand.brandName}, '%') or brand_name_en like concat('%', #{brand.brandName}, '%')
|
|
|
77
|
+ </if>
|
|
|
78
|
+ <if test="brand.status != null">
|
|
|
79
|
+ status = #{brand.status}
|
|
|
80
|
+ </if>
|
|
|
81
|
+ </where>
|
|
|
82
|
+ order by create_time desc
|
|
|
83
|
+ limit #{page.startIndex}, #{page.pageSize}
|
|
|
84
|
+ </select>
|
|
|
85
|
+
|
|
|
86
|
+</mapper> |