167 lines
5.9 KiB
XML
167 lines
5.9 KiB
XML
<?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.ruoyi.xkt.mapper.AdvertRoundMapper">
|
|
|
|
<select id="isStallOverBuy" >
|
|
SELECT
|
|
CASE
|
|
WHEN
|
|
COUNT( id ) >= ( SELECT IFNULL( store_buy_limit, 0 ) FROM advert WHERE id = #{advertId} ) THEN
|
|
TRUE ELSE FALSE
|
|
END AS isOverBuy
|
|
FROM
|
|
advert_round
|
|
WHERE
|
|
round_id = #{roundId}
|
|
AND advert_id = #{advertId}
|
|
AND store_id = #{storeId}
|
|
AND del_flag = 0
|
|
AND launch_status IN
|
|
<foreach item="launchStatus" collection="launchStatusList" open="(" separator="," close=")">
|
|
#{launchStatus}
|
|
</foreach>
|
|
</select>
|
|
|
|
|
|
<select id="selectStoreAdvertPage" parameterType="com.ruoyi.xkt.dto.advertRound.AdvertRoundStorePageDTO"
|
|
resultType="com.ruoyi.xkt.dto.advertRound.AdvertRoundStorePageResDTO">
|
|
SELECT
|
|
ar.id AS advertRoundId,
|
|
a.platform_id,
|
|
s.store_name,
|
|
ar.type_id,
|
|
CONCAT('位置', ar.position) AS position,
|
|
ar.voucher_date,
|
|
ar.start_time,
|
|
ar.end_time,
|
|
ar.pay_price AS payPrice,
|
|
ar.launch_status,
|
|
ar.bidding_status,
|
|
ar.pic_design_type,
|
|
ar.pic_set_type,
|
|
ar.pic_audit_status,
|
|
sf.file_url AS example_pic_url,
|
|
ar.display_type,
|
|
ar.prod_id_str
|
|
FROM
|
|
advert_round ar
|
|
JOIN advert a ON ar.advert_id = a.id
|
|
LEFT JOIN store s ON ar.store_id = s.id
|
|
LEFT JOIN sys_file sf ON ar.pic_id = sf.id
|
|
WHERE
|
|
ar.del_flag = 0
|
|
AND ar.sys_intercept = 0
|
|
AND ar.store_id = #{storeId}
|
|
AND ar.bidding_status IN
|
|
<foreach item="biddingStatus" collection="biddingStatusList" open="(" separator="," close=")">
|
|
#{biddingStatus}
|
|
</foreach>
|
|
<if test="platformId != null "> and a.platform_id = #{platformId}</if>
|
|
<if test="typeId != null "> and ar.type_id = #{typeId}</if>
|
|
<if test="launchStatus != null "> and ar.launch_status = #{launchStatus}</if>
|
|
<if test="picSetType != null "> and ar.pic_set_type = #{picSetType}</if>
|
|
<if test="picDesignType != null "> and ar.pic_design_type = #{picDesignType}</if>
|
|
<if test="picAuditStatus != null "> and ar.pic_audit_status = #{picAuditStatus}</if>
|
|
<if test="startTime != null "> and ar.start_time >= #{startTime}</if>
|
|
<if test="endTime != null "> and ar.end_time <= #{endTime}</if>
|
|
ORDER BY
|
|
ar.launch_status
|
|
</select>
|
|
|
|
|
|
<select id="selectAdminAdvertPage" parameterType="com.ruoyi.xkt.dto.adminAdvertRound.AdminAdRoundPageDTO"
|
|
resultType="com.ruoyi.xkt.dto.adminAdvertRound.AdminAdRoundPageResDTO">
|
|
SELECT
|
|
ar.id AS advertRoundId,
|
|
ar.symbol,
|
|
s.id AS storeId,
|
|
s.store_name,
|
|
a.tab_id,
|
|
a.platform_id,
|
|
a.play_round,
|
|
ar.type_id,
|
|
ar.display_type,
|
|
ar.voucher_date,
|
|
CONCAT('位置', ar.position) AS position,
|
|
ar.start_time,
|
|
ar.end_time,
|
|
ar.pay_price,
|
|
ar.launch_status,
|
|
ar.bidding_status,
|
|
ar.pic_design_type,
|
|
ar.pic_set_type,
|
|
ar.pic_audit_status,
|
|
ar.sys_intercept,
|
|
a.pic_pixel,
|
|
a.pic_size,
|
|
sf.file_url AS advertPicUrl,
|
|
ar.prod_id_str
|
|
FROM
|
|
advert_round ar
|
|
JOIN advert a ON ar.advert_id = a.id
|
|
LEFT JOIN store s ON ar.store_id = s.id
|
|
LEFT JOIN sys_file sf ON ar.pic_id = sf.id
|
|
WHERE
|
|
ar.del_flag = 0
|
|
AND ar.launch_status = #{launchStatus}
|
|
<if test="platformId != null "> and a.platform_id = #{platformId}</if>
|
|
<if test="storeId != null "> and ar.store_id = #{storeId}</if>
|
|
<if test="typeId != null "> and ar.type_id = #{typeId}</if>
|
|
<if test="picDesignType != null "> and ar.pic_design_type = #{picDesignType}</if>
|
|
<if test="picAuditStatus != null "> and ar.pic_audit_status = #{picAuditStatus}</if>
|
|
<if test="roundId != null "> and ar.round_id = #{roundId}</if>
|
|
<if test="sysIntercept != null "> and ar.sys_intercept = #{sysIntercept}</if>
|
|
ORDER BY
|
|
ar.id,
|
|
ar.position
|
|
</select>
|
|
|
|
|
|
<update id="updateAttrNull">
|
|
UPDATE advert_round
|
|
SET voucher_date = NULL,
|
|
store_id = NULL,
|
|
pay_price = NULL,
|
|
bidding_status = NULL,
|
|
bidding_temp_status = NULL,
|
|
pic_audit_status = NULL,
|
|
pic_set_type = NULL,
|
|
pic_id = NULL,
|
|
prod_id_str = NULL,
|
|
pic_design_type = NULL,
|
|
sys_intercept = 0
|
|
WHERE
|
|
id = #{advertRoundId}
|
|
</update>
|
|
|
|
<select id="selectMostPopulars">
|
|
SELECT
|
|
advert_id
|
|
FROM
|
|
advert_round
|
|
WHERE
|
|
pay_price IS NOT NULL
|
|
AND store_id IS NOT NULL
|
|
AND sys_intercept = 0
|
|
GROUP BY
|
|
advert_id
|
|
ORDER BY
|
|
COUNT( advert_id ) DESC
|
|
LIMIT 8
|
|
</select>
|
|
|
|
<select id="statusCount" resultType="com.ruoyi.xkt.dto.adminAdvertRound.AdminAdRoundStatusCountResDTO">
|
|
SELECT
|
|
SUM( CASE WHEN ar.launch_status = 2 THEN 1 ELSE 0 END ) AS unLaunchCount,
|
|
SUM( CASE WHEN ar.launch_status = 1 THEN 1 ELSE 0 END ) AS launchCount
|
|
FROM
|
|
advert_round ar
|
|
WHERE
|
|
ar.del_flag = 0
|
|
AND ar.create_time BETWEEN #{sixMonthAgo} AND #{now}
|
|
</select>
|
|
|
|
|
|
</mapper> |