Commit 02a7c58e by fudahua

消息分页

parent 11db84a0
...@@ -31,6 +31,16 @@ public interface NoticeMessageApiService { ...@@ -31,6 +31,16 @@ public interface NoticeMessageApiService {
public ServiceResponse<Page<NoticeMessageInfoDTO>> pageNoticeMessage(String enterpriseId, String storeId, String clerkId, int categoryType, BasePageInfo pageInfo); public ServiceResponse<Page<NoticeMessageInfoDTO>> pageNoticeMessage(String enterpriseId, String storeId, String clerkId, int categoryType, BasePageInfo pageInfo);
/** /**
* 未读数量
*
* @param enterpriseId
* @param storeId
* @param clerkId 可以空 标识查询门店级别消息
* @return
*/
public ServiceResponse<Integer> countUnReadNoticeMessage(String enterpriseId, String storeId, String clerkId);
/**
* 更新已读状态 * 更新已读状态
* *
* @param id * @param id
......
...@@ -47,6 +47,20 @@ public interface NoticeMessageMapper { ...@@ -47,6 +47,20 @@ public interface NoticeMessageMapper {
@Param("clerkId") String clerkId, @Param("clerkId") String clerkId,
@Param("categoryType") int categoryType); @Param("categoryType") int categoryType);
/**
* 查询列表 根据导购
*
* @param enterpriseId
* @param storeId
* @param clerkId
* @param categoryType
* @return
*/
int countUnreadNoticeMessage(@Param("enterpriseId") String enterpriseId,
@Param("storeId") String storeId,
@Param("clerkId") String clerkId,
@Param("categoryType") int categoryType);
/** /**
*/ */
......
...@@ -33,6 +33,16 @@ public interface NoticeMessageService { ...@@ -33,6 +33,16 @@ public interface NoticeMessageService {
public Page<NoticeMessageBO> pageNoticeMessage(String enterpriseId, String storeId, String clerkId, int categoryType, BasePageInfo pageInfo); public Page<NoticeMessageBO> pageNoticeMessage(String enterpriseId, String storeId, String clerkId, int categoryType, BasePageInfo pageInfo);
/** /**
* 分页查询消息
*
* @param enterpriseId
* @param storeId 门店id
* @param clerkId
* @return
*/
int countUnreadNoticeMessage(String enterpriseId, String storeId, String clerkId);
/**
* 更新导购的已读转态 * 更新导购的已读转态
* *
* @param enterpriseId * @param enterpriseId
......
...@@ -51,6 +51,11 @@ public class NoticeMessageServiceImpl implements NoticeMessageService { ...@@ -51,6 +51,11 @@ public class NoticeMessageServiceImpl implements NoticeMessageService {
} }
@Override @Override
public int countUnreadNoticeMessage(String enterpriseId, String storeId, String clerkId) {
return noticeMessageMapper.countUnreadNoticeMessage(enterpriseId, storeId, clerkId, -1);
}
@Override
public boolean updateNoticeMessageReadFlag(String enterpriseId, String clerkId, int categoryType) { public boolean updateNoticeMessageReadFlag(String enterpriseId, String clerkId, int categoryType) {
noticeMessageMapper.updateNoticeMessageReadFlag(enterpriseId, clerkId, categoryType); noticeMessageMapper.updateNoticeMessageReadFlag(enterpriseId, clerkId, categoryType);
return true; return true;
......
...@@ -119,6 +119,12 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService { ...@@ -119,6 +119,12 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
} }
@Override @Override
public ServiceResponse<Integer> countUnReadNoticeMessage(String enterpriseId, String storeId, String clerkId) {
int count = noticeMessageService.countUnreadNoticeMessage(enterpriseId, storeId, clerkId);
return ServiceResponse.success(count);
}
@Override
public ServiceResponse<Boolean> updateReadFlagById(Long id) { public ServiceResponse<Boolean> updateReadFlagById(Long id) {
NoticeMessageBO noticeMessageBO = new NoticeMessageBO(); NoticeMessageBO noticeMessageBO = new NoticeMessageBO();
noticeMessageBO.setNoticeMessageId(id); noticeMessageBO.setNoticeMessageId(id);
......
...@@ -226,6 +226,22 @@ ...@@ -226,6 +226,22 @@
order by create_time desc order by create_time desc
</select> </select>
<select id="countUnreadNoticeMessage" resultType="Integer">
select
count(*)
from tab_haoban_notice_message
where enterprise_id = #{enterpriseId}
and read_flag=0
and store_id = #{storeId}
<if test="clerkId != null">
and clerk_id =#{clerkId}
</if>
<if test="categoryType != -1">
and category_type =#{categoryType}
</if>
order by create_time desc
</select>
<update id="updateNoticeMessageReadFlag"> <update id="updateNoticeMessageReadFlag">
update tab_haoban_notice_message update tab_haoban_notice_message
set read_flag=1,update_time = now() set read_flag=1,update_time = now()
......
...@@ -119,8 +119,8 @@ public class NotifyController extends WebBaseController { ...@@ -119,8 +119,8 @@ public class NotifyController extends WebBaseController {
* @return * @return
*/ */
@RequestMapping("/message/list") @RequestMapping("/message/list")
public HaobanResponse list(@RequestBody @Valid MessageListQO qo, PageQo pageQo) { public HaobanResponse list(@RequestBody @Valid MessageListQO qo) {
ServiceResponse<Page<NoticeMessageInfoDTO>> retPage = noticeMessageService.pageNoticeMessage(qo.getEnterpriseId(), qo.getStoreId(), qo.getClerkId(), qo.getCategoryType(), pageQo.getBasePageInfo()); ServiceResponse<Page<NoticeMessageInfoDTO>> retPage = noticeMessageService.pageNoticeMessage(qo.getEnterpriseId(), qo.getStoreId(), qo.getClerkId(), qo.getCategoryType(), qo.getBasePageInfo());
return resultResponse(HaoBanErrCode.ERR_1, PageUtil.getPageInfo(retPage.getResult())); return resultResponse(HaoBanErrCode.ERR_1, PageUtil.getPageInfo(retPage.getResult()));
} }
...@@ -165,4 +165,16 @@ public class NotifyController extends WebBaseController { ...@@ -165,4 +165,16 @@ public class NotifyController extends WebBaseController {
} }
/**
* 消息类别
*
* @return
*/
@RequestMapping("/message/count")
public HaobanResponse messageCount(@RequestBody @Valid MessageListQO qo) {
ServiceResponse<Integer> ret = noticeMessageService.countUnReadNoticeMessage(qo.getEnterpriseId(), qo.getStoreId(), qo.getClerkId());
return resultResponse(HaoBanErrCode.ERR_1, ret.getResult());
}
} }
package com.gic.haoban.manage.web.qo; package com.gic.haoban.manage.web.qo;
import com.gic.commons.web.qo.PageQo;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
...@@ -8,7 +10,7 @@ import java.io.Serializable; ...@@ -8,7 +10,7 @@ import java.io.Serializable;
* *
* @author hua * @author hua
*/ */
public class CommonQO implements Serializable { public class CommonQO extends PageQo implements Serializable {
@NotNull(message = "企业id不为空") @NotNull(message = "企业id不为空")
private String wxEnterpriseId; private String wxEnterpriseId;
@NotNull(message = "成员id不为空") @NotNull(message = "成员id不为空")
......
...@@ -10,6 +10,7 @@ import com.gic.haoban.manage.web.qo.CommonQO; ...@@ -10,6 +10,7 @@ import com.gic.haoban.manage.web.qo.CommonQO;
public class MessageListQO extends CommonQO { public class MessageListQO extends CommonQO {
private Integer categoryType = -1; private Integer categoryType = -1;
public Integer getCategoryType() { public Integer getCategoryType() {
return categoryType; return categoryType;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment