2025-03-17 17:23:26 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
< !DOCTYPE mapper
2025-03-21 14:54:15 +08:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2025-03-17 17:23:26 +08:00
<mapper namespace= "com.ruoyi.busi.mapper.BusiNoticeMapper" >
2025-03-28 18:59:14 +08:00
<select id= "queryListPage" resultType= "com.ruoyi.busi.vo.BusiNoticeVo" >
2025-03-21 14:54:15 +08:00
select main.id, main.user_id, main.title, main.platform_code, main.province, main.city, main.fee_down, main.fee_up, main.is_self_price, main.gift_detail,
main.gift_price, main.end_date, main.brand, main.is_show_brand, main.need_num, main.fans_down, main.fans_up, main.is_eligible, main.pic, main.collect, main.detail, main.images,
main.blogger_types, main.is_show_tel, main.wechat, main.tel, main.group_image, main.is_use_coupon, main.approval_status, main.approval_user_id, main.approval_time,
2025-04-25 09:58:34 +08:00
main.approval_remark, main.creator, main.create_time, main.updater, main.update_time, main.del_flag,main.is_platform_free,main.is_urgent,
2025-03-28 18:59:14 +08:00
uTable.nick_name as userNickName,auditTable.nick_name as approvalUserName,ifnull(noticeView.view_num,0) as viewNum,
2025-03-21 14:54:15 +08:00
bTable.title as platformName
from dl_busi_notice main
left join sys_user uTable on main.user_id = uTable.user_id
2025-03-28 18:59:14 +08:00
left join sys_user auditTable on main.approval_user_id = auditTable.user_id
2025-03-21 14:54:15 +08:00
left join dl_base_category bTable on main.platform_code = bTable.code
2025-03-28 18:59:14 +08:00
left join dl_busi_notice_view noticeView on noticeView.id = main.id
2025-03-17 17:23:26 +08:00
<where >
2025-03-28 18:59:14 +08:00
main.del_flag = '0' and main.approval_status != 8
2025-03-21 14:54:15 +08:00
<if test= "entity.userNickName != null " > and uTable.nick_name like concat('%', #{entity.userNickName}, '%')</if>
2025-03-29 11:23:00 +08:00
<if test= "entity.userId != null " > and main.user_id = #{entity.userId}</if>
2025-03-21 14:54:15 +08:00
<if test= "entity.province != null " > and main.province = #{entity.province}</if>
<if test= "entity.city != null " > and main.city = #{entity.city}</if>
<if test= "entity.title != null and entity.title != ''" > and main.title like concat('%', #{entity.title}, '%')</if>
<if test= "entity.platformCode != null and entity.platformCode != ''" > and main.platform_code = #{entity.platformCode}</if>
2025-04-25 09:58:34 +08:00
<if test= "entity.isUrgent != null and entity.isUrgent != ''" > and main.is_urgent = #{entity.isUrgent}</if>
<if test= "entity.isPlatformFree != null and entity.isPlatformFree != ''" > and main.is_platform_free = #{entity.isPlatformFree}</if>
2025-03-21 14:54:15 +08:00
<if test= "entity.params.beginFeeDown != null and entity.params.beginFeeDown != ''" >
and main.fee_down <![CDATA[>= ]]> #{entity.params.beginFeeDown}
</if>
<if test= " entity.params.endFeeDown != null and entity.params.endFeeDown != ''" >
and main.fee_down <![CDATA[<= ]]> #{entity.params.endFeeDown}
</if>
<if test= "entity.params.beginFansDown != null and entity.params.beginFansDown != ''" >
and main.fans_down <![CDATA[>= ]]> #{entity.params.beginFansDown}
</if>
<if test= " entity.params.endFansDown != null and entity.params.endFansDown != ''" >
and main.fans_down <![CDATA[<= ]]> #{entity.params.endFansDown}
</if>
<if test= "entity.brand != null and entity.brand != ''" > and main.brand like concat('%', #{entity.brand}, '%')</if>
<if test= "entity.pic != null and entity.pic != ''" > and main.pic = #{entity.pic}</if>
<if test= "entity.collect != null and entity.collect != ''" > and main.collect = #{entity.collect}</if>
<if test= "entity.bloggerTypes != null and entity.bloggerTypes != ''" > and main.blogger_types = #{entity.bloggerTypes}</if>
<if test= "entity.isUseCoupon != null " > and main.is_use_coupon = #{entity.isUseCoupon}</if>
<if test= "entity.approvalStatus != null and entity.approvalStatus != ''" > and main.approval_status = #{entity.approvalStatus}</if>
<if test= "entity.params.beginCreateTime != null and entity.params.beginCreateTime != '' and entity.params.endCreateTime != null and entity.params.endCreateTime != ''" > and main.create_time between #{entity.params.beginCreateTime} and #{entity.params.endCreateTime}</if>
2025-03-17 17:23:26 +08:00
</where>
2025-03-28 18:59:14 +08:00
order by FIELD(main.approval_status,0,1,9,2) asc, main.create_time desc
2025-03-17 17:23:26 +08:00
</select>
2025-03-22 11:35:26 +08:00
<select id= "queryListByUserId" resultType= "com.ruoyi.busi.vo.BusiNoticeVo" >
SELECT
main.*,
dbns.status,
dbns.is_super
FROM
dl_busi_notice main
LEFT JOIN dl_busi_notice_sign dbns ON main.id = dbns.notice_id AND dbns.del_flag = 0
WHERE
dbns.user_id = #{userId}
2025-03-29 11:23:00 +08:00
order by dbns.create_time desc
2025-03-22 11:35:26 +08:00
</select>
2025-03-26 10:08:42 +08:00
<select id= "queryAppListPage" resultType= "com.ruoyi.busi.vo.BusiNoticeVo" >
SELECT
dbn.*,
dbnv.view_num AS viewNum,
su.avatar,
2025-04-14 14:24:41 +08:00
su.nick_name AS userNickName,
count(sign.id) as reportNum
2025-03-26 10:08:42 +08:00
FROM
dl_busi_notice dbn
LEFT JOIN dl_busi_notice_view dbnv ON dbn.id = dbnv.id
LEFT JOIN sys_user su ON dbn.user_id = su.user_id
2025-04-14 14:24:41 +08:00
left join dl_busi_notice_sign sign on sign.notice_id = dbn.id and sign.del_flag = 0
2025-03-26 10:08:42 +08:00
WHERE
2025-04-25 09:58:34 +08:00
dbn.del_flag = 0 and dbn.end_date > = CURDATE()
2025-03-26 10:08:42 +08:00
AND (dbn.approval_status = '1')
<if test= "entity.gift!=null and entity.gift!=''" >
2025-03-27 09:49:52 +08:00
AND ( dbn.gift_detail IS NOT NULL AND dbn.gift_detail != '' )
2025-03-26 10:08:42 +08:00
</if>
2025-04-25 21:44:06 +08:00
<if test= "entity.cityName!=null and entity.cityName!=''" >
AND dbn.city =#{entity.cityName}
</if>
2025-03-26 10:08:42 +08:00
<if test= "entity.platformCode!=null and entity.platformCode!=''" >
AND ( dbn.platform_code =#{entity.platformCode} )
</if>
2025-04-25 09:58:34 +08:00
<if test= "entity.isUrgent != null and entity.isUrgent != ''" > and dbn.is_urgent = #{entity.isUrgent}</if>
<if test= "entity.isPlatformFree != null and entity.isPlatformFree != ''" > and dbn.is_platform_free = #{entity.isPlatformFree}</if>
2025-03-26 10:08:42 +08:00
<if test= "entity.bloggerType!=null and entity.bloggerType!=''" >
AND ( dbn.blogger_types LIKE CONCAT('%',#{entity.bloggerType},'%') )
</if>
<if test= "entity.searchValue!=null and entity.searchValue!=''" >
AND ( dbn.title LIKE CONCAT('%',#{entity.searchValue},'%') OR
dbn.detail LIKE CONCAT('%',#{entity.searchValue},'%') )
</if>
<if test= "entity.rewardType=='money'" >
2025-03-27 09:49:52 +08:00
AND ( dbn.fee_down IS NOT NULL OR dbn.fee_up IS NOT NULL )
2025-03-26 10:08:42 +08:00
</if>
<if test= "entity.rewardType=='gift'" >
2025-03-27 09:49:52 +08:00
AND ( dbn.gift_detail IS NOT NULL AND dbn.gift_detail!='' )
2025-03-26 10:08:42 +08:00
</if>
<if test= "entity.fansUp!=null" >
AND ( dbn.fans_up < =#{entity.fansUp} )
</if>
<if test= "entity.fansDown!=null" >
AND ( dbn.fans_up > =#{entity.fansDown} )
</if>
<if test= "entity.feeUp!=null" >
AND ( dbn.fee_up < =#{entity.feeUp} )
</if>
<if test= "entity.feeDown!=null" >
AND ( dbn.fee_down > =#{entity.feeDown} )
</if>
2025-04-14 14:24:41 +08:00
group by dbn.id
2025-03-26 10:08:42 +08:00
ORDER BY
2025-04-25 09:58:34 +08:00
<choose >
<when test= "entity.sortBy=='new'" >
-- 查最新的 --
dbn.create_time DESC
</when>
<when test= "entity.sortBy=='money'" >
-- 查高奖励 --
dbn.fee_up DESC
</when>
<otherwise >
-- 默认正序排列 --
dbn.create_time DESC
</otherwise>
</choose>
2025-03-26 10:08:42 +08:00
</select>
2025-03-29 11:10:32 +08:00
<select id= "selectByIdVo" resultType= "com.ruoyi.busi.vo.BusiNoticeVo" >
2025-04-15 10:22:12 +08:00
select main.*,
2025-03-29 11:10:32 +08:00
uTable.nick_name as userNickName,ifnull(noticeView.view_num,0) as viewNum,
bTable.title as platformName
from dl_busi_notice main
left join sys_user uTable on main.user_id = uTable.user_id
left join dl_base_category bTable on main.platform_code = bTable.code
left join dl_busi_notice_view noticeView on noticeView.id = main.id
WHERE
main.id = #{noticeId}
</select>
2025-03-29 16:09:37 +08:00
<select id= "appFootprintList" resultType= "com.ruoyi.busi.vo.BusiNoticeVo" >
SELECT
dbn.*,
dbnv.view_num AS viewNum,
su.avatar,
2025-04-14 14:24:41 +08:00
su.nick_name AS userNickName,
count(sign.id) as reportNum
2025-03-29 16:09:37 +08:00
FROM
dl_busi_notice dbn
LEFT JOIN dl_busi_notice_view dbnv ON dbn.id = dbnv.id
inner join dl_member_footprint footprint on footprint.notice_id = dbn.id and footprint.user_id = #{entity.userId}
LEFT JOIN sys_user su ON dbn.user_id = su.user_id
2025-04-14 14:24:41 +08:00
left join dl_busi_notice_sign sign on sign.notice_id = dbn.id and sign.del_flag = 0
2025-03-29 16:09:37 +08:00
WHERE
dbn.del_flag = 0
AND (dbn.approval_status = '1')
2025-04-07 15:14:17 +08:00
and dbn.end_date > = CURDATE()
2025-03-29 16:09:37 +08:00
<if test= "entity.gift!=null and entity.gift!=''" >
AND ( dbn.gift_detail IS NOT NULL AND dbn.gift_detail != '' )
</if>
<if test= "entity.platformCode!=null and entity.platformCode!=''" >
AND ( dbn.platform_code =#{entity.platformCode} )
</if>
2025-04-25 09:58:34 +08:00
<if test= "entity.isUrgent != null and entity.isUrgent != ''" > and dbn.is_urgent = #{entity.isUrgent}</if>
<if test= "entity.isPlatformFree != null and entity.isPlatformFree != ''" > and dbn.is_platform_free = #{entity.isPlatformFree}</if>
2025-03-29 16:09:37 +08:00
<if test= "entity.bloggerType!=null and entity.bloggerType!=''" >
AND ( dbn.blogger_types LIKE CONCAT('%',#{entity.bloggerType},'%') )
</if>
<if test= "entity.searchValue!=null and entity.searchValue!=''" >
AND ( dbn.title LIKE CONCAT('%',#{entity.searchValue},'%') OR
dbn.detail LIKE CONCAT('%',#{entity.searchValue},'%') )
</if>
<if test= "entity.rewardType=='money'" >
AND ( dbn.fee_down IS NOT NULL OR dbn.fee_up IS NOT NULL )
</if>
<if test= "entity.rewardType=='gift'" >
AND ( dbn.gift_detail IS NOT NULL AND dbn.gift_detail!='' )
</if>
<if test= "entity.fansUp!=null" >
AND ( dbn.fans_up < =#{entity.fansUp} )
</if>
<if test= "entity.fansDown!=null" >
AND ( dbn.fans_up > =#{entity.fansDown} )
</if>
<if test= "entity.feeUp!=null" >
AND ( dbn.fee_up < =#{entity.feeUp} )
</if>
<if test= "entity.feeDown!=null" >
AND ( dbn.fee_down > =#{entity.feeDown} )
</if>
2025-04-14 14:24:41 +08:00
group by dbn.id
2025-03-29 16:09:37 +08:00
ORDER BY
<choose >
<when test= "entity.sortBy=='new'" >
-- 查最新的 --
dbn.create_time DESC
</when>
<when test= "entity.sortBy=='money'" >
-- 查高奖励 --
dbn.fee_up DESC
</when>
<otherwise >
-- 默认正序排列 --
dbn.create_time ASC
</otherwise>
</choose>
2025-04-25 09:58:34 +08:00
limit #{num}
2025-03-29 16:09:37 +08:00
</select>
2025-04-03 15:49:27 +08:00
<select id= "subscribeList" resultType= "com.ruoyi.busi.vo.BusiNoticeVo" >
SELECT
dbn.*,
dbnv.view_num AS viewNum,
su.avatar,
2025-04-14 14:24:41 +08:00
su.nick_name AS userNickName,
count(sign.id) as reportNum
2025-04-03 15:49:27 +08:00
FROM
dl_busi_notice dbn
LEFT JOIN dl_busi_notice_view dbnv ON dbn.id = dbnv.id
LEFT JOIN sys_user su ON dbn.user_id = su.user_id
2025-04-14 14:24:41 +08:00
left join dl_busi_notice_sign sign on sign.notice_id = dbn.id and sign.del_flag = 0
2025-04-03 15:49:27 +08:00
WHERE
dbn.del_flag = 0
AND (dbn.approval_status = '1')
2025-04-07 15:14:17 +08:00
and dbn.end_date > = CURDATE()
2025-04-14 14:24:41 +08:00
<if test= "entity.platformCode!=null and entity.platformCode.size>0" >
2025-04-07 09:16:54 +08:00
and dbn.platform_code IN
<foreach collection= "entity.platformCode" item= "it" open= "(" close= ")" separator= "," >
-- platform_code 包含it
#{it}
</foreach>
2025-04-03 15:49:27 +08:00
</if>
2025-04-14 14:24:41 +08:00
<if test= "entity.bloggerTypeCode!=null and entity.bloggerTypeCode.size>0" >
2025-04-07 09:16:54 +08:00
and
<foreach collection= "entity.bloggerTypeCode" item= "it" open= "(" close= ")" separator= "or" >
dbn.blogger_types like concat('%',#{it},'%')
</foreach>
</if>
2025-04-07 15:14:17 +08:00
<if test= "entity.settleTypeCode!=null and entity.settleTypeCode!=''" >
and dbn.settle_type = #{entity.settleTypeCode}
2025-04-03 15:49:27 +08:00
</if>
2025-04-07 15:14:17 +08:00
2025-04-14 14:24:41 +08:00
<if test= "entity.keywordsList!=null and entity.keywordsList.size>0 " >
2025-04-07 15:14:17 +08:00
and
<foreach collection= "entity.keywordsList" item= "it" open= "(" close= ")" separator= "or" >
title like concat('%',#{it},'%') or detail like concat('%',#{it},'%') or brand like concat('%',#{it},'%')
</foreach>
2025-04-03 15:49:27 +08:00
</if>
<if test= "entity.fansUp!=null" >
AND ( dbn.fans_up < =#{entity.fansUp} )
</if>
<if test= "entity.fansDown!=null" >
AND ( dbn.fans_up > =#{entity.fansDown} )
</if>
<if test= "entity.feeUp!=null" >
AND ( dbn.fee_up < =#{entity.feeUp} )
</if>
<if test= "entity.feeDown!=null" >
AND ( dbn.fee_down > =#{entity.feeDown} )
</if>
2025-04-25 09:58:34 +08:00
<if test= "entity.isUrgent != null and entity.isUrgent != ''" > and dbn.is_urgent = #{entity.isUrgent}</if>
<if test= "entity.isPlatformFree != null and entity.isPlatformFree != ''" > and dbn.is_platform_free = #{entity.isPlatformFree}</if>
2025-04-14 14:24:41 +08:00
group by dbn.id
2025-04-03 15:49:27 +08:00
ORDER BY
2025-04-14 14:24:41 +08:00
-- 默认正序排列 --
dbn.create_time DESC
2025-04-03 15:49:27 +08:00
</select>
2025-04-07 15:14:17 +08:00
<select id= "loveList" resultType= "com.ruoyi.busi.vo.BusiNoticeVo" >
SELECT
dbn.*,
dbnv.view_num AS viewNum,
su.avatar,
2025-04-14 14:24:41 +08:00
su.nick_name AS userNickName,
count(sign.id) as reportNum
2025-04-07 15:14:17 +08:00
FROM
dl_busi_notice dbn
LEFT JOIN dl_busi_notice_view dbnv ON dbn.id = dbnv.id
LEFT JOIN sys_user su ON dbn.user_id = su.user_id
inner join dl_busi_user_love love on dbn.user_id = love.love_user_id and love.user_id = #{entity.userId}
2025-04-14 14:24:41 +08:00
left join dl_busi_notice_sign sign on sign.notice_id = dbn.id and sign.del_flag = 0
2025-04-07 15:14:17 +08:00
WHERE
dbn.del_flag = 0
AND (dbn.approval_status = '1')
and dbn.end_date > = CURDATE()
2025-04-14 14:24:41 +08:00
group by dbn.id
2025-04-07 15:14:17 +08:00
ORDER BY
2025-04-14 14:24:41 +08:00
dbn.create_time DESC
</select>
<select id= "myNoticeList" resultType= "com.ruoyi.busi.vo.BusiNoticeVo" >
SELECT
dbn.*,
dbnv.view_num AS viewNum,
su.avatar,
su.nick_name AS userNickName,
count(sign.id) as reportNum,
2025-04-15 10:22:12 +08:00
mySign.create_time as signTime,
2025-04-14 14:24:41 +08:00
CASE
2025-04-25 14:29:54 +08:00
WHEN mySign.status = '01' AND dbn.end_date > = CURDATE() THEN '审核中'
WHEN mySign.status = '02' THEN '已通过'
WHEN mySign.status = '01' AND dbn.end_date < CURDATE() THEN '未合作'
2025-04-14 14:24:41 +08:00
ELSE '已过期'
END AS signStatus
FROM
dl_busi_notice dbn
LEFT JOIN dl_busi_notice_view dbnv ON dbn.id = dbnv.id
LEFT JOIN sys_user su ON dbn.user_id = su.user_id
2025-04-15 10:22:12 +08:00
LEFT join dl_busi_notice_sign sign on sign.notice_id = dbn.id and sign.del_flag = 0
2025-04-25 14:29:54 +08:00
inner join dl_busi_notice_sign mySign on dbn.id = mySign.notice_id and dbn.del_flag = 0 and mySign.user_id = #{entity.userId}
2025-04-14 14:24:41 +08:00
WHERE
dbn.del_flag = 0
AND (dbn.approval_status = '1')
<if test= "entity.reportStatus!=null and entity.reportStatus!='' " >
<choose >
<when test= "entity.reportStatus=='审核中'" >
2025-04-25 14:29:54 +08:00
and mySign.status ='01' and dbn.end_date > = CURDATE()
2025-04-14 14:24:41 +08:00
</when>
<when test= "entity.reportStatus=='已通过'" >
2025-04-25 14:29:54 +08:00
and mySign.status ='02'
2025-04-14 14:24:41 +08:00
</when>
<when test= "entity.reportStatus=='未合作'" >
2025-04-25 14:29:54 +08:00
and mySign.status ='01' and dbn.end_date < CURDATE()
2025-04-14 14:24:41 +08:00
</when>
</choose>
</if>
group by dbn.id
ORDER BY
dbn.create_time DESC
2025-04-07 15:14:17 +08:00
</select>
2025-04-15 10:22:12 +08:00
<select id= "myPublishNoticeList" resultType= "com.ruoyi.busi.vo.BusiNoticeVo" >
SELECT
dbn.*,
dbnv.view_num AS viewNum,
su.avatar,
su.nick_name AS userNickName,
count(sign.id) as reportNum,
CASE
WHEN dbn.end_date < CURDATE() THEN '已关闭'
WHEN dbn.approval_status = '0' THEN '审核中'
WHEN dbn.approval_status = '1' THEN '已通过'
WHEN dbn.approval_status = '9' THEN '审核不通过'
WHEN dbn.approval_status = '2' THEN '已关闭'
ELSE '已过期'
END AS reportStatusText
FROM
dl_busi_notice dbn
LEFT JOIN dl_busi_notice_view dbnv ON dbn.id = dbnv.id
LEFT JOIN sys_user su ON dbn.user_id = su.user_id
LEFT join dl_busi_notice_sign sign on sign.notice_id = dbn.id and sign.del_flag = 0
WHERE
dbn.del_flag = 0 and dbn.approval_status !=8 and dbn.user_id = #{entity.userId}
<if test= "entity.status!=null and entity.status!='' " >
<choose >
<when test= "entity.status=='进行中'" >
and dbn.approval_status !='2' and dbn.end_date > = CURDATE()
</when>
<when test= "entity.status=='已关闭'" >
and (dbn.approval_status ='2' or dbn.end_date < CURDATE())
</when>
</choose>
</if>
group by dbn.id
ORDER BY
dbn.create_time DESC
</select>
2025-03-21 14:54:15 +08:00
</mapper>