<?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.yeshi.fanli.dao.mybatis.homemodule.SpecialMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.homemodule.Special">
|
<id column="b_id" property="id" jdbcType="BIGINT" />
|
<result column="b_name" property="name" jdbcType="VARCHAR" />
|
<result column="b_card" property="card" jdbcType="VARCHAR" />
|
<result column="b_card_id" property="cardId" jdbcType="BIGINT" />
|
<result column="b_main_picture" property="picture" jdbcType="VARCHAR" />
|
<result column="b_icon" property="icon" jdbcType="VARCHAR" />
|
<result column="b_sub_picture" property="subPicture" jdbcType="VARCHAR" />
|
<result column="b_params" property="params" jdbcType="VARCHAR" />
|
<result column="b_jump_login" property="jumpLogin" jdbcType="VARCHAR" />
|
<result column="b_orderby" property="orderby" jdbcType="INTEGER" />
|
<result column="b_order_man" property="orderMan" jdbcType="INTEGER" />
|
<result column="b_order_woman" property="orderWoman" jdbcType="INTEGER" />
|
<result column="b_state" property="state" jdbcType="BIGINT" />
|
<result column="b_sex" property="sex" jdbcType="INTEGER" />
|
<result column="b_show_type" property="showType" jdbcType="VARCHAR" />
|
<result column="b_remark" property="remark" jdbcType="VARCHAR" />
|
<result column="b_min_android_version_code" property="minAndroidVersionCode" jdbcType="INTEGER"/>
|
<result column="b_min_ios_version_code" property="minIOSVersionCode" jdbcType="INTEGER"/>
|
<result column="b_start_time" property="startTime" jdbcType="TIMESTAMP"/>
|
<result column="b_end_time" property="endTime" jdbcType="TIMESTAMP"/>
|
<result column="b_createtime" property="createtime" jdbcType="TIMESTAMP" />
|
<result column="b_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
|
|
<!-- 背景图片 -->
|
<result column="cd_bottom_picture" property="bottomPicture"
|
jdbcType="VARCHAR" />
|
|
<association property="jumpDetail" column="b_jumpid"
|
select="com.yeshi.fanli.dao.mybatis.common.JumpDetailV2Mapper.selectByPrimaryKey">
|
</association>
|
</resultMap>
|
|
|
<resultMap id="ResultLableMap" type="com.yeshi.fanli.entity.bus.homemodule.Special">
|
<id column="b_id" property="id" jdbcType="BIGINT" />
|
<result column="b_name" property="name" jdbcType="VARCHAR" />
|
<result column="b_card" property="card" jdbcType="VARCHAR" />
|
<result column="b_card_id" property="cardId" jdbcType="BIGINT" />
|
<result column="b_main_picture" property="picture" jdbcType="VARCHAR" />
|
<result column="b_icon" property="icon" jdbcType="VARCHAR" />
|
<result column="b_sub_picture" property="subPicture" jdbcType="VARCHAR" />
|
<result column="b_params" property="params" jdbcType="VARCHAR" />
|
<result column="b_jump_login" property="jumpLogin" jdbcType="VARCHAR" />
|
<result column="b_orderby" property="orderby" jdbcType="INTEGER" />
|
<result column="b_order_man" property="orderMan" jdbcType="INTEGER" />
|
<result column="b_order_woman" property="orderWoman" jdbcType="INTEGER" />
|
<result column="b_state" property="state" jdbcType="BIGINT" />
|
<result column="b_sex" property="sex" jdbcType="INTEGER" />
|
<result column="b_show_type" property="showType" jdbcType="VARCHAR" />
|
<result column="b_remark" property="remark" jdbcType="VARCHAR" />
|
<result column="b_min_android_version_code" property="minAndroidVersionCode" jdbcType="INTEGER"/>
|
<result column="b_min_ios_version_code" property="minIOSVersionCode" jdbcType="INTEGER"/>
|
<result column="b_start_time" property="startTime" jdbcType="TIMESTAMP"/>
|
<result column="b_end_time" property="endTime" jdbcType="TIMESTAMP"/>
|
<result column="b_createtime" property="createtime" jdbcType="TIMESTAMP" />
|
<result column="b_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
|
|
<!-- 背景图片 -->
|
<result column="cd_bottom_picture" property="bottomPicture"
|
jdbcType="VARCHAR" />
|
|
<association property="jumpDetail" column="b_jumpid"
|
select="com.yeshi.fanli.dao.mybatis.common.JumpDetailV2Mapper.selectByPrimaryKey">
|
</association>
|
|
<collection property="listLabels" column="sl_id" resultMap="com.yeshi.fanli.dao.mybatis.homemodule.SpecialLabelMapper.BaseResultMap"/>
|
</resultMap>
|
|
|
<sql id="Base_Column_List">b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_min_android_version_code,b_min_ios_version_code,b_start_time,b_end_time,b_createtime,b_updatetime</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_special where b_id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
yeshi_ec_special where b_id = #{id,jdbcType=BIGINT}</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special"
|
useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_special
|
(b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_min_android_version_code,b_min_ios_version_code,b_start_time,b_end_time,b_createtime,b_updatetime)
|
values
|
(#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{card,jdbcType=VARCHAR},#{cardId,jdbcType=BIGINT},#{picture,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{subPicture,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpLogin,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{orderMan,jdbcType=INTEGER},#{orderWoman,jdbcType=INTEGER},#{state,jdbcType=BIGINT},#{sex,jdbcType=INTEGER},#{showType,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{minAndroidVersionCode,jdbcType=INTEGER},#{minIOSVersionCode,jdbcType=INTEGER},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP})</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into yeshi_ec_special
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">b_id,</if>
|
<if test="name != null">b_name,</if>
|
<if test="card != null">b_card,</if>
|
<if test="cardId != null">b_card_id,</if>
|
<if test="picture != null">b_main_picture,</if>
|
<if test="icon != null">b_icon,</if>
|
<if test="subPicture != null">b_sub_picture,</if>
|
<if test="jumpDetail != null">b_jumpid,</if>
|
<if test="params != null">b_params,</if>
|
<if test="jumpLogin != null">b_jump_login,</if>
|
<if test="orderby != null">b_orderby,</if>
|
<if test="orderMan != null">b_order_man,</if>
|
<if test="orderWoman != null">b_order_woman,</if>
|
<if test="state != null">b_state,</if>
|
<if test="sex != null">b_sex,</if>
|
<if test="showType != null">b_show_type,</if>
|
<if test="remark != null">b_remark,</if>
|
<if test="minAndroidVersionCode != null">b_min_android_version_code,</if>
|
<if test="minIOSVersionCode != null">b_min_ios_version_code,</if>
|
<if test="startTime != null">b_start_time,</if>
|
<if test="endTime != null">b_end_time,</if>
|
<if test="createtime != null">b_createtime,</if>
|
<if test="updatetime != null">b_updatetime,</if>
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="name != null">#{name,jdbcType=VARCHAR},</if>
|
<if test="card != null">#{card,jdbcType=VARCHAR},</if>
|
<if test="cardId != null">#{cardId,jdbcType=BIGINT},</if>
|
<if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
|
<if test="icon != null">#{icon,jdbcType=VARCHAR},</if>
|
<if test="subPicture != null">#{subPicture,jdbcType=VARCHAR},</if>
|
<if test="jumpDetail != null">#{jumpDetail.id,jdbcType=BIGINT},</if>
|
<if test="params != null">#{params,jdbcType=VARCHAR},</if>
|
<if test="jumpLogin != null">#{jumpLogin,jdbcType=VARCHAR},</if>
|
<if test="orderby != null">#{orderby,jdbcType=INTEGER},</if>
|
<if test="orderMan != null">#{orderMan,jdbcType=INTEGER},</if>
|
<if test="orderWoman != null">#{orderWoman,jdbcType=INTEGER},</if>
|
<if test="state != null">#{state,jdbcType=BIGINT},</if>
|
<if test="sex != null">#{sex,jdbcType=INTEGER},</if>
|
<if test="showType != null">#{showType,jdbcType=VARCHAR},</if>
|
<if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
|
<if test="minAndroidVersionCode != null">#{minAndroidVersionCode,jdbcType=INTEGER},</if>
|
<if test="minIOSVersionCode != null">#{minIOSVersionCode,jdbcType=INTEGER},</if>
|
<if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
|
<if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
|
<if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
|
<if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special">update
|
yeshi_ec_special set b_name = #{name,jdbcType=VARCHAR},b_card =
|
#{card,jdbcType=VARCHAR},b_card_id =
|
#{cardId,jdbcType=BIGINT},b_main_picture =
|
#{picture,jdbcType=VARCHAR},b_icon =
|
#{icon,jdbcType=VARCHAR},b_sub_picture =
|
#{subPicture,jdbcType=VARCHAR},b_jumpid =
|
#{jumpDetail.id,jdbcType=BIGINT},b_params =
|
#{params,jdbcType=VARCHAR},b_jump_login =
|
#{jumpLogin,jdbcType=VARCHAR},b_orderby =
|
#{orderby,jdbcType=INTEGER},b_order_man =
|
#{orderMan,jdbcType=INTEGER},b_order_woman =
|
#{orderWoman,jdbcType=INTEGER},b_state =
|
#{state,jdbcType=BIGINT},b_show_type =
|
#{showType,jdbcType=VARCHAR},b_remark =
|
#{remark,jdbcType=VARCHAR},b_min_android_version_code = #{minAndroidVersionCode,jdbcType=INTEGER},b_min_ios_version_code = #{minIOSVersionCode,jdbcType=INTEGER},
|
b_start_time = #{startTime,jdbcType=TIMESTAMP},b_end_time = #{endTime,jdbcType=TIMESTAMP},b_createtime =
|
#{createtime,jdbcType=TIMESTAMP},b_updatetime =
|
#{updatetime,jdbcType=TIMESTAMP},b_sex=#{sex,jdbcType=INTEGER} where
|
b_id = #{id,jdbcType=BIGINT}</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special">
|
update yeshi_ec_special
|
<set>
|
<if test="name != null">b_name=#{name,jdbcType=VARCHAR},</if>
|
<if test="card != null">b_card=#{card,jdbcType=VARCHAR},</if>
|
<if test="cardId != null">b_card_id=#{cardId,jdbcType=BIGINT},</if>
|
<if test="picture != null">b_main_picture=#{picture,jdbcType=VARCHAR},</if>
|
<if test="icon != null">b_icon=#{icon,jdbcType=VARCHAR},</if>
|
<if test="subPicture != null">b_sub_picture=#{subPicture,jdbcType=VARCHAR},</if>
|
<if test="jumpDetail != null">b_jumpid=#{jumpDetail.id,jdbcType=BIGINT},</if>
|
<if test="params != null">b_params=#{params,jdbcType=VARCHAR},</if>
|
<if test="jumpLogin != null">b_jump_login=#{jumpLogin,jdbcType=VARCHAR},</if>
|
<if test="orderby != null">b_orderby=#{orderby,jdbcType=INTEGER},</if>
|
<if test="orderMan != null">b_order_man=#{orderMan,jdbcType=INTEGER},</if>
|
<if test="orderWoman != null">b_order_woman=#{orderWoman,jdbcType=INTEGER},</if>
|
<if test="state != null">b_state=#{state,jdbcType=BIGINT},</if>
|
<if test="sex != null">b_sex=#{sex,jdbcType=INTEGER},</if>
|
<if test="showType != null">b_show_type=#{showType,jdbcType=VARCHAR},</if>
|
<if test="remark != null">b_remark=#{remark,jdbcType=VARCHAR},</if>
|
<if test="minAndroidVersionCode != null">b_min_android_version_code=#{minAndroidVersionCode,jdbcType=INTEGER},</if>
|
<if test="minIOSVersionCode != null">b_min_ios_version_code=#{minIOSVersionCode,jdbcType=INTEGER},</if>
|
<if test="startTime != null">b_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
|
<if test="endTime != null">b_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
|
<if test="createtime != null">b_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
|
<if test="updatetime != null">b_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
|
</set>
|
where b_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<sql id="Sex_Screen">
|
<!-- 通用版 -->
|
<if test="sex == 0">
|
AND (sp.`b_sex`= 120 OR sp.`b_sex`= 0 OR sp.`b_sex` = 10
|
OR sp.`b_sex` =
|
20)
|
ORDER BY sp.`b_orderby`
|
</if>
|
<!-- 女版 -->
|
<if test="sex == 1">
|
AND (sp.`b_sex`= 120 OR sp.`b_sex`= 1 OR sp.`b_sex` = 10
|
OR sp.`b_sex` =
|
12)
|
ORDER BY sp.`b_order_woman`
|
</if>
|
<!-- 男版 -->
|
<if test="sex == 2">
|
AND (sp.`b_sex`= 120 OR sp.`b_sex`= 2 OR sp.`b_sex` = 20
|
OR sp.`b_sex` =
|
12)
|
ORDER BY sp.`b_order_man`
|
</if>
|
</sql>
|
|
|
<delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
|
delete from yeshi_ec_special WHERE b_id in
|
<foreach collection="list" item="item" open="(" close=")"
|
separator=",">#{item}</foreach>
|
</delete>
|
|
<delete id="deleteBatchByCardID" parameterType="java.util.List">
|
delete from yeshi_ec_special WHERE b_card_id in
|
<foreach collection="list" item="item" open="(" close=")"
|
separator=",">#{item}</foreach>
|
</delete>
|
|
<select id="queryByListPrimaryKey" parameterType="java.util.List"
|
resultMap="BaseResultMap">
|
SELECT
|
<include refid="Base_Column_List" />
|
FROM yeshi_ec_special
|
WHERE b_id in
|
<foreach collection="list" item="item" open="(" close=")"
|
separator=",">#{item}</foreach>
|
</select>
|
|
<select id="queryByListCardID" parameterType="java.util.List"
|
resultMap="BaseResultMap">
|
SELECT
|
<include refid="Base_Column_List" />
|
FROM yeshi_ec_special
|
WHERE b_card_id in
|
<foreach collection="list" item="item" open="(" close=")"
|
separator=",">#{item}</foreach>
|
</select>
|
|
<select id="listQueryByCard" resultMap="BaseResultMap">
|
SELECT
|
<include refid="Base_Column_List" />
|
FROM `yeshi_ec_special` sp
|
WHERE sp.`b_card_id` = #{cardId}
|
<if test='key != null and key != ""'>
|
AND sp.b_name like '%${key}%'
|
</if>
|
<include refid="Sex_Screen" />
|
LIMIT ${start},${count}
|
</select>
|
|
<select id="countlistQueryByCard" resultType="java.lang.Long">
|
SELECT IFNULL(count(b_id),0) FROM `yeshi_ec_special` sp
|
WHERE
|
sp.`b_card_id` = #{cardId}
|
<if test='key != null and key != ""'>
|
AND sp.b_name like '%${key}%'
|
</if>
|
<include refid="Sex_Screen" />
|
</select>
|
|
<select id="getDefaultMaxOrder" resultType="java.lang.Integer">
|
SELECT
|
IFNULL(MAX(pp.b_orderby),0) FROM yeshi_ec_special pp
|
WHERE
|
pp.`b_card_id` = #{cardId}
|
</select>
|
|
<select id="getManMaxOrder" resultType="java.lang.Integer">
|
SELECT
|
IFNULL(MAX(pp.b_order_man),0) FROM yeshi_ec_special pp
|
WHERE
|
pp.`b_card_id` = #{cardId}
|
</select>
|
|
|
<select id="getWomanMaxOrder" resultType="java.lang.Integer">
|
SELECT
|
IFNULL(MAX(pp.b_order_woman),0) FROM yeshi_ec_special pp
|
WHERE
|
pp.`b_card_id` = #{cardId}
|
</select>
|
|
|
<select id="getOrderByCardID" resultMap="BaseResultMap">
|
SELECT
|
<include refid="Base_Column_List" />
|
FROM yeshi_ec_special sp
|
WHERE sp.b_card_id = #{cardId}
|
<!-- 通用版 -->
|
<if test="sex == 0 or sex == 120">
|
AND (sp.`b_sex`= 120 OR sp.`b_sex`= 0 OR sp.`b_sex` = 10 OR
|
sp.`b_sex` = 20)
|
<if test="type == -1">
|
<![CDATA[and sp.b_orderby < #{order}]]>
|
order by sp.b_orderby desc
|
</if>
|
<if test="type == 1">
|
<![CDATA[and sp.b_orderby > #{order} ]]>
|
order by sp.b_orderby
|
</if>
|
</if>
|
<!-- 女版 -->
|
<if test="sex == 1">
|
AND (sp.`b_sex`= 120 OR sp.`b_sex`= 1 OR sp.`b_sex` = 10 OR
|
sp.`b_sex` = 12)
|
<if test="type == -1">
|
<![CDATA[and sp.b_order_woman < #{order}]]>
|
order by sp.b_order_woman desc
|
</if>
|
<if test="type == 1">
|
<![CDATA[and sp.b_order_woman > #{order} ]]>
|
order by sp.b_order_woman
|
</if>
|
</if>
|
<!-- 男版 -->
|
<if test="sex == 2">
|
AND (sp.`b_sex`= 120 OR sp.`b_sex`= 2 OR sp.`b_sex` = 20 OR
|
sp.`b_sex` = 12)
|
<if test="type == -1">
|
<![CDATA[and sp.b_order_man < #{order}]]>
|
order by sp.b_order_man desc
|
</if>
|
<if test="type == 1">
|
<![CDATA[and sp.b_order_man > #{order} ]]>
|
order by sp.b_order_man
|
</if>
|
</if>
|
limit 1
|
</select>
|
|
<select id="listBySystemAndCard" resultMap="BaseResultMap">
|
SELECT p.* FROM
|
`yeshi_ec_special` p LEFT JOIN `yeshi_ec_special_card` c ON
|
p.`b_card_id` = c.`cd_id`
|
LEFT JOIN `yeshi_ec_super_special_card` s ON
|
s.`sp_special_cid` = c.`cd_id`
|
WHERE p.`b_state` = 0 AND c.`cd_state` =
|
0
|
AND c.`cd_card` = #{card} AND s.`sp_system_id` = #{systemId}
|
ORDER BY
|
p.`b_orderby`
|
</select>
|
|
<select id="listByVersion" resultMap="BaseResultMap">
|
SELECT sp.*,c.`cd_bottom_picture` FROM `yeshi_ec_special` sp
|
RIGHT JOIN
|
(SELECT c.* FROM yeshi_ec_special_card c
|
LEFT JOIN `yeshi_ec_special_place` pc ON pc.`sp_id` = c.`cd_place_id`
|
WHERE c.`cd_state` = 0
|
AND IF(c.`cd_start_time` IS NULL,TRUE,c.`cd_start_time`<![CDATA[<=]]>NOW())
|
AND IF(c.`cd_end_time` IS NULL,TRUE,c.`cd_end_time`<![CDATA[>=]]>NOW())
|
AND pc.`sp_key` = #{placeKey}
|
LIMIT 1)c ON sp.`b_card_id` = c.`cd_id`
|
WHERE sp.`b_state` = 0
|
AND IF(sp.b_start_time IS NULL,TRUE, sp.b_start_time<![CDATA[<=]]> NOW())
|
AND IF(sp.b_end_time IS NULL,TRUE, sp.b_end_time <![CDATA[>=]]> NOW())
|
<if test="platform == 1">
|
AND IF(sp.`b_min_android_version_code` IS NOT NULL, #{versionCode}<![CDATA[>=]]> sp.b_min_android_version_code,TRUE)
|
</if>
|
<if test="platform == 2">
|
AND IF(sp.`b_min_ios_version_code` IS NOT NULL, #{versionCode}<![CDATA[>=]]> sp.b_min_ios_version_code,TRUE)
|
</if>
|
ORDER BY sp.`b_orderby`
|
LIMIT ${start},${count}
|
</select>
|
|
|
<select id="listPageBySystemAndCard" resultMap="BaseResultMap">
|
SELECT p.* FROM
|
`yeshi_ec_special` p LEFT JOIN `yeshi_ec_special_card` c ON
|
p.`b_card_id` = c.`cd_id`
|
LEFT JOIN `yeshi_ec_super_special_card` s ON
|
s.`sp_special_cid` = c.`cd_id`
|
WHERE p.`b_state` = 0 AND c.`cd_state` =
|
0 AND s.sp_id is not null
|
AND c.`cd_card` = #{card} AND
|
s.`sp_system_id` = #{systemId}
|
ORDER BY
|
p.`b_orderby`
|
LIMIT
|
${start},${count}
|
</select>
|
|
<select id="listByPlaceKey" resultMap="BaseResultMap">
|
SELECT sp.*,c.`cd_bottom_picture` FROM `yeshi_ec_special` sp
|
RIGHT JOIN
|
(SELECT c.* FROM yeshi_ec_special_card c
|
LEFT JOIN
|
`yeshi_ec_special_place` pc ON pc.`sp_id` = c.`cd_place_id`
|
WHERE
|
c.`cd_state` = 0
|
AND IF(c.`cd_start_time` IS NULL,TRUE,
|
c.`cd_start_time`<![CDATA[<=]]>NOW())
|
AND IF(c.`cd_end_time` IS NULL,TRUE,c.`cd_end_time`<![CDATA[>=]]>NOW())
|
AND pc.`sp_key` = #{placeKey}
|
LIMIT 1)c ON sp.`b_card_id` = c.`cd_id`
|
WHERE sp.`b_state` = 0
|
AND IF(sp.b_start_time IS NULL,TRUE, sp.b_start_time<![CDATA[<=]]> NOW())
|
AND IF(sp.b_end_time IS NULL,TRUE, sp.b_end_time <![CDATA[>=]]> NOW())
|
<if test="platform == 1">
|
AND IF(sp.`b_min_android_version_code` IS NOT NULL, #{versionCode}<![CDATA[>=]]> sp.b_min_android_version_code,TRUE)
|
</if>
|
<if test="platform == 2">
|
AND IF(sp.`b_min_ios_version_code` IS NOT NULL, #{versionCode}<![CDATA[>=]]> sp.b_min_ios_version_code,TRUE)
|
</if>
|
<include refid="Sex_Screen" />
|
<if test="sex == null"> ORDER BY sp.`b_orderby`</if>
|
</select>
|
|
<select id="listByPlaceKeyList" resultMap="BaseResultMap">
|
SELECT sp.*,c.`cd_bottom_picture` FROM `yeshi_ec_special` sp
|
RIGHT JOIN
|
(SELECT c.* FROM yeshi_ec_special_card c
|
LEFT JOIN
|
`yeshi_ec_special_place` pc ON pc.`sp_id` = c.`cd_place_id`
|
WHERE
|
c.`cd_state` = 0
|
AND IF(c.`cd_start_time` IS NULL,TRUE,
|
c.`cd_start_time`<![CDATA[<=]]>NOW())
|
AND IF(c.`cd_end_time` IS NULL,TRUE,c.`cd_end_time`<![CDATA[>=]]>NOW())
|
AND pc.`sp_key` in
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
#{item}
|
</foreach>
|
)c ON sp.`b_card_id` = c.`cd_id`
|
WHERE sp.`b_state` = 0
|
AND IF(sp.b_start_time IS NULL,TRUE, sp.b_start_time<![CDATA[<=]]> NOW())
|
AND IF(sp.b_end_time IS NULL,TRUE, sp.b_end_time <![CDATA[>=]]> NOW())
|
<if test="platform == 1">
|
AND IF(sp.`b_min_android_version_code` IS NOT NULL, #{versionCode}<![CDATA[>=]]> sp.b_min_android_version_code,TRUE)
|
</if>
|
<if test="platform == 2">
|
AND IF(sp.`b_min_ios_version_code` IS NOT NULL, #{versionCode}<![CDATA[>=]]> sp.b_min_ios_version_code,TRUE)
|
</if>
|
<include refid="Sex_Screen" />
|
<if test="sex == null"> ORDER BY sp.`b_orderby`</if>
|
LIMIT ${start},${count}
|
</select>
|
|
|
<select id="countByPlaceKeyList" resultType="Long">
|
SELECT IFNULL(COUNT(sp.`b_id`),0) FROM `yeshi_ec_special` sp
|
RIGHT JOIN
|
(SELECT c.* FROM yeshi_ec_special_card c
|
LEFT JOIN
|
`yeshi_ec_special_place` pc ON pc.`sp_id` = c.`cd_place_id`
|
WHERE
|
c.`cd_state` = 0
|
AND IF(c.`cd_start_time` IS NULL,TRUE,
|
c.`cd_start_time`<![CDATA[<=]]>NOW())
|
AND IF(c.`cd_end_time` IS NULL,TRUE,c.`cd_end_time`<![CDATA[>=]]>NOW())
|
AND pc.`sp_key` in
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
#{item}
|
</foreach>
|
)c ON sp.`b_card_id` = c.`cd_id`
|
WHERE sp.`b_state` = 0
|
AND IF(sp.b_start_time IS NULL,TRUE, sp.b_start_time<![CDATA[<=]]> NOW())
|
AND IF(sp.b_end_time IS NULL,TRUE, sp.b_end_time <![CDATA[>=]]> NOW())
|
<if test="platform == 1">
|
AND IF(sp.`b_min_android_version_code` IS NOT NULL, #{versionCode}<![CDATA[>=]]> sp.b_min_android_version_code,TRUE)
|
</if>
|
<if test="platform == 2">
|
AND IF(sp.`b_min_ios_version_code` IS NOT NULL, #{versionCode}<![CDATA[>=]]> sp.b_min_ios_version_code,TRUE)
|
</if>
|
<include refid="Sex_Screen" />
|
</select>
|
|
|
<select id="listByPlaceKeyHasLabel" resultMap="ResultLableMap">
|
SELECT sp.*,c.`cd_bottom_picture`,lab.* FROM `yeshi_ec_special` sp
|
RIGHT JOIN
|
(SELECT c.* FROM yeshi_ec_special_card c
|
LEFT JOIN
|
`yeshi_ec_special_place` pc ON pc.`sp_id` = c.`cd_place_id`
|
WHERE
|
c.`cd_state` = 0
|
AND IF(c.`cd_start_time` IS NULL,TRUE,
|
c.`cd_start_time`<![CDATA[<=]]>NOW())
|
AND IF(c.`cd_end_time` IS NULL,TRUE,c.`cd_end_time`<![CDATA[>=]]>NOW())
|
AND pc.`sp_key` in
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
#{item}
|
</foreach>
|
)c ON sp.`b_card_id` = c.`cd_id`
|
LEFT JOIN `yeshi_ec_special_label_map` mp ON mp.`slm_spid` = sp.`b_id`
|
LEFT JOIN (SELECT * FROM yeshi_ec_special_label WHERE sl_state = 1)lab ON lab.sl_id = mp.`slm_lab_id`
|
WHERE sp.`b_state` = 0
|
AND IF(sp.b_start_time IS NULL,TRUE, sp.b_start_time<![CDATA[<=]]> NOW())
|
AND IF(sp.b_end_time IS NULL,TRUE, sp.b_end_time <![CDATA[>=]]> NOW())
|
<if test="platform == 1">
|
AND IF(sp.`b_min_android_version_code` IS NOT NULL, #{versionCode}<![CDATA[>=]]> sp.b_min_android_version_code,TRUE)
|
</if>
|
<if test="platform == 2">
|
AND IF(sp.`b_min_ios_version_code` IS NOT NULL, #{versionCode}<![CDATA[>=]]> sp.b_min_ios_version_code,TRUE)
|
</if>
|
<include refid="Sex_Screen" />
|
<if test="sex == null"> ORDER BY sp.`b_orderby`</if>
|
LIMIT ${start},${count}
|
</select>
|
|
</mapper>
|