|
@@ -106,17 +106,23 @@
|
|
|
select u.authUserId,u.name,u.shopType,group_concat(cb.name) as brandName,group_concat(cb.id) as brandId,
|
|
|
u.mobile,u.linkMan,u.status as shopStatus,u.createTime,
|
|
|
(select au.name from cm_brand_auth_user au where au.authUserId = u.createBy) as createBy,
|
|
|
- ((select count(*)from cm_brand_auth where authUserId = u.authUserId and auditStatus = 2) +
|
|
|
- (select count(*) from cm_brand_auth_product p left join cm_brand_auth a on p.authId = a.id
|
|
|
- where a.authUserId = u.authUserId and p.auditStatus = 2)) as waitAuditNum,
|
|
|
- (select count(*) from cm_brand_article a where a.authUserId = u.authUserId and a.auditStatus = 2) as
|
|
|
- articleWaitNum,
|
|
|
- (select count(*) from cm_brand_image i where i.authUserId = u.authUserId and i.auditStatus = 2) as imageWaitNum,
|
|
|
- (select count(*) from cm_brand_video v where v.authUserId = u.authUserId and v.auditStatus = 2) as videoWaitNum,
|
|
|
- (select count(*) from cm_brand_file f where f.authUserId = u.authUserId and f.auditStatus = 2) as fileWaitNum
|
|
|
+ (ifnull(aw.authWaitNum,0)+ifnull(pw.productWaitNum,0)) as waitAuditNum,
|
|
|
+ ifnull(arw.articleWaitNum,0) as articleWaitNum,
|
|
|
+ ifnull(iw.imageWaitNum,0) as imageWaitNum,
|
|
|
+ ifnull(vw.videoWaitNum,0) as videoWaitNum,
|
|
|
+ ifnull(fw.fileWaitNum,0) as fileWaitNum,
|
|
|
+ ifnull(dw.doctorWaitNum,0) as doctorWaitNum
|
|
|
from cm_brand_auth_user u
|
|
|
left join cm_brand_auth_shop_info s on u.authUserId = s.authUserId
|
|
|
left join cm_brand cb on cb.id = s.brandId
|
|
|
+ left join (select authUserId, count(*) as authWaitNum from cm_brand_auth where auditStatus = 2 group by authUserId) aw on u.authUserId = aw.authUserId
|
|
|
+ left join (select a.authUserId, count(*) as productWaitNum from cm_brand_auth_product p left join cm_brand_auth a on p.authId = a.id
|
|
|
+ where p.auditStatus = 2 group by a.authUserId) pw on u.authUserId = pw.authUserId
|
|
|
+ left join (select authUserId, count(*) as articleWaitNum from cm_brand_article where auditStatus = 2 group by authUserId) arw on u.authUserId = arw.authUserId
|
|
|
+ left join (select authUserId, count(*) as imageWaitNum from cm_brand_image where auditStatus = 2 group by authUserId) iw on u.authUserId = iw.authUserId
|
|
|
+ left join (select authUserId, count(*) as videoWaitNum from cm_brand_video where auditStatus = 2 group by authUserId) vw on u.authUserId = vw.authUserId
|
|
|
+ left join (select authUserId, count(*) as fileWaitNum from cm_brand_file where auditStatus = 2 group by authUserId) fw on u.authUserId = fw.authUserId
|
|
|
+ left join (select authUserId, count(*) as doctorWaitNum from cm_brand_doctor where auditStatus = 2 group by authUserId) dw on u.authUserId = dw.authUserId
|
|
|
where u.userIdentity = 2
|
|
|
<if test="shopName != null and shopName !=''">
|
|
|
AND u.name like CONCAT('%',#{shopName},'%')
|
|
@@ -133,13 +139,40 @@
|
|
|
<if test="linkMan != null and linkMan !=''">
|
|
|
AND u.linkMan like CONCAT('%',#{linkMan},'%')
|
|
|
</if>
|
|
|
+ <if test="lowerAuditStatus != null">
|
|
|
+ <if test="0 == lowerAuditStatus">
|
|
|
+ <if test="listType == 2">
|
|
|
+ and (ifnull(aw.authWaitNum,0)+ifnull(pw.productWaitNum,0)) > 0
|
|
|
+ </if>
|
|
|
+ <if test="listType == 3">
|
|
|
+ and (ifnull(articleWaitNum,0) + ifnull(imageWaitNum,0) + ifnull(videoWaitNum,0) + ifnull(fileWaitNum,0)) > 0
|
|
|
+ </if>
|
|
|
+ <if test="listType == 4">
|
|
|
+ and ifnull(dw.doctorWaitNum,0) > 0
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="1 == lowerAuditStatus">
|
|
|
+ <if test="listType == 2">
|
|
|
+ and (ifnull(aw.authWaitNum,0)+ifnull(pw.productWaitNum,0)) = 0
|
|
|
+ </if>
|
|
|
+ <if test="listType == 3">
|
|
|
+ and (ifnull(articleWaitNum,0) + ifnull(imageWaitNum,0) + ifnull(videoWaitNum,0) + ifnull(fileWaitNum,0)) = 0
|
|
|
+ </if>
|
|
|
+ <if test="listType == 4">
|
|
|
+ and ifnull(dw.doctorWaitNum,0) = 0
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
group by u.authUserId,u.createTime
|
|
|
<choose>
|
|
|
<when test="listType == 2">
|
|
|
ORDER BY waitAuditNum desc, u.createTime DESC
|
|
|
</when>
|
|
|
<when test="listType == 3">
|
|
|
- ORDER BY (articleWaitNum + imageWaitNum +videoWaitNum +fileWaitNum) desc, u.createTime DESC
|
|
|
+ ORDER BY (ifnull(articleWaitNum,0) + ifnull(imageWaitNum,0) + ifnull(videoWaitNum,0) + ifnull(fileWaitNum,0)) desc, u.createTime DESC
|
|
|
+ </when>
|
|
|
+ <when test="listType == 4">
|
|
|
+ ORDER BY ifnull(dw.doctorWaitNum,0) desc, u.createTime DESC
|
|
|
</when>
|
|
|
<otherwise>
|
|
|
ORDER BY u.createTime DESC
|
|
@@ -172,7 +205,8 @@
|
|
|
select count(*) from cm_brand_auth_file where md5Hex = #{md5Hex}
|
|
|
</select>
|
|
|
<select id="getShopByUserId" resultType="com.caimei.model.vo.ShopFormVo">
|
|
|
- select u.authUserId, u.name as shopName, u.mobile, u.linkMan, u.status as shopStatus, u.shopType as shopType, u.logo, u.qrCodeImage, u.appId, u.appSecret
|
|
|
+ select u.authUserId, u.name as shopName, u.mobile, u.linkMan, u.status as shopStatus, u.shopType as shopType,
|
|
|
+ u.wxAccountType, u.logo, u.qrCodeImage, u.appId, u.appSecret
|
|
|
from cm_brand_auth_user u
|
|
|
where u.authUserId = #{authUserId};
|
|
|
</select>
|
|
@@ -274,7 +308,7 @@
|
|
|
where authUserId = #{authUserId}
|
|
|
</select>
|
|
|
<select id="getUserIdByAppId" resultType="java.lang.Integer">
|
|
|
- select authUserId from cm_brand_auth_user where mobile = #{mobile} and userIdentity = 2 and appId is not null limit 1
|
|
|
+ select authUserId from cm_brand_auth_user where appId = #{appId} and userIdentity = 2 and appId is not null limit 1
|
|
|
</select>
|
|
|
<select id="getAppSecretByAppId" resultType="java.lang.String">
|
|
|
select appSecret from cm_brand_auth_user where appId = #{appId} and status = 1
|
|
@@ -300,5 +334,8 @@
|
|
|
and au.status = 1
|
|
|
limit 1
|
|
|
</select>
|
|
|
+ <select id="getWxAccountTypeByAppId" resultType="java.lang.Integer">
|
|
|
+ select wxAccountType from cm_brand_auth_user where appId = #{appId} and status = 1
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|