Переглянути джерело

Merge remote-tracking branch 'origin/V0.0.5' into V0.0.5

jingyuanchao 1 рік тому
батько
коміт
2a4eef55a9

+ 22 - 14
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/controller/CoreMessageCenterController.java

@@ -22,26 +22,32 @@ import org.springframework.web.bind.annotation.*;
  * @author xunmei
  * @date 2023-09-19
  */
-@Api(tags = {"CoreMessageCenter" })
+@Api(tags = {"CoreMessageCenter"})
 @RestController
 @RequestMapping("/center")
 public class CoreMessageCenterController extends BaseController {
     @Autowired
     private ICoreMessageCenterService coreMessageCenterService;
 
-/**
- * 查询消息中心列表
- */
+    /**
+     * 查询消息中心列表
+     */
 
-@ApiOperation(value = "查询消息列表")
+    @ApiOperation(value = "查询消息列表")
 //@RequiresPermissions("core:center:list")
-@GetMapping("/messageList")
-public TableDataInfo<CoreMessageCenterVO> list(CoreMessageCenterDTO coreMessageCenter) {
-    if (null==coreMessageCenter.getType()){
-        coreMessageCenter.setType("3");
+    @GetMapping("/messageList")
+    public TableDataInfo<CoreMessageCenterVO> list(CoreMessageCenterDTO coreMessageCenter) {
+        if (null == coreMessageCenter.getType()) {
+            coreMessageCenter.setType("3");
+        }
+        return coreMessageCenterService.selectByPage(coreMessageCenter);
+    }
+
+    @ApiOperation(value = "查询消息列表是否有未读")
+    @GetMapping("/isRead")
+    public AjaxResult isRead() {
+        return success(coreMessageCenterService.isRead());
     }
-    return  coreMessageCenterService.selectByPage(coreMessageCenter);
-}
 
     /**
      * 获取消息中心详细信息
@@ -52,6 +58,7 @@ public TableDataInfo<CoreMessageCenterVO> list(CoreMessageCenterDTO coreMessageC
     public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(coreMessageCenterService.selectCoreMessageCenterById(id));
     }
+
     /**
      * 已读
      */
@@ -60,12 +67,13 @@ public TableDataInfo<CoreMessageCenterVO> list(CoreMessageCenterDTO coreMessageC
     public AjaxResult isRead(@PathVariable("id") Long id) {
         return success(coreMessageCenterService.isRead(id));
     }
+
     /**
      * 新增消息中心
      */
     @ApiOperation(value = "新增CoreMessageCenter")
     @RequiresPermissions("core:center:add")
-    @Log(title = "消息中心" , businessType = BusinessType.INSERT)
+    @Log(title = "消息中心", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody CoreMessageCenter coreMessageCenter) {
         return toAjax(coreMessageCenterService.insertCoreMessageCenter(coreMessageCenter));
@@ -76,7 +84,7 @@ public TableDataInfo<CoreMessageCenterVO> list(CoreMessageCenterDTO coreMessageC
      */
     @ApiOperation(value = "修改CoreMessageCenter")
     @RequiresPermissions("core:center:edit")
-    @Log(title = "消息中心" , businessType = BusinessType.UPDATE)
+    @Log(title = "消息中心", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody CoreMessageCenter coreMessageCenter) {
         return toAjax(coreMessageCenterService.updateCoreMessageCenter(coreMessageCenter));
@@ -87,7 +95,7 @@ public TableDataInfo<CoreMessageCenterVO> list(CoreMessageCenterDTO coreMessageC
      */
     @ApiOperation(value = "删除CoreMessageCenter")
     @RequiresPermissions("core:center:remove")
-    @Log(title = "消息中心" , businessType = BusinessType.DELETE)
+    @Log(title = "消息中心", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(coreMessageCenterService.deleteCoreMessageCenterByIds(ids));

+ 1 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/mapper/CoreMessageCenterMapper.java

@@ -23,6 +23,7 @@ import java.util.List;
 public interface CoreMessageCenterMapper extends BaseMapper<CoreMessageCenter> {
 
     Page<CoreMessageCenterVO> selectByPage(Page<CoreMessageCenter> page, @Param("request") CoreMessageCenterDTO request);
+    Integer selectNoRead();
     /**
      * 查询消息中心
      *

+ 1 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/service/ICoreMessageCenterService.java

@@ -35,6 +35,7 @@ public interface ICoreMessageCenterService extends IService<CoreMessageCenter> {
 
 
     TableDataInfo selectByPage(CoreMessageCenterDTO coreMessageCenterDTO);
+    Boolean isRead();
     /**
      * 新增消息中心
      *

+ 13 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/service/impl/CoreMessageCenterServiceImpl.java

@@ -12,6 +12,7 @@ import com.xunmei.core.information.dto.CoreMessageCenterDTO;
 import com.xunmei.core.information.mapper.CoreMessageCenterMapper;
 import com.xunmei.core.information.service.ICoreMessageCenterService;
 import com.xunmei.core.information.vo.CoreMessageCenterVO;
+import com.xunmei.core.message.mapper.CoreAnnouncementNotificationMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -28,7 +29,8 @@ import java.util.List;
 public class CoreMessageCenterServiceImpl extends ServiceImpl<CoreMessageCenterMapper, CoreMessageCenter> implements ICoreMessageCenterService {
     @Autowired
     private CoreMessageCenterMapper coreMessageCenterMapper;
-
+@Autowired
+private CoreAnnouncementNotificationMapper coreAnnouncementNotificationMapper;
     /**
      * 查询消息中心
      *
@@ -69,6 +71,16 @@ public class CoreMessageCenterServiceImpl extends ServiceImpl<CoreMessageCenterM
         return tableDataInfo;
     }
 
+    @Override
+    public Boolean isRead() {
+        Integer integer1 = baseMapper.selectNoRead();
+        Integer integer = coreAnnouncementNotificationMapper.selectNoRead();
+        if (integer+integer1==0){
+            return false;
+        }
+        return true;
+    }
+
     /**
      * 新增消息中心
      *

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/message/mapper/CoreAnnouncementNotificationMapper.java

@@ -92,6 +92,6 @@ public interface CoreAnnouncementNotificationMapper extends BaseMapper<CoreAnnou
     CoreAnnouncementNotificationToUser checkIsRead(@Param("request") CoreAnnouncementNotificationAppPageDto request);
 
     void insertNotificationUser(@Param("notificationUser") CoreAnnouncementNotificationToUser notificationUser);
-
+Integer selectNoRead();
 
 }

+ 8 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/information/CoreMessageCenterMapper.xml

@@ -74,6 +74,14 @@
             and user_id=#{request.userId}
         </if>
     </select>
+    <select id="selectNoRead" resultType="java.lang.Integer">
+        SELECT
+            COUNT( 1 )
+        FROM
+            core_message_center
+        WHERE
+            is_read = 0
+    </select>
 
     <insert id="insertCoreMessageCenter" parameterType="com.xunmei.core.information.domain.CoreMessageCenter">
         insert into core_message_center

+ 8 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/message/CoreAnnouncementNotificationMapper.xml

@@ -103,6 +103,14 @@
       select * from  core_announcement_notification_to_user a where a.announcement_notification_id=#{request.announcementNotificationId} and a.user_id=#{request.userId}
 
     </select>
+    <select id="selectNoRead" resultType="java.lang.Integer">
+        SELECT
+            COUNT( 1 )
+        FROM
+            core_announcement_notification
+        WHERE
+                id NOT IN ( SELECT announcement_notification_id FROM core_announcement_notification_to_user )
+    </select>
 
     <insert id="insertCoreAnnouncementNotification" parameterType="com.xunmei.common.core.domain.message.domain.CoreAnnouncementNotification">
         insert into core_announcement_notification