Commit 68e48ebd authored by yf's avatar yf

修改代办、消息相关接口

parent 38cdec23
......@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.IMessageInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -35,11 +36,14 @@ public class BacklogInfoController extends BaseController {
@Autowired
private IBacklogInfoService backlogInfoService;
@Autowired
private IMessageInfoService messageInfoService;
/**
* 查询待办信息列表
*/
@PreAuthorize("@ss.hasPermi('system:backlogInfo:list')")
@GetMapping("/list")
@PostMapping("/list")
public TableDataInfo list(BacklogInfo backlogInfo) {
startPage();
String loginName = getUsername();
......@@ -72,7 +76,9 @@ public class BacklogInfoController extends BaseController {
Map<String, Integer> map = new HashMap<>();
String loginName = getUsername();
int backlogInfo = backlogInfoService.selectUnReadCount(loginName, "app_url", "menu_url");
int messageInfo = messageInfoService.selectUnReadCount(loginName);
map.put("待办事项", backlogInfo);
map.put("消息信息", messageInfo);
return AjaxResult.success(map);
}
......
......@@ -6,8 +6,11 @@ import com.censoft.censoftrongtong.domain.CurrentRiskUserPatrol;
import com.censoft.censoftrongtong.domain.CurrentRiskUserPatrolDetail;
import com.censoft.censoftrongtong.enums.CycleType;
import com.censoft.censoftrongtong.service.*;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.service.ISysUserService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
......@@ -24,6 +27,8 @@ import java.util.stream.Collectors;
@Component("currentRiskTask")
public class CurrentRiskTask {
private ISysUserService userService;
private ICommonMessageInfoService commonMessageInfoService;
private ICurrentRiskPostListService currentRiskPostListService;
private ICurrentRiskUserPatrolService currentRiskUserPatrolService;
private ICurrentRiskUserPatrolDetailService currentRiskUserPatrolDetailService;
......@@ -32,28 +37,29 @@ public class CurrentRiskTask {
/**
* 每天零点发送任务
*
* @param isDailypOther 除每月 1 号外,是否新增日查之外的巡查 默认不新增
*/
private void senTask(boolean isDailypOther){
private void senTask(boolean isDailypOther) {
//判断是否查询当天巡查任务是否发放
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int day = calendar.get(Calendar.DAY_OF_MONTH);
//查询所有的任务列表
QueryWrapper<CurrentRiskPostList> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status","0");
queryWrapper.eq("status", "0");
List<CurrentRiskPostList> currentRiskPostLists = currentRiskPostListService.list();
if(CollectionUtils.isEmpty(currentRiskPostLists)){
if (CollectionUtils.isEmpty(currentRiskPostLists)) {
return;
}
//查询所有人的巡查类型,按巡查类型分类
List<CurrentRiskPostList> patrolTypeList = currentRiskPostListService.selectCurrentRiskPostListList3();
for (CurrentRiskPostList patrolType : patrolTypeList){
for (CurrentRiskPostList patrolType : patrolTypeList) {
//初始化用户巡查总表
CurrentRiskUserPatrol currentRiskUserPatrol = new CurrentRiskUserPatrol();
//开始时间,结束时间
try {
initTime(currentRiskUserPatrol,patrolType.getPatrolType());
initTime(currentRiskUserPatrol, patrolType.getPatrolType());
} catch (Exception e) {
e.printStackTrace();
log.info("初始化时间出错");
......@@ -61,27 +67,27 @@ public class CurrentRiskTask {
//查询当天巡查任务是否发放
//查询是否发送过
QueryWrapper<CurrentRiskUserPatrol> patrolQueryWrapper = new QueryWrapper<>();
patrolQueryWrapper.eq("user_id",patrolType.getUserId()).eq("risk_post_id", patrolType.getPostId())
.eq("patrol_type",patrolType.getPatrolType())
.ge("start_time",currentRiskUserPatrol.getStartTime()).le("start_time",currentRiskUserPatrol.getEndTime());
patrolQueryWrapper.eq("user_id", patrolType.getUserId()).eq("risk_post_id", patrolType.getPostId())
.eq("patrol_type", patrolType.getPatrolType())
.ge("start_time", currentRiskUserPatrol.getStartTime()).le("start_time", currentRiskUserPatrol.getEndTime());
//如果是日查 且 属于主动点击行为,则进行校验
if(hour > 2 && patrolType.getPatrolType().equals(CycleType.DAILY.getValue())){
if(currentRiskUserPatrolService.count(patrolQueryWrapper) > 0){
if (hour > 2 && patrolType.getPatrolType().equals(CycleType.DAILY.getValue())) {
if (currentRiskUserPatrolService.count(patrolQueryWrapper) > 0) {
continue;
}
}
// 大于1号 且 非日查 要添加 计划查询的数据要进行测验
if(day > 1 && isDailypOther && !patrolType.getPatrolType().equals(CycleType.DAILY.getValue())){
if(currentRiskUserPatrolService.count(patrolQueryWrapper) > 0){
if (day > 1 && isDailypOther && !patrolType.getPatrolType().equals(CycleType.DAILY.getValue())) {
if (currentRiskUserPatrolService.count(patrolQueryWrapper) > 0) {
continue;
}
}
//新增任务
List<CurrentRiskPostList> saveCurrentRiskPostLists = currentRiskPostLists.stream().
List<CurrentRiskPostList> saveCurrentRiskPostLists = currentRiskPostLists.stream().
filter(currentRiskPostList -> currentRiskPostList.getPostId().equals(patrolType.getPostId())
&& currentRiskPostList.getPatrolType().equals(patrolType.getPatrolType())
&& currentRiskPostList.getUserId().equals(patrolType.getUserId())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(saveCurrentRiskPostLists)){
&& currentRiskPostList.getUserId().equals(patrolType.getUserId())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(saveCurrentRiskPostLists)) {
continue;
}
currentRiskPostLists.removeAll(saveCurrentRiskPostLists);
......@@ -96,7 +102,7 @@ public class CurrentRiskTask {
currentRiskUserPatrolService.insertCurrentRiskUserPatrol(currentRiskUserPatrol);
//新增巡查明细信息
List<CurrentRiskUserPatrolDetail> list = new ArrayList<>();
saveCurrentRiskPostLists.forEach(saveCurrentRiskPostList ->{
saveCurrentRiskPostLists.forEach(saveCurrentRiskPostList -> {
CurrentRiskUserPatrolDetail currentRiskUserPatrolDetail = new CurrentRiskUserPatrolDetail();
currentRiskUserPatrolDetail.setCurrentRiskId(saveCurrentRiskPostList.getCurrentRiskId());
currentRiskUserPatrolDetail.setPatrolId(currentRiskUserPatrol.getId());
......@@ -106,15 +112,19 @@ public class CurrentRiskTask {
list.add(currentRiskUserPatrolDetail);
});
currentRiskUserPatrolDetailService.saveBatch(list);
SysUser user = userService.selectUserById(patrolType.getUserId());
}
}
/**
* 开始时间,结束时间计算
*
* @param currentRiskUserPatrol 对象
* @param patrolType 巡检类型 0 日查 1 周查 2 月查 3 季查 4 年查
* @param patrolType 巡检类型 0 日查 1 周查 2 月查 3 季查 4 年查
*/
private void initTime(CurrentRiskUserPatrol currentRiskUserPatrol,String patrolType)throws Exception{
private void initTime(CurrentRiskUserPatrol currentRiskUserPatrol, String patrolType) throws Exception {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
int currentYear = calendar.get(Calendar.YEAR);
......@@ -122,47 +132,47 @@ public class CurrentRiskTask {
String startTime = "";
String endTime = "";
//日查
if(patrolType.equals(CycleType.DAILY.getValue())){
if (patrolType.equals(CycleType.DAILY.getValue())) {
startTime = SDF.format(calendar.getTime()) + " 00:00:00";
endTime = SDF.format(calendar.getTime()) + " 23:59:59";
}
//周查
if(patrolType.equals(CycleType.WEEKLY.getValue())){
if (patrolType.equals(CycleType.WEEKLY.getValue())) {
// 获取当前是周几,注意返回值是1-7,1表示周日,2表示周一,以此类推
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
if(dayOfWeek == 1 ){
if (dayOfWeek == 1) {
calendar.add(Calendar.DATE, -6);
}else{
calendar.add(Calendar.DATE, 2-dayOfWeek);
} else {
calendar.add(Calendar.DATE, 2 - dayOfWeek);
}
startTime = SDF.format(calendar.getTime()) + " 00:00:00";
calendar.add(Calendar.DATE, 6);
endTime = SDF.format(calendar.getTime()) + " 23:59:59";
}
//月查
if(patrolType.equals(CycleType.MONTH.getValue())){
if (patrolType.equals(CycleType.MONTH.getValue())) {
startTime = currentYear + "-" + currentMonth + "-01 00:00:00";
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
int lastDayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
endTime = currentYear + "-" + currentMonth + "-" + lastDayOfMonth +" 23:59:59";
endTime = currentYear + "-" + currentMonth + "-" + lastDayOfMonth + " 23:59:59";
}
//季查
if(patrolType.equals(CycleType.QUARTERLY.getValue())){
if (patrolType.equals(CycleType.QUARTERLY.getValue())) {
// 获取当前月份,注意返回值是0-11,因此需要加1
int month = calendar.get(Calendar.MONTH) + 1;
// 获取当前季度,注意返回值是1-4,1表示第一季度,以此类推
int quarter = (month - 1) / 3 + 1;
//季度初始月份
int quarterMonth = 1 + (3 * (quarter-1));
startTime = currentYear + "-"+quarterMonth + "-01 00:00:00";
int quarterMonth = 1 + (3 * (quarter - 1));
startTime = currentYear + "-" + quarterMonth + "-01 00:00:00";
calendar.setTime(SDF.parse(startTime));
calendar.add(Calendar.MONTH,2);
calendar.add(Calendar.MONTH, 2);
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
int lastDayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
endTime = currentYear + "-" + currentMonth + "-" + lastDayOfMonth +" 23:59:59";
endTime = currentYear + "-" + currentMonth + "-" + lastDayOfMonth + " 23:59:59";
}
//年查
if(patrolType.equals(CycleType.YEARLY.getValue())){
if (patrolType.equals(CycleType.YEARLY.getValue())) {
startTime = currentYear + "-01-01 00:00:00";
endTime = currentYear + "-12-31 23:59:59";
}
......
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.StringUtils;
......@@ -56,6 +57,16 @@ public class MessageInfoController extends BaseController
return getDataTable(list);
}
/**
* 清除未读
*/
@GetMapping("/changeStatus")
@ResponseBody
public AjaxResult changeStatus(HttpServletRequest httpServletRequest) {
String loginName = getUsername();
return toAjax(messageInfoService.updateChangeStatus(loginName));
}
/**
* 导出消息信息列表
......
......@@ -79,4 +79,11 @@ public class BacklogInfo extends BaseEntity
@TableField(exist = false)
private String endTime;
/**
* 结束时间
*/
@Excel(name = "结束时间")
@TableField(exist = false)
private String keyword;
}
......@@ -71,5 +71,11 @@ public class MessageInfo extends BaseEntity
@Excel(name = "结束时间")
@TableField(exist = false)
private String endTime;
/**
* 结束时间
*/
@Excel(name = "结束时间")
@TableField(exist = false)
private String keyword;
}
......@@ -20,6 +20,11 @@ public interface MessageInfoMapper extends MPJBaseMapper<MessageInfo>
*/
public MessageInfo selectMessageInfoById(String id);
/**
* 查询消息未读信息数量
*/
public int selectUnReadCount(String loginName);
/**
* 查询消息信息列表
*
......@@ -36,6 +41,11 @@ public interface MessageInfoMapper extends MPJBaseMapper<MessageInfo>
*/
public int insertMessageInfo(MessageInfo messageInfo);
/**
* 清除未读
*/
public boolean updateChangeStatus(String loginName);
/**
* 修改消息信息
*
......
package com.censoft.censoftrongtong.service;
/**
* 消息中心Service公共接口
*
* @author censoft
* @date 2021-11-16
*/
public interface ICommonMessageInfoService {
/**
* 新增消息信息
*
* @return 结果
*/
public int insertMessageInfo(String pid, String nodeId, String title, String content, String status, String messageBy, String menuName, String menuUrl, String appUrl, String createBy);
/**
* 新增通知公告
*
* @return 结果
*/
// public int insertNoticeInfo(String pid, String title, String content, String status, String noticeBy, String menuName, String menuUrl, String appUrl, String createBy);
/**
* 新增待办信息
*
* @return 结果
*/
public int insertBacklogInfo(String pid, String nodeId, String mainId, String title, String theme, String content, String status, String backlogBy, String menuName, String menuUrl, String appUrl, String createBy);
/**
* 修改待办信息
*
* @return 结果
*/
public int updateBacklogInfo(String pid, String nodeId, String status, String backlogBy, String menuUrl, String appUrl);
/**
* 修改待办信息
*
* @return 结果
*/
public int updateBacklogInfoByPid(String pid, String nodeId, String status, String backlogBy, String menuUrl, String appUrl);
}
......@@ -19,6 +19,11 @@ public interface IMessageInfoService extends MPJBaseService<MessageInfo>
*/
public MessageInfo selectMessageInfoById(String id);
/**
* 查询消息未读信息数量
*/
public int selectUnReadCount(String loginName);
/**
* 查询消息信息列表
*
......@@ -27,6 +32,12 @@ public interface IMessageInfoService extends MPJBaseService<MessageInfo>
*/
public List<MessageInfo> selectMessageInfoList(MessageInfo messageInfo);
/**
* 清除未读
*/
public boolean updateChangeStatus(String loginName);
/**
* 新增消息信息
*
......
package com.censoft.censoftrongtong.service.impl;
import com.censoft.censoftrongtong.service.ICommonMessageInfoService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.BacklogInfo;
import com.ruoyi.system.domain.MessageInfo;
import com.ruoyi.system.mapper.BacklogInfoMapper;
import com.ruoyi.system.mapper.MessageInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.UUID;
public class CommonMessageInfoServiceImpl implements ICommonMessageInfoService {
@Autowired
private MessageInfoMapper messageInfoMapper;
@Autowired
private BacklogInfoMapper backlogInfoMapper;
/**
* 新增消息信息
*
* @return 结果
*/
@Override
public int insertMessageInfo(String pid, String nodeId, String title, String content, String status, String messageBy, String menuName, String menuUrl, String appUrl, String createBy) {
MessageInfo messageInfo = new MessageInfo();
messageInfo.setId(UUID.randomUUID().toString().replace("-", ""));
if (StringUtils.isNotNull(pid) && StringUtils.isNotEmpty(pid)) {
messageInfo.setPid(pid);
}
if (StringUtils.isNotNull(nodeId) && StringUtils.isNotEmpty(nodeId)) {
messageInfo.setNodeId(nodeId);
}
if (StringUtils.isNotNull(title) && StringUtils.isNotEmpty(title)) {
messageInfo.setTitle(title);
}
if (StringUtils.isNotNull(content) && StringUtils.isNotEmpty(content)) {
messageInfo.setContent(content);
}
if (StringUtils.isNotNull(status) && StringUtils.isNotEmpty(status)) {
messageInfo.setStatus(status);
}
if (StringUtils.isNotNull(messageBy) && StringUtils.isNotEmpty(messageBy)) {
messageInfo.setMessageBy(messageBy);
}
if (StringUtils.isNotNull(menuName) && StringUtils.isNotEmpty(menuName)) {
messageInfo.setMenuName(menuName);
}
if (StringUtils.isNotNull(menuUrl) && StringUtils.isNotEmpty(menuUrl)) {
messageInfo.setMenuUrl(menuUrl);
}
if (StringUtils.isNotNull(appUrl) && StringUtils.isNotEmpty(appUrl)) {
messageInfo.setAppUrl(appUrl);
}
if (StringUtils.isNotNull(createBy) && StringUtils.isNotEmpty(createBy)) {
messageInfo.setCreateBy(createBy);
}
messageInfo.setCreateTime(DateUtils.getNowDate());
return messageInfoMapper.insertMessageInfo(messageInfo);
}
// /**
// * 新增通知公告
// *
// * @return 结果
// */
// @Override
// public int insertNoticeInfo(String pid, String title, String content, String status, String noticeBy, String menuName, String menuUrl, String appUrl, String createBy) {
// NoticeInfo noticeInfo = new NoticeInfo();
// noticeInfo.setId(UUID.randomUUID().toString().replace("-", ""));
// if (StringUtils.isNotNull(title) && StringUtils.isNotEmpty(title)) {
// noticeInfo.setTitle(title);
// }
// if (StringUtils.isNotNull(content) && StringUtils.isNotEmpty(content)) {
// noticeInfo.setContent(content);
// }
// if (StringUtils.isNotNull(createBy) && StringUtils.isNotEmpty(createBy)) {
// noticeInfo.setCreateBy(createBy);
// }
// noticeInfo.setCreateTime(DateUtils.getNowDate());
// return noticeInfoMapper.insertNoticeInfo(noticeInfo);
// }
/**
* 新增待办信息
*
* @return 结果
*/
@Override
public int insertBacklogInfo(String pid, String nodeId, String mainId, String title, String theme, String content, String status, String backlogBy, String menuName, String menuUrl, String appUrl, String createBy) {
BacklogInfo backlogInfo = new BacklogInfo();
backlogInfo.setId(UUID.randomUUID().toString().replace("-", ""));
if (StringUtils.isNotNull(pid) && StringUtils.isNotEmpty(pid)) {
backlogInfo.setPid(pid);
}
if (StringUtils.isNotNull(nodeId) && StringUtils.isNotEmpty(nodeId)) {
backlogInfo.setNodeId(nodeId);
}
if (StringUtils.isNotNull(mainId) && StringUtils.isNotEmpty(mainId)) {
backlogInfo.setMainId(mainId);
}
if (StringUtils.isNotNull(title) && StringUtils.isNotEmpty(title)) {
backlogInfo.setTitle(title);
}
if (StringUtils.isNotNull(theme) && StringUtils.isNotEmpty(theme)) {
backlogInfo.setTheme(theme);
}
if (StringUtils.isNotNull(content) && StringUtils.isNotEmpty(content)) {
backlogInfo.setContent(content);
}
if (StringUtils.isNotNull(status) && StringUtils.isNotEmpty(status)) {
backlogInfo.setStatus(status);
}
if (StringUtils.isNotNull(backlogBy) && StringUtils.isNotEmpty(backlogBy)) {
backlogInfo.setBacklogBy(backlogBy);
}
if (StringUtils.isNotNull(menuName) && StringUtils.isNotEmpty(menuName)) {
backlogInfo.setMenuName(menuName);
}
if (StringUtils.isNotNull(menuUrl) && StringUtils.isNotEmpty(menuUrl)) {
backlogInfo.setMenuUrl(menuUrl);
}
if (StringUtils.isNotNull(appUrl) && StringUtils.isNotEmpty(appUrl)) {
backlogInfo.setAppUrl(appUrl);
}
if (StringUtils.isNotNull(createBy) && StringUtils.isNotEmpty(createBy)) {
backlogInfo.setCreateBy(createBy);
}
backlogInfo.setCreateTime(DateUtils.getNowDate());
return backlogInfoMapper.insertBacklogInfo(backlogInfo);
}
/**
* 修改待办信息
*
* @return 结果
*/
@Override
public int updateBacklogInfo(String pid, String nodeId, String status, String updateBy, String menuUrl, String appUrl) {
BacklogInfo backlogInfo = new BacklogInfo();
if (StringUtils.isNotNull(pid) && StringUtils.isNotEmpty(pid)) {
backlogInfo.setPid(pid);
}
if (StringUtils.isNotNull(nodeId) && StringUtils.isNotEmpty(nodeId)) {
backlogInfo.setNodeId(nodeId);
}
if (StringUtils.isNotNull(status) && StringUtils.isNotEmpty(status)) {
backlogInfo.setStatus(status);
}
if (StringUtils.isNotNull(menuUrl) && StringUtils.isNotEmpty(menuUrl)) {
backlogInfo.setMenuUrl(menuUrl);
}
if (StringUtils.isNotNull(appUrl) && StringUtils.isNotEmpty(appUrl)) {
backlogInfo.setAppUrl(appUrl);
}
if (StringUtils.isNotNull(updateBy) && StringUtils.isNotEmpty(updateBy)) {
backlogInfo.setUpdateBy(updateBy);
}
backlogInfo.setUpdateTime(DateUtils.getNowDate());
return backlogInfoMapper.updateBacklogInfo(backlogInfo);
}
@Override
public int updateBacklogInfoByPid(String pid, String nodeId, String status, String updateBy, String menuUrl, String appUrl) {
BacklogInfo backlogInfo = new BacklogInfo();
if (StringUtils.isNotNull(pid) && StringUtils.isNotEmpty(pid)) {
backlogInfo.setPid(pid);
}
if (StringUtils.isNotNull(nodeId) && StringUtils.isNotEmpty(nodeId)) {
backlogInfo.setNodeId(nodeId);
}
if (StringUtils.isNotNull(status) && StringUtils.isNotEmpty(status)) {
backlogInfo.setStatus(status);
}
if (StringUtils.isNotNull(menuUrl) && StringUtils.isNotEmpty(menuUrl)) {
backlogInfo.setMenuUrl(menuUrl);
}
if (StringUtils.isNotNull(appUrl) && StringUtils.isNotEmpty(appUrl)) {
backlogInfo.setAppUrl(appUrl);
}
if (StringUtils.isNotNull(updateBy) && StringUtils.isNotEmpty(updateBy)) {
backlogInfo.setUpdateBy(updateBy);
}
backlogInfo.setUpdateTime(DateUtils.getNowDate());
return backlogInfoMapper.updateBacklogInfoByPid(backlogInfo);
}
}
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -8,89 +9,100 @@ import com.ruoyi.system.mapper.MessageInfoMapper;
import com.ruoyi.system.domain.MessageInfo;
import com.ruoyi.system.service.IMessageInfoService;
import com.github.yulichang.base.MPJBaseServiceImpl;
/**
* 消息信息Service业务层处理
*
*
* @author ruoyi
* @date 2024-01-09
*/
@Service
public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper, MessageInfo> implements IMessageInfoService
{
public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper, MessageInfo> implements IMessageInfoService {
@Autowired
private MessageInfoMapper messageInfoMapper;
/**
* 查询消息信息
*
*
* @param id 消息信息主键
* @return 消息信息
*/
@Override
public MessageInfo selectMessageInfoById(String id)
{
public MessageInfo selectMessageInfoById(String id) {
return messageInfoMapper.selectMessageInfoById(id);
}
/**
* 查询消息信息列表
*
*
* @param messageInfo 消息信息
* @return 消息信息
*/
@Override
public List<MessageInfo> selectMessageInfoList(MessageInfo messageInfo)
{
public List<MessageInfo> selectMessageInfoList(MessageInfo messageInfo) {
return messageInfoMapper.selectMessageInfoList(messageInfo);
}
/**
* 查询消息未读信息数量
*/
@Override
public int selectUnReadCount(String loginName) {
return messageInfoMapper.selectUnReadCount(loginName);
}
/**
* 清除未读
*/
@Override
public boolean updateChangeStatus(String loginName) {
return messageInfoMapper.updateChangeStatus(loginName);
}
/**
* 新增消息信息
*
*
* @param messageInfo 消息信息
* @return 结果
*/
@Override
public int insertMessageInfo(MessageInfo messageInfo)
{
public int insertMessageInfo(MessageInfo messageInfo) {
messageInfo.setCreateTime(DateUtils.getNowDate());
return messageInfoMapper.insertMessageInfo(messageInfo);
}
/**
* 修改消息信息
*
*
* @param messageInfo 消息信息
* @return 结果
*/
@Override
public int updateMessageInfo(MessageInfo messageInfo)
{
public int updateMessageInfo(MessageInfo messageInfo) {
messageInfo.setUpdateTime(DateUtils.getNowDate());
return messageInfoMapper.updateMessageInfo(messageInfo);
}
/**
* 批量删除消息信息
*
*
* @param ids 需要删除的消息信息主键
* @return 结果
*/
@Override
public int deleteMessageInfoByIds(String[] ids)
{
public int deleteMessageInfoByIds(String[] ids) {
return messageInfoMapper.deleteMessageInfoByIds(ids);
}
/**
* 删除消息信息信息
*
*
* @param id 消息信息主键
* @return 结果
*/
@Override
public int deleteMessageInfoById(String id)
{
public int deleteMessageInfoById(String id) {
return messageInfoMapper.deleteMessageInfoById(id);
}
}
......@@ -63,7 +63,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by a.status asc, a.create_time desc
</select>
<select id="selectUnReadCount" parameterType="String" resultType="java.lang.Integer">
select count(0)
from message_info
where `status` = '0'
and message_by = #{loginName}
</select>
<select id="selectMessageInfoById" parameterType="String" resultMap="MessageInfoResult">
<include refid="selectMessageInfoVo"/>
where id = #{id}
......@@ -128,6 +135,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<update id="updateChangeStatus" parameterType="String">
update message_info
set `status` = '1'
where `status` = '0'
and message_by = #{loginName}
</update>
<delete id="deleteMessageInfoById" parameterType="String">
delete from message_info where id = #{id}
</delete>
......
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