管理者视觉

This commit is contained in:
huangdeliang 2021-06-05 15:38:10 +08:00
parent ea422f63f9
commit e452f5a904

View File

@ -22,11 +22,22 @@
<!-- 根据userId和角色查询问题列表--> <!-- 根据userId和角色查询问题列表-->
<select id="selectSysServicesTopicByUserIdAndRole" parameterType="SysServicesTopic" <select id="selectSysServicesTopicByUserIdAndRole" parameterType="SysServicesTopic"
resultMap="SysServicesTopicResult"> resultMap="SysServicesTopicResult">
SELECT * FROM ( <choose>
SELECT topic_id, id, `read`, create_time, update_time, 'customer' AS role FROM sys_services_topic_status WHERE role = #{role} AND uid = #{uid} <when test="role == 'admin' or role == 'manager'">
) AS status select topic_id, topic_type, content, uid, create_time, img, 1 as `read`, '0' as id, 'customer' as role
LEFT JOIN sys_services_topic USING(topic_id) WHERE del_flag = 0 from sys_services_topic where del_flag = 0 order by create_time desc
ORDER BY `read` ASC, update_time DESC </when>
<otherwise>
SELECT * FROM (
SELECT topic_id, id, `read`, create_time, update_time, 'customer' AS role FROM sys_services_topic_status
WHERE role = #{role} AND uid = #{uid}
) AS status
LEFT JOIN sys_services_topic USING(topic_id) WHERE del_flag = 0
ORDER BY `read` ASC, update_time DESC
</otherwise>
</choose>
</select> </select>
<!-- 查询主题--> <!-- 查询主题-->
@ -56,7 +67,7 @@
<association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/> <association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/>
<association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/> <association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/>
<association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/> <association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/>
<!-- <association property="toAvatar" column="{uid=to_uid,role=to_role}" select="selectUserAvatar"/>--> <!-- <association property="toAvatar" column="{uid=to_uid,role=to_role}" select="selectUserAvatar"/>-->
<association property="replys" column="id" <association property="replys" column="id"
select="selectServicesTopicCommentReplyByCommentId"/> select="selectServicesTopicCommentReplyByCommentId"/>
</resultMap> </resultMap>
@ -76,7 +87,7 @@
<association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/> <association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/>
<association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/> <association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/>
<association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/> <association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/>
<!-- <association property="toAvatar" column="{uid=to_uid,role=to_role}" select="selectUserAvatar"/>--> <!-- <association property="toAvatar" column="{uid=to_uid,role=to_role}" select="selectUserAvatar"/>-->
</resultMap> </resultMap>
@ -115,7 +126,8 @@
select avatar_url from sys_wx_user_info where cus_id = #{uid} select avatar_url from sys_wx_user_info where cus_id = #{uid}
</when> </when>
<otherwise> <otherwise>
select IF(avatar != '', CONCAT("https://api.stdiet.top/prod-api", avatar), '') as avatar from sys_user where user_id = #{uid} select IF(avatar != '', CONCAT("https://api.stdiet.top/prod-api", avatar), '') as avatar from sys_user
where user_id = #{uid}
</otherwise> </otherwise>
</choose> </choose>
</select> </select>