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
  | <?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.xzx.gc.system.mapper.BannerMapper">  
 |      <select id="findAll" resultType="com.xzx.gc.entity.BannerInfo">  
 |          SELECT  
 |              id,  
 |              pic_name AS picName,  
 |              pic_path AS picPath,  
 |              pic_url AS picUrl,  
 |              sort,  
 |              del_flag AS delFlag,  
 |              create_time AS createTime,  
 |              partner_id AS partnerId,  
 |              city_id AS cityId  
 |          FROM  
 |              xzx_sys_banner  
 |          WHERE  
 |              del_flag = 0  
 |          ORDER BY  
 |              sort ASC;  
 |      </select>  
 |    
 |      <select id="findByAreaId" resultType="com.xzx.gc.entity.BannerInfo">  
 |          SELECT  
 |              id,  
 |              pic_name AS picName,  
 |              pic_path AS picPath,  
 |              pic_url AS picUrl,  
 |              sort,  
 |              del_flag AS delFlag,  
 |              create_time AS createTime,  
 |              partner_id AS partnerId,  
 |              city_id AS cityId  
 |          FROM  
 |              xzx_sys_banner  
 |          WHERE  
 |              del_flag = 0 and city_id=#{areaId}  
 |          ORDER BY  
 |              sort ASC;  
 |      </select>  
 |    
 |      <select id="queryBannerList" resultType="com.xzx.gc.model.admin.BannerModel">  
 |          select a.id, a.pic_name, a.pic_path, a.pic_url, a.sort, a.del_flag, a.create_time , a.city_id,  
 |          (select b.partner_name from xzx_city_partner b where a.partner_id=b.id) as partnerName,a.del_flag as delFlag  
 |          from xzx_sys_banner a where 1=1  
 |          <if test="id != null">  
 |              AND id=#{id}  
 |          </if>  
 |          <if test="picName != null">  
 |              AND pic_name=#{picName}  
 |          </if>  
 |          <if test="picPath != null">  
 |              AND pic_path=#{picPath}  
 |          </if>  
 |          <if test="picUrl != null">  
 |              AND pic_url=#{picUrl}  
 |          </if>  
 |          <if test="cityId != null">  
 |              AND city_id=#{cityId}  
 |          </if>  
 |          <if test="cityId == null">  
 |              AND city_id='-1'  
 |          </if>  
 |          <if test="startTime != null and startTime != ''">  
 |              AND create_time BETWEEN #{startTime} AND #{endTime}  
 |          </if>  
 |          <if test="partnerId!= null and partnerId != ''">  
 |              AND partner_id = #{partnerId}  
 |          </if>  
 |          order by sort  
 |      </select>  
 |    
 |      <insert id="insertBanner" useGeneratedKeys="true" keyProperty="id">  
 |          INSERT INTO `xzx_sys_banner` (`pic_name`, `pic_path`, `pic_url`, `sort`, `create_time`, `city_id`, `partner_id`)  
 |          VALUES  
 |              (#{picName}, #{picPath}, #{picUrl}, #{sort}, #{createTime}, #{cityId}, #{partnerId})  
 |      </insert>  
 |      <update id="updateBanner">  
 |          UPDATE `xzx_sys_banner`  
 |          SET  
 |              `pic_name` = #{picName},  
 |              `pic_path` = #{picPath},  
 |              `pic_url`  = #{picUrl},  
 |              `sort`     = #{sort}  
 |          WHERE `id` = #{id}  
 |      </update>  
 |      <delete id="delBanner">  
 |          UPDATE xzx_sys_banner  
 |          SET del_flag = 1  
 |          WHERE id = #{id}  
 |      </delete>  
 |  </mapper> 
 |  
  |