| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <?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.jeeplus.modules.hpadvertisement.mapper.HpAdvBannerMapper">
-
- <sql id="hpAdvBannerColumns">
- a.id AS "id",
- a.title AS "title",
- a.application AS "application",
- a.banner_position AS "bannerPosition",
- a.sort AS "sort",
- a.pic_url AS "picUrl",
- a.pic_detail AS "picDetail",
- a.position_detail AS "positionDetail",
- a.link_flag AS "linkFlag",
- a.create_time AS "createTime",
- a.create_by AS "createBy.id",
- a.update_time AS "updateTime",
- a.update_by AS "updateBy.id",
- a.end_time AS "endTime",
- a.del_flag AS "delFlag"
- </sql>
-
- <sql id="hpAdvBannerJoins">
-
- </sql>
-
-
- <select id="get" resultType="HpAdvBanner" >
- SELECT
- <include refid="hpAdvBannerColumns"/>
- FROM hp_adv_banner a
- <include refid="hpAdvBannerJoins"/>
- WHERE a.id = #{id}
- </select>
-
- <select id="findList" resultType="HpAdvBanner" >
- SELECT
- <include refid="hpAdvBannerColumns"/>
- FROM hp_adv_banner a
- <include refid="hpAdvBannerJoins"/>
- <where>
- ${dataScope}
- <if test="title != null and title != ''">
- AND a.title LIKE
- <if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{title},'%')</if>
- </if>
- <if test="application != null ">
- AND a.application = #{application}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.sort ASC, a.update_time DESC
- </otherwise>
- </choose>
- </select>
-
- <select id="findAllList" resultType="HpAdvBanner" >
- SELECT
- <include refid="hpAdvBannerColumns"/>
- FROM hp_adv_banner a
- <include refid="hpAdvBannerJoins"/>
- <where>
- ${dataScope}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
-
- <insert id="insert" keyProperty="id" useGeneratedKeys="true" parameterType="HpAdvBanner">
- INSERT INTO hp_adv_banner(
- title,
- application,
- banner_position,
- sort,
- pic_url,
- pic_detail,
- position_detail,
- link_flag,
- create_time,
- create_by,
- update_time,
- update_by,
- end_time,
- del_flag
- ) VALUES (
- #{title},
- #{application},
- #{bannerPosition},
- #{sort},
- #{picUrl},
- #{picDetail},
- #{positionDetail},
- #{linkFlag},
- #{createTime},
- #{createBy.id},
- #{updateTime},
- #{updateBy.id},
- #{endTime},
- #{delFlag}
- )
- </insert>
-
- <update id="update">
- UPDATE hp_adv_banner SET
- title = #{title},
- application = #{application},
- banner_position = #{bannerPosition},
- sort = #{sort},
- pic_url = #{picUrl},
- pic_detail = #{picDetail},
- position_detail = #{positionDetail},
- link_flag = #{linkFlag},
- create_time = #{createTime},
- update_time = #{updateTime},
- update_by = #{updateBy.id},
- end_time = #{endTime},
- del_flag = #{delFlag}
- WHERE id = #{id}
- </update>
-
-
- <!--物理删除-->
- <update id="delete">
- DELETE FROM hp_adv_banner
- WHERE id = #{id}
- </update>
-
- <!--逻辑删除-->
- <update id="deleteByLogic">
- UPDATE hp_adv_banner SET
- del_flag = #{DEL_FLAG_DELETE}
- WHERE id = #{id}
- </update>
-
-
- <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
- <select id="findUniqueByProperty" resultType="HpAdvBanner" statementType="STATEMENT">
- select * FROM hp_adv_banner where ${propertyName} = '${value}'
- </select>
- <select id="findBannerList" resultType="HpAdvBanner">
- SELECT
- <include refid="hpAdvBannerColumns"/>
- FROM hp_adv_banner a
- <include refid="hpAdvBannerJoins"/>
- <where>
- a.del_flag = 0
- and DATE_ADD(a.end_time, INTERVAL 1 DAY) >= now()
- <if test="application != null ">
- <if test="application == 0">
- and (a.application = 0 or a.application = 2)
- </if>
- <if test="application == 1">
- and (a.application = 1 or a.application = 2)
- </if>
- </if>
- </where>
- ORDER BY a.sort ASC, a.update_time DESC
- </select>
- </mapper>
|