|
|
@@ -0,0 +1,350 @@
|
|
|
+<?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.izouma.awesomeadmin.dao.BannerInfoMapper" >
|
|
|
+ <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.BannerInfo" >
|
|
|
+ <id column="id" property="id" jdbcType="INTEGER" />
|
|
|
+ <result column="del_flag" property="delFlag" jdbcType="CHAR" />
|
|
|
+ <result column="title" property="title" jdbcType="VARCHAR" />
|
|
|
+ <result column="subtitle" property="subtitle" jdbcType="VARCHAR" />
|
|
|
+ <result column="image" property="image" jdbcType="VARCHAR" />
|
|
|
+ <result column="news_url" property="newsUrl" jdbcType="VARCHAR" />
|
|
|
+ <result column="rank" property="rank" jdbcType="INTEGER" />
|
|
|
+ <result column="hot" property="hot" jdbcType="INTEGER" />
|
|
|
+ <result column="remark" property="remark" jdbcType="VARCHAR" />
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List" >
|
|
|
+ <trim suffixOverrides="," >
|
|
|
+ id,
|
|
|
+
|
|
|
+ del_flag,
|
|
|
+
|
|
|
+ title,
|
|
|
+
|
|
|
+ subtitle,
|
|
|
+
|
|
|
+ image,
|
|
|
+
|
|
|
+ news_url,
|
|
|
+
|
|
|
+ rank,
|
|
|
+
|
|
|
+ hot,
|
|
|
+
|
|
|
+ remark,
|
|
|
+
|
|
|
+ </trim>
|
|
|
+ </sql>
|
|
|
+ <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from banner_info
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
|
|
+ delete from banner_info
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </delete>
|
|
|
+ <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.BannerInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into banner_info
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="id!= null" >
|
|
|
+ id,
|
|
|
+ </if>
|
|
|
+ <if test="delFlag!= null" >
|
|
|
+ del_flag,
|
|
|
+ </if>
|
|
|
+ <if test="title!= null" >
|
|
|
+ title,
|
|
|
+ </if>
|
|
|
+ <if test="subtitle!= null" >
|
|
|
+ subtitle,
|
|
|
+ </if>
|
|
|
+ <if test="image!= null" >
|
|
|
+ image,
|
|
|
+ </if>
|
|
|
+ <if test="newsUrl!= null" >
|
|
|
+ news_url,
|
|
|
+ </if>
|
|
|
+ <if test="rank!= null" >
|
|
|
+ rank,
|
|
|
+ </if>
|
|
|
+ <if test="hot!= null" >
|
|
|
+ hot,
|
|
|
+ </if>
|
|
|
+ <if test="remark!= null" >
|
|
|
+ remark,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="id != null" >
|
|
|
+ #{id,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="delFlag != null" >
|
|
|
+ #{delFlag,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="title != null" >
|
|
|
+ #{title,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="subtitle != null" >
|
|
|
+ #{subtitle,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="image != null" >
|
|
|
+ #{image,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="newsUrl != null" >
|
|
|
+ #{newsUrl,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="rank != null" >
|
|
|
+ #{rank,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="hot != null" >
|
|
|
+ #{hot,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="remark != null" >
|
|
|
+ #{remark,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.BannerInfo" >
|
|
|
+ update banner_info
|
|
|
+ <set >
|
|
|
+ <if test="id != null" >
|
|
|
+ id= #{id,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="delFlag != null" >
|
|
|
+ del_flag= #{delFlag,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="title != null" >
|
|
|
+ title= #{title,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="subtitle != null" >
|
|
|
+ subtitle= #{subtitle,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="image != null" >
|
|
|
+ image= #{image,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="newsUrl != null" >
|
|
|
+ news_url= #{newsUrl,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="rank != null" >
|
|
|
+ rank= #{rank,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="hot != null" >
|
|
|
+ hot= #{hot,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="remark != null" >
|
|
|
+ remark= #{remark,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+ <select id="queryBannerInfoByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.BannerInfo">
|
|
|
+ select <include refid="Base_Column_List"/> from banner_info
|
|
|
+ <where>
|
|
|
+ and del_flag = 'N'
|
|
|
+ <if test="record.id != null and !"".equals(record.id)">
|
|
|
+ and id = #{record.id}
|
|
|
+ </if>
|
|
|
+ <if test="record.delFlag != null and !"".equals(record.delFlag)">
|
|
|
+ and del_flag = #{record.delFlag}
|
|
|
+ </if>
|
|
|
+ <if test="record.title != null and !"".equals(record.title)">
|
|
|
+ and title = #{record.title}
|
|
|
+ </if>
|
|
|
+ <if test="record.subtitle != null and !"".equals(record.subtitle)">
|
|
|
+ and subtitle = #{record.subtitle}
|
|
|
+ </if>
|
|
|
+ <if test="record.image != null and !"".equals(record.image)">
|
|
|
+ and image = #{record.image}
|
|
|
+ </if>
|
|
|
+ <if test="record.newsUrl != null and !"".equals(record.newsUrl)">
|
|
|
+ and news_url = #{record.newsUrl}
|
|
|
+ </if>
|
|
|
+ <if test="record.rank != null and !"".equals(record.rank)">
|
|
|
+ and rank = #{record.rank}
|
|
|
+ </if>
|
|
|
+ <if test="record.hot != null and !"".equals(record.hot)">
|
|
|
+ and hot = #{record.hot}
|
|
|
+ </if>
|
|
|
+ <if test="record.remark != null and !"".equals(record.remark)">
|
|
|
+ and remark = #{record.remark}
|
|
|
+ </if>
|
|
|
+ <if test="record.searchKey != null and !"".equals(record.searchKey)">
|
|
|
+ <trim prefix="and (" suffix=")" prefixOverrides="OR" >
|
|
|
+ OR title LIKE concat('%',#{record.searchKey},'%')
|
|
|
+ OR subtitle LIKE concat('%',#{record.searchKey},'%')
|
|
|
+ OR image LIKE concat('%',#{record.searchKey},'%')
|
|
|
+ OR news_url LIKE concat('%',#{record.searchKey},'%')
|
|
|
+ OR rank LIKE concat('%',#{record.searchKey},'%')
|
|
|
+ OR hot LIKE concat('%',#{record.searchKey},'%')
|
|
|
+ OR remark LIKE concat('%',#{record.searchKey},'%')
|
|
|
+ </trim>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="record.advancedQuery != null and !"".equals(record.advancedQuery)">
|
|
|
+ <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
|
|
|
+ <choose>
|
|
|
+ <when test="item.indexOf('like') != -1">
|
|
|
+ <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
|
|
|
+ <if test="detailIndex == 3">
|
|
|
+ concat('%',#{itemDetail},'%')
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="detailIndex < 3">
|
|
|
+ ${itemDetail}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </foreach>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
|
|
|
+ <if test="detailIndex == 3">
|
|
|
+ #{itemDetail}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="detailIndex < 3">
|
|
|
+ ${itemDetail}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </foreach>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+
|
|
|
+ </foreach>
|
|
|
+
|
|
|
+
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ order by id desc
|
|
|
+ </select>
|
|
|
+ <select id="queryAllBannerInfo" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.BannerInfo">
|
|
|
+ select <include refid="Base_Column_List"/> from banner_info
|
|
|
+ <where>
|
|
|
+ and del_flag = 'N'
|
|
|
+ <if test="id != null and !"".equals(id)">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="delFlag != null and !"".equals(delFlag)">
|
|
|
+ and del_flag = #{delFlag}
|
|
|
+ </if>
|
|
|
+ <if test="title != null and !"".equals(title)">
|
|
|
+ and title = #{title}
|
|
|
+ </if>
|
|
|
+ <if test="subtitle != null and !"".equals(subtitle)">
|
|
|
+ and subtitle = #{subtitle}
|
|
|
+ </if>
|
|
|
+ <if test="image != null and !"".equals(image)">
|
|
|
+ and image = #{image}
|
|
|
+ </if>
|
|
|
+ <if test="newsUrl != null and !"".equals(newsUrl)">
|
|
|
+ and news_url = #{newsUrl}
|
|
|
+ </if>
|
|
|
+ <if test="rank != null and !"".equals(rank)">
|
|
|
+ and rank = #{rank}
|
|
|
+ </if>
|
|
|
+ <if test="hot != null and !"".equals(hot)">
|
|
|
+ and hot = #{hot}
|
|
|
+ </if>
|
|
|
+ <if test="remark != null and !"".equals(remark)">
|
|
|
+ and remark = #{remark}
|
|
|
+ </if>
|
|
|
+ <if test="searchKey != null and !"".equals(searchKey)">
|
|
|
+ <trim prefix="and (" suffix=")" prefixOverrides="OR" >
|
|
|
+ OR title LIKE concat('%',#{searchKey},'%')
|
|
|
+ OR subtitle LIKE concat('%',#{searchKey},'%')
|
|
|
+ OR image LIKE concat('%',#{searchKey},'%')
|
|
|
+ OR news_url LIKE concat('%',#{searchKey},'%')
|
|
|
+ OR rank LIKE concat('%',#{searchKey},'%')
|
|
|
+ OR hot LIKE concat('%',#{searchKey},'%')
|
|
|
+ OR remark LIKE concat('%',#{searchKey},'%')
|
|
|
+ </trim>
|
|
|
+ </if>
|
|
|
+<if test="advancedQuery != null and !"".equals(advancedQuery)">
|
|
|
+ <foreach item="item" index="index" collection="advancedQuery.split('_;')">
|
|
|
+ <choose>
|
|
|
+ <when test="item.indexOf('like') != -1">
|
|
|
+ <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
|
|
|
+ <if test="detailIndex == 3">
|
|
|
+ concat('%',#{itemDetail},'%')
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="detailIndex < 3">
|
|
|
+ ${itemDetail}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </foreach>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
|
|
|
+ <if test="detailIndex == 3">
|
|
|
+ #{itemDetail}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="detailIndex < 3">
|
|
|
+ ${itemDetail}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </foreach>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+
|
|
|
+ </foreach>
|
|
|
+
|
|
|
+
|
|
|
+</if>
|
|
|
+ </where>
|
|
|
+ order by id desc
|
|
|
+ </select>
|
|
|
+ <select id="queryBannerInfo" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.BannerInfo">
|
|
|
+ select <include refid="Base_Column_List"/> from banner_info
|
|
|
+ <where>
|
|
|
+ and del_flag = 'N'
|
|
|
+ <if test="id != null and !"".equals(id)">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="delFlag != null and !"".equals(delFlag)">
|
|
|
+ and del_flag = #{delFlag}
|
|
|
+ </if>
|
|
|
+ <if test="title != null and !"".equals(title)">
|
|
|
+ and title = #{title}
|
|
|
+ </if>
|
|
|
+ <if test="subtitle != null and !"".equals(subtitle)">
|
|
|
+ and subtitle = #{subtitle}
|
|
|
+ </if>
|
|
|
+ <if test="image != null and !"".equals(image)">
|
|
|
+ and image = #{image}
|
|
|
+ </if>
|
|
|
+ <if test="newsUrl != null and !"".equals(newsUrl)">
|
|
|
+ and news_url = #{newsUrl}
|
|
|
+ </if>
|
|
|
+ <if test="rank != null and !"".equals(rank)">
|
|
|
+ and rank = #{rank}
|
|
|
+ </if>
|
|
|
+ <if test="hot != null and !"".equals(hot)">
|
|
|
+ and hot = #{hot}
|
|
|
+ </if>
|
|
|
+ <if test="remark != null and !"".equals(remark)">
|
|
|
+ and remark = #{remark}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ LIMIT 1
|
|
|
+ </select>
|
|
|
+ <update id="delete">
|
|
|
+ UPDATE banner_info SET del_flag = 'Y'
|
|
|
+ <where>
|
|
|
+ AND id = #{id}
|
|
|
+ </where>
|
|
|
+ </update>
|
|
|
+ <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.BannerInfo">
|
|
|
+ select <include refid="Base_Column_List"/> from banner_info
|
|
|
+ <where>
|
|
|
+ and del_flag = 'N'
|
|
|
+ </where>
|
|
|
+ order by id desc
|
|
|
+ </select>
|
|
|
+</mapper>
|
|
|
+
|