fix:检查通知统计

pg_adapter
wangxy 8 months ago
parent 37340e9cb3
commit 4b6435cc31

@ -1,10 +1,13 @@
package com.ruoyi.web.controller.system.count; package com.ruoyi.web.controller.system.count;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.service.ITdCheckService; import com.ruoyi.system.service.ITdCheckService;
import com.ruoyi.system.service.ITdNotifyService;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -27,6 +30,9 @@ public class TdChecknumController extends BaseController{
@Autowired @Autowired
private ITdCheckService tdCheckService; private ITdCheckService tdCheckService;
@Autowired
private ITdNotifyService tdNotifyService;
@RequiresPermissions("system:checknum:view") @RequiresPermissions("system:checknum:view")
@GetMapping() @GetMapping()
public String checknum() { public String checknum() {
@ -35,6 +41,21 @@ public class TdChecknumController extends BaseController{
@ApiOperation("检查通知统计")
@PostMapping("/countNotifyList")
@ResponseBody
public AjaxResult countNotifyList() {
return AjaxResult.success(tdNotifyService.selectCountNotifyList());
}

@ -0,0 +1,31 @@
package com.ruoyi.system.domain.userexam.dto.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* packageName com.ruoyi.system.domain.userexam.dto.response
*
* @author wangxy
* @version JDK 8
* @className NotifyCountDTO
* @date 2024/8/9
* @description
*/
@Data
@ApiModel(value="通知统计", description="通知统计")
public class NotifyCountDTO implements Serializable {
@ApiModelProperty(value = "总数")
private Integer total;
@ApiModelProperty(value = "已发出")
private Integer yfc;
@ApiModelProperty(value = "未发出")
private Integer wfc;
}

@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.TdNotify; import com.ruoyi.system.domain.TdNotify;
import com.ruoyi.system.domain.userexam.dto.response.NotifyCountDTO;
/** /**
* Mapper * Mapper
@ -58,4 +59,7 @@ public interface TdNotifyMapper
* @return * @return
*/ */
public int deleteTdNotifyByNotifyIds(String[] notifyIds); public int deleteTdNotifyByNotifyIds(String[] notifyIds);
public NotifyCountDTO selectCountNotifyList();
} }

@ -2,6 +2,7 @@ package com.ruoyi.system.service;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.TdNotify; import com.ruoyi.system.domain.TdNotify;
import com.ruoyi.system.domain.userexam.dto.response.NotifyCountDTO;
/** /**
* Service * Service
@ -58,4 +59,7 @@ public interface ITdNotifyService
* @return * @return
*/ */
public int deleteTdNotifyByNotifyId(Long notifyId); public int deleteTdNotifyByNotifyId(Long notifyId);
public NotifyCountDTO selectCountNotifyList();
} }

@ -1,6 +1,8 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.userexam.dto.response.NotifyCountDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TdNotifyMapper; import com.ruoyi.system.mapper.TdNotifyMapper;
@ -91,4 +93,9 @@ public class TdNotifyServiceImpl implements ITdNotifyService
{ {
return tdNotifyMapper.deleteTdNotifyByNotifyId(notifyId); return tdNotifyMapper.deleteTdNotifyByNotifyId(notifyId);
} }
@Override
public NotifyCountDTO selectCountNotifyList() {
return tdNotifyMapper.selectCountNotifyList();
}
} }

@ -89,4 +89,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</delete> </delete>
<select id="selectCountNotifyList" resultType="com.ruoyi.system.domain.userexam.dto.response.NotifyCountDTO">
SELECT
COUNT (1) AS total,
SUM (CASE WHEN notify_state = 1 THEN 1 ELSE 0 END) AS yfc,
SUM (CASE WHEN notify_state = 2 THEN 1 ELSE 0 END) AS wfc
FROM
td_notify
</select>
</mapper> </mapper>
Loading…
Cancel
Save