调整客户消息展示
This commit is contained in:
@ -71,18 +71,26 @@ public class SysCustomer extends BaseEntity
|
||||
|
||||
/** 主营养师 */
|
||||
@Excel(name = "主营养师")
|
||||
private String dietitianName;
|
||||
|
||||
private Long mainDietitian;
|
||||
|
||||
/** 营养师助理 */
|
||||
@Excel(name = "营养师助理")
|
||||
private String assDietitianName;
|
||||
|
||||
private Long assistantDietitian;
|
||||
|
||||
/** 售后营养师 */
|
||||
@Excel(name = "售后营养师")
|
||||
private String afterDietitianName;
|
||||
|
||||
private Long afterDietitian;
|
||||
|
||||
/** 销售人员 */
|
||||
@Excel(name = "销售人员")
|
||||
private String salesName;
|
||||
|
||||
private Long salesman;
|
||||
|
||||
/** 负责人 */
|
||||
|
@ -7,6 +7,8 @@ import java.util.List;
|
||||
public interface SysServicesTopicMapper {
|
||||
List<SysServicesTopic> selectSysServicesTopicByUserIdAndRole(SysServicesTopic topic);
|
||||
|
||||
List<SysServicesTopic> selectCustomerListByUserIdAndRole(SysServicesTopic topic);
|
||||
|
||||
int insertSysServicesTopic(SysServicesTopic topic);
|
||||
|
||||
int insertSysServicesTopicStatus(List<SysServicesTopic> topics);
|
||||
@ -20,4 +22,6 @@ public interface SysServicesTopicMapper {
|
||||
List<SysServicesTopic> selectSysServicesTopicSessionByTopicId(String topicId);
|
||||
|
||||
List<SysServicesTopic> selectUnreadTopicCount(List<SysServicesTopic> topics);
|
||||
|
||||
List<SysServicesTopic> selectTopicListByUid(SysServicesTopic topic);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class WebSocketServer {
|
||||
//private static ConcurrentHashMap<String,WebSocketServer> websocketList = new ConcurrentHashMap<>();
|
||||
// 与某个客户端的连接会话,需要通过它来给客户端发送数据
|
||||
private Session session;
|
||||
// 接收sid
|
||||
// 接收sidw
|
||||
private String sid = "";
|
||||
|
||||
public static CopyOnWriteArraySet<WebSocketServer> getWebSocketSet() {
|
||||
|
@ -8,6 +8,8 @@ public interface ISysServicesTopicService {
|
||||
|
||||
List<SysServicesTopic> selectSysServicesTopicByUserIdAndRole(SysServicesTopic topic);
|
||||
|
||||
List<SysServicesTopic> selectCustomerListByUserIdAndRole(SysServicesTopic topic);
|
||||
|
||||
SysServicesTopic insertSysServicesTopic(SysServicesTopic topic);
|
||||
|
||||
int updateSysServicesTopicStatus(SysServicesTopic topic);
|
||||
@ -19,4 +21,6 @@ public interface ISysServicesTopicService {
|
||||
List<SysServicesTopic> selectSysServicesTopicSessionByTopicId(String topicId);
|
||||
|
||||
List<SysServicesTopic> selectUnreadTopicCount(List<SysServicesTopic> topic);
|
||||
|
||||
List<SysServicesTopic> selectTopicListByUid(SysServicesTopic topic);
|
||||
}
|
||||
|
@ -30,6 +30,10 @@ public class SysServicesTopicServiceImp implements ISysServicesTopicService {
|
||||
return servicesTopicMapper.selectSysServicesTopicByUserIdAndRole(topic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysServicesTopic> selectCustomerListByUserIdAndRole(SysServicesTopic topic) {
|
||||
return servicesTopicMapper.selectCustomerListByUserIdAndRole(topic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysServicesTopic insertSysServicesTopic(SysServicesTopic topic) {
|
||||
@ -187,4 +191,9 @@ public class SysServicesTopicServiceImp implements ISysServicesTopicService {
|
||||
public List<SysServicesTopic> selectUnreadTopicCount(List<SysServicesTopic> statusList) {
|
||||
return servicesTopicMapper.selectUnreadTopicCount(statusList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysServicesTopic> selectTopicListByUid(SysServicesTopic topic) {
|
||||
return servicesTopicMapper.selectTopicListByUid(topic);
|
||||
}
|
||||
}
|
||||
|
@ -5,38 +5,50 @@
|
||||
<mapper namespace="com.stdiet.custom.mapper.SysCustomerMapper">
|
||||
|
||||
<resultMap type="SysCustomer" id="SysCustomerResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="phone" column="phone" />
|
||||
<result property="email" column="email" />
|
||||
<result property="address" column="address" />
|
||||
<result property="payDate" column="pay_date" />
|
||||
<result property="startDate" column="start_date" />
|
||||
<result property="fansTime" column="fans_time" />
|
||||
<result property="fansChannel" column="fans_channel" />
|
||||
<result property="purchaseNum" column="purchase_num" />
|
||||
<result property="payTotal" column="pay_total" />
|
||||
<result property="mainDietitian" column="main_dietitian" />
|
||||
<result property="assistantDietitian" column="assistant_dietitian" />
|
||||
<result property="afterDietitian" column="after_dietitian" />
|
||||
<result property="salesman" column="salesman" />
|
||||
<result property="chargePerson" column="charge_person" />
|
||||
<result property="followStatus" column="follow_status" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="channelId" column="channel_id" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="phone" column="phone"/>
|
||||
<result property="email" column="email"/>
|
||||
<result property="address" column="address"/>
|
||||
<result property="payDate" column="pay_date"/>
|
||||
<result property="startDate" column="start_date"/>
|
||||
<result property="fansTime" column="fans_time"/>
|
||||
<result property="fansChannel" column="fans_channel"/>
|
||||
<result property="purchaseNum" column="purchase_num"/>
|
||||
<result property="payTotal" column="pay_total"/>
|
||||
<result property="chargePerson" column="charge_person"/>
|
||||
<result property="followStatus" column="follow_status"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="channelId" column="channel_id"/>
|
||||
|
||||
<result property="mainDietitian" column="main_dietitian"/>
|
||||
<result property="assistantDietitian" column="assistant_dietitian"/>
|
||||
<result property="afterDietitian" column="after_dietitian"/>
|
||||
<result property="salesman" column="salesman"/>
|
||||
|
||||
<association property="dietitianName" column="{id=main_dietitian}" select="selectUserName"/>
|
||||
<association property="assDietitianName" column="{id=assistant_dietitian}" select="selectUserName"/>
|
||||
<association property="afterDietitianName" column="{id=after_dietitian}" select="selectUserName"/>
|
||||
<association property="salesName" column="{id=salesman}" select="selectUserName"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectUserName" parameterType="java.util.Map" resultType="String">
|
||||
select nick_name from sys_user where user_id = #{id}
|
||||
</select>
|
||||
|
||||
<sql id="selectSysCustomerVo">
|
||||
select id, name, phone, email, fans_time, fans_channel, address, pay_date, start_date, purchase_num, pay_total, main_dietitian, assistant_dietitian, after_dietitian, salesman, charge_person, follow_status, create_time, create_by, update_time, update_by, channel_id from sys_customer
|
||||
</sql>
|
||||
|
||||
<select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult">
|
||||
select
|
||||
sc.id, sc.name, sc.phone, sc.email, sc.fans_time, sc.fans_channel, sc.address, sc.pay_date, sc.start_date, sc.purchase_num, sc.pay_total, sc.main_dietitian,
|
||||
sc.assistant_dietitian, sc.after_dietitian, sc.salesman, sc.charge_person, sc.follow_status, sc.create_time,sc.channel_id
|
||||
sc.id, sc.name, sc.phone, sc.email, sc.fans_time, sc.fans_channel, sc.address, sc.pay_date, sc.start_date,
|
||||
sc.purchase_num, sc.pay_total, sc.main_dietitian,
|
||||
sc.assistant_dietitian, sc.after_dietitian, sc.salesman, sc.charge_person, sc.follow_status,
|
||||
sc.create_time,sc.channel_id
|
||||
from sys_customer sc
|
||||
left join sys_customer_healthy as sch
|
||||
on sch.customer_id = sc.id and sch.del_flag = 0
|
||||
@ -44,16 +56,18 @@
|
||||
<if test="name != null and name != ''">
|
||||
and (sc.name like concat('%', #{name}, '%') or sc.phone like concat('%', #{name}, '%'))
|
||||
</if>
|
||||
<if test="mainDietitian != null and mainDietitian != ''"> and sc.main_dietitian = #{mainDietitian}</if>
|
||||
<if test="mainDietitian == 0"> and (isnull(sc.main_dietitian) or sc.main_dietitian=0)</if>
|
||||
<if test="salesman != null and salesman != ''"> and sc.salesman = #{salesman}</if>
|
||||
<if test="salesman == 0"> and (isnull(sc.salesman) or sc.salesman=0)</if>
|
||||
<if test="afterDietitian != null and afterDietitian != ''"> and sc.after_dietitian = #{afterDietitian}</if>
|
||||
<if test="afterDietitian == 0"> and (isnull(sc.after_dietitian) or sc.after_dietitian=0)</if>
|
||||
<if test="assistantDietitian != null and assistantDietitian != ''"> and sc.assistant_dietitian = #{assistantDietitian}</if>
|
||||
<if test="assistantDietitian == 0"> and (isnull(sc.assistant_dietitian) or sc.assistant_dietitian=0)</if>
|
||||
<if test="fansChannel != null "> and sc.fans_channel = #{fansChannel}</if>
|
||||
<if test="channelId != null "> and sc.channel_id = #{channelId}</if>
|
||||
<if test="mainDietitian != null and mainDietitian != ''">and sc.main_dietitian = #{mainDietitian}</if>
|
||||
<if test="mainDietitian == 0">and (isnull(sc.main_dietitian) or sc.main_dietitian=0)</if>
|
||||
<if test="salesman != null and salesman != ''">and sc.salesman = #{salesman}</if>
|
||||
<if test="salesman == 0">and (isnull(sc.salesman) or sc.salesman=0)</if>
|
||||
<if test="afterDietitian != null and afterDietitian != ''">and sc.after_dietitian = #{afterDietitian}</if>
|
||||
<if test="afterDietitian == 0">and (isnull(sc.after_dietitian) or sc.after_dietitian=0)</if>
|
||||
<if test="assistantDietitian != null and assistantDietitian != ''">and sc.assistant_dietitian =
|
||||
#{assistantDietitian}
|
||||
</if>
|
||||
<if test="assistantDietitian == 0">and (isnull(sc.assistant_dietitian) or sc.assistant_dietitian=0)</if>
|
||||
<if test="fansChannel != null ">and sc.fans_channel = #{fansChannel}</if>
|
||||
<if test="channelId != null ">and sc.channel_id = #{channelId}</if>
|
||||
<if test="channels != null">
|
||||
and sc.channel_id in
|
||||
<foreach collection="channels" item="cn" separator="," open="(" close=")">
|
||||
|
@ -16,8 +16,57 @@
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<association column="{uid=uid,role=role}" property="name" select="selectUserInfo"/>
|
||||
<association property="avatar" column="{uid=uid,role=role}" select="selectUserAvatar"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectCustomerListByUserIdAndRole" parameterType="SysServicesTopic" resultMap="SysServicesTopicResult">
|
||||
SELECT DISTINCT(uid)AS uid, MAX(update_time) AS update_time, MIN(create_time) AS create_time, MIN(`read`) AS
|
||||
`read`, role FROM (
|
||||
SELECT * FROM (
|
||||
SELECT topic_id, `read`, create_time, update_time, 'customer' AS role FROM sys_services_topic_status
|
||||
<choose>
|
||||
<when test="role == 'admin' or role == 'manager' or role == 'admin-dev'">
|
||||
WHERE role = 'dietician'
|
||||
</when>
|
||||
<otherwise>
|
||||
WHERE role = #{role} AND uid = #{uid}
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
) AS status
|
||||
LEFT JOIN (SELECT topic_id, uid, del_flag FROM sys_services_topic ) AS topic USING(topic_id)
|
||||
WHERE del_flag = 0
|
||||
ORDER BY `read` ASC, update_time DESC
|
||||
) AS userList GROUP BY uid
|
||||
</select>
|
||||
|
||||
<select id="selectTopicListByUid" parameterType="SysServicesTopic" resultMap="SysServicesTopicResult">
|
||||
SELECT * FROM(
|
||||
SELECT topic_id, topic_type, content, uid, img, 'customer' AS role FROM sys_services_topic
|
||||
WHERE uid = #{fromUid} AND del_flag = 0
|
||||
) AS topic
|
||||
LEFT JOIN (SELECT topic_id, create_time, update_time, `read`,
|
||||
<choose>
|
||||
<when test="role == 'admin' or role == 'manager' or role == 'admin-dev'">
|
||||
'0' AS id
|
||||
</when>
|
||||
<otherwise>
|
||||
id
|
||||
</otherwise>
|
||||
</choose>
|
||||
FROM sys_services_topic_status
|
||||
<choose>
|
||||
<when test="role == 'admin' or role == 'manager' or role == 'admin-dev'">
|
||||
WHERE role = 'dietician'
|
||||
</when>
|
||||
<otherwise>
|
||||
WHERE role = #{role} AND uid = #{uid}
|
||||
</otherwise>
|
||||
</choose>
|
||||
) AS state
|
||||
USING(topic_id)
|
||||
ORDER BY `read` ASC, update_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据userId和角色查询问题列表-->
|
||||
<select id="selectSysServicesTopicByUserIdAndRole" parameterType="SysServicesTopic"
|
||||
@ -36,8 +85,6 @@
|
||||
ORDER BY `read` ASC, update_time DESC
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 查询主题-->
|
||||
|
Reference in New Issue
Block a user