Commit 98f02517 authored by yf's avatar yf

新增消息、代办接口

parent b6ca943e
package com.censoft.censoftrongtong.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
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 org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.BacklogInfo;
import com.ruoyi.system.service.IBacklogInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 待办信息Controller
*
* @author ruoyi
* @date 2024-01-09
*/
@RestController
@RequestMapping(value = {"/system/backlogInfo","/app-api/backlogInfo"})
public class BacklogInfoController extends BaseController {
@Autowired
private IBacklogInfoService backlogInfoService;
/**
* 查询待办信息列表
*/
@PreAuthorize("@ss.hasPermi('system:backlogInfo:list')")
@GetMapping("/list")
public TableDataInfo list(BacklogInfo backlogInfo) {
startPage();
String loginName = getUsername();
if (StringUtils.isNotNull(backlogInfo.getParams().get("beginTime")) && !"".equals(backlogInfo.getParams().get("beginTime"))) {
String beginTime = backlogInfo.getParams().get("beginTime") + " 00:00:00";
backlogInfo.setBeginTime(beginTime);
}
if (StringUtils.isNotNull(backlogInfo.getParams().get("endTime")) && !"".equals(backlogInfo.getParams().get("endTime"))) {
String endTime = backlogInfo.getParams().get("endTime") + " 59:59:59";
backlogInfo.setEndTime(endTime);
}
backlogInfo.setBacklogBy(loginName);
backlogInfo.setMenuUrl("menu_url");
backlogInfo.setAppUrl("app_url");
List<BacklogInfo> list = backlogInfoService.selectBacklogInfoList(backlogInfo);
for (BacklogInfo info : list) {
String createBy = info.getCreateBy() == null ? "系统" : info.getCreateBy();
info.setCreateBy(createBy);
}
return getDataTable(list);
}
/**
* 查询未读信息数量
*/
@GetMapping("/unReadCount")
@ResponseBody
public AjaxResult unReadCount() {
Map<String, Integer> map = new HashMap<>();
String loginName = getUsername();
int backlogInfo = backlogInfoService.selectUnReadCount(loginName, "app_url", "menu_url");
map.put("待办事项", backlogInfo);
return AjaxResult.success(map);
}
/**
* 清除未读
*/
@GetMapping("/changeStatus")
@ResponseBody
public AjaxResult changeStatus() {
String loginName = getUsername();
return toAjax(backlogInfoService.updateChangeStatus(loginName));
}
/**
* 查询待办信息各状态数量
*/
@GetMapping("/status/count")
@ResponseBody
public AjaxResult getStatusCount(String beginTime,String endTime,String keyword) {
String loginName = getUsername();
if (StringUtils.isNotEmpty(beginTime)) {
beginTime = beginTime + " 00:00:00";
}
if (StringUtils.isNotEmpty(endTime)) {
endTime = endTime + " 59:59:59";
}
return AjaxResult.success(backlogInfoService.getStatusCount(loginName,beginTime,endTime,keyword));
}
/**
* 导出待办信息列表
*/
@PreAuthorize("@ss.hasPermi('system:backlogInfo:export')")
@Log(title = "待办信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BacklogInfo backlogInfo) {
List<BacklogInfo> list = backlogInfoService.selectBacklogInfoList(backlogInfo);
ExcelUtil<BacklogInfo> util = new ExcelUtil<BacklogInfo>(BacklogInfo.class);
util.exportExcel(response, list, "待办信息数据");
}
/**
* 获取待办信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:backlogInfo:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(backlogInfoService.selectBacklogInfoById(id));
}
/**
* 新增待办信息
*/
@PreAuthorize("@ss.hasPermi('system:backlogInfo:add')")
@Log(title = "待办信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BacklogInfo backlogInfo) {
return toAjax(backlogInfoService.insertBacklogInfo(backlogInfo));
}
/**
* 修改待办信息
*/
@PreAuthorize("@ss.hasPermi('system:backlogInfo:edit')")
@Log(title = "待办信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BacklogInfo backlogInfo) {
return toAjax(backlogInfoService.updateBacklogInfo(backlogInfo));
}
/**
* 删除待办信息
*/
@PreAuthorize("@ss.hasPermi('system:backlogInfo:remove')")
@Log(title = "待办信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(backlogInfoService.deleteBacklogInfoByIds(ids));
}
}
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.MessageInfo;
import com.ruoyi.system.service.IMessageInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 消息信息Controller
*
* @author ruoyi
* @date 2024-01-09
*/
@RestController
@RequestMapping("/system/messageInfo")
public class MessageInfoController extends BaseController
{
@Autowired
private IMessageInfoService messageInfoService;
/**
* 查询消息信息列表
*/
// @RequiresPermissions("system:messageInfo:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(MessageInfo messageInfo) {
startPage();
String loginName = getUsername();
if (StringUtils.isNotNull(messageInfo.getParams().get("beginTime")) && !"".equals(messageInfo.getParams().get("beginTime"))) {
String beginTime = messageInfo.getParams().get("beginTime") + " 00:00:00";
messageInfo.setBeginTime(beginTime);
}
if (StringUtils.isNotNull(messageInfo.getParams().get("endTime")) && !"".equals(messageInfo.getParams().get("endTime"))) {
String endTime = messageInfo.getParams().get("endTime") + " 59:59:59";
messageInfo.setEndTime(endTime);
}
messageInfo.setMessageBy(loginName);
List<MessageInfo> list = messageInfoService.selectMessageInfoList(messageInfo);
for (MessageInfo info : list) {
String createBy = info.getCreateBy() == null ? "系统" : info.getCreateBy();
info.setCreateBy(createBy);
}
return getDataTable(list);
}
/**
* 导出消息信息列表
*/
@PreAuthorize("@ss.hasPermi('system:messageInfo:export')")
@Log(title = "消息信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MessageInfo messageInfo)
{
List<MessageInfo> list = messageInfoService.selectMessageInfoList(messageInfo);
ExcelUtil<MessageInfo> util = new ExcelUtil<MessageInfo>(MessageInfo.class);
util.exportExcel(response, list, "消息信息数据");
}
/**
* 获取消息信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:messageInfo:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(messageInfoService.selectMessageInfoById(id));
}
/**
* 新增消息信息
*/
@PreAuthorize("@ss.hasPermi('system:messageInfo:add')")
@Log(title = "消息信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MessageInfo messageInfo)
{
return toAjax(messageInfoService.insertMessageInfo(messageInfo));
}
/**
* 修改消息信息
*/
@PreAuthorize("@ss.hasPermi('system:messageInfo:edit')")
@Log(title = "消息信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MessageInfo messageInfo)
{
return toAjax(messageInfoService.updateMessageInfo(messageInfo));
}
/**
* 删除消息信息
*/
@PreAuthorize("@ss.hasPermi('system:messageInfo:remove')")
@Log(title = "消息信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(messageInfoService.deleteMessageInfoByIds(ids));
}
/**
* 未读改为已读
*/
// @Log(title = "消息信息", businessType = BusinessType.UPDATE)
@PostMapping("/changeRead")
@ResponseBody
@Transactional
public AjaxResult changeRead(MessageInfo messageInfo) {
messageInfo.setStatus("1");
return toAjax(messageInfoService.updateMessageInfo(messageInfo));
}
}
package com.ruoyi.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 待办信息对象 backlog_info
*
* @author ruoyi
* @date 2024-01-09
*/
@Data
public class BacklogInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 流程事项ID */
private String id;
/** 节点ID */
@Excel(name = "节点ID")
private String nodeId;
/** 流程ID */
@Excel(name = "流程ID")
private String pid;
/** 主表id(app) */
@Excel(name = "主表id", readConverterExp = "a=pp")
private String mainId;
/** 标题 */
@Excel(name = "标题")
private String title;
/** 主题 */
@Excel(name = "主题")
private String theme;
/** 内容详情 */
@Excel(name = "内容详情")
private String content;
/** 办理状态(0:待办,1:已办) */
@Excel(name = "办理状态", readConverterExp = "0=:待办,1:已办")
private String status;
/** 待办人 */
@Excel(name = "待办人")
private String backlogBy;
/** app路由名称 */
@Excel(name = "app路由名称")
private String menuName;
/** pc路由地址 */
@Excel(name = "pc路由地址")
private String menuUrl;
/** app路由地址 */
@Excel(name = "app路由地址")
private String appUrl;
/**
* 开始时间
*/
@Excel(name = "开始时间")
@TableField(exist = false)
private String beginTime;
/**
* 结束时间
*/
@Excel(name = "结束时间")
@TableField(exist = false)
private String endTime;
}
package com.ruoyi.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 消息信息对象 message_info
*
* @author ruoyi
* @date 2024-01-09
*/
@Data
public class MessageInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 消息信息ID */
private String id;
/** 节点ID */
@Excel(name = "节点ID")
private String nodeId;
/** 流程事项ID */
@Excel(name = "流程事项ID")
private String pid;
/** 信息标题 */
@Excel(name = "信息标题")
private String title;
/** 信息内容详情 */
@Excel(name = "信息内容详情")
private String content;
/** 消息已读状态(0:未读、1:已读) */
@Excel(name = "消息已读状态", readConverterExp = "0=:未读、1:已读")
private String status;
/** 消息通知人 */
@Excel(name = "消息通知人")
private String messageBy;
/** app菜单名称 */
@Excel(name = "app菜单名称")
private String menuName;
/** pc菜单路由 */
@Excel(name = "pc菜单路由")
private String menuUrl;
/** app路由 */
@Excel(name = "app路由")
private String appUrl;
/**
* 开始时间
*/
@Excel(name = "开始时间")
@TableField(exist = false)
private String beginTime;
/**
* 结束时间
*/
@Excel(name = "结束时间")
@TableField(exist = false)
private String endTime;
}
package com.ruoyi.system.mapper;
import java.util.List;
import java.util.Map;
import com.ruoyi.system.domain.BacklogInfo;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* 待办信息Mapper接口
*
* @author ruoyi
* @date 2024-01-09
*/
public interface BacklogInfoMapper extends MPJBaseMapper<BacklogInfo>
{
/**
* 查询待办信息
*
* @param id 待办信息主键
* @return 待办信息
*/
public BacklogInfo selectBacklogInfoById(String id);
/**
* 查询待办信息列表
*
* @param backlogInfo 待办信息
* @return 待办信息集合
*/
public List<BacklogInfo> selectBacklogInfoList(BacklogInfo backlogInfo);
/**
* 查询待办未读信息数量
*/
public int selectUnReadCount(@Param("loginName") String loginName, @Param("app_url") String app_url, @Param("menu_url") String menu_url);
/**
* 清除未读
*/
public boolean updateChangeStatus(String loginName);
Map<String, Integer> getStatusCount(@Param("loginName") String loginName, @Param("beginTime") String beginTime
, @Param("endTime") String endTime, @Param("keyword") String keyword);
int updateBacklogInfoByPid(BacklogInfo backlogInfo);
/**
* 新增待办信息
*
* @param backlogInfo 待办信息
* @return 结果
*/
public int insertBacklogInfo(BacklogInfo backlogInfo);
/**
* 修改待办信息
*
* @param backlogInfo 待办信息
* @return 结果
*/
public int updateBacklogInfo(BacklogInfo backlogInfo);
/**
* 删除待办信息
*
* @param id 待办信息主键
* @return 结果
*/
public int deleteBacklogInfoById(String id);
/**
* 批量删除待办信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBacklogInfoByIds(String[] ids);
}
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.MessageInfo;
import com.github.yulichang.base.MPJBaseMapper;
/**
* 消息信息Mapper接口
*
* @author ruoyi
* @date 2024-01-09
*/
public interface MessageInfoMapper extends MPJBaseMapper<MessageInfo>
{
/**
* 查询消息信息
*
* @param id 消息信息主键
* @return 消息信息
*/
public MessageInfo selectMessageInfoById(String id);
/**
* 查询消息信息列表
*
* @param messageInfo 消息信息
* @return 消息信息集合
*/
public List<MessageInfo> selectMessageInfoList(MessageInfo messageInfo);
/**
* 新增消息信息
*
* @param messageInfo 消息信息
* @return 结果
*/
public int insertMessageInfo(MessageInfo messageInfo);
/**
* 修改消息信息
*
* @param messageInfo 消息信息
* @return 结果
*/
public int updateMessageInfo(MessageInfo messageInfo);
/**
* 删除消息信息
*
* @param id 消息信息主键
* @return 结果
*/
public int deleteMessageInfoById(String id);
/**
* 批量删除消息信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMessageInfoByIds(String[] ids);
}
package com.ruoyi.system.service;
import java.util.List;
import java.util.Map;
import com.ruoyi.system.domain.BacklogInfo;
import com.github.yulichang.base.MPJBaseService;
/**
* 待办信息Service接口
*
* @author ruoyi
* @date 2024-01-09
*/
public interface IBacklogInfoService extends MPJBaseService<BacklogInfo>
{
/**
* 查询待办信息
*
* @param id 待办信息主键
* @return 待办信息
*/
public BacklogInfo selectBacklogInfoById(String id);
/**
* 查询待办信息列表
*
* @param backlogInfo 待办信息
* @return 待办信息集合
*/
public List<BacklogInfo> selectBacklogInfoList(BacklogInfo backlogInfo);
/**
* 查询待办未读信息数量
*/
public int selectUnReadCount(String loginName, String app_url, String menu_url);
/**
* 查询待办信息各状态数量
*/
Map<String,Integer> getStatusCount(String loginName, String beginTime, String endTime, String keyword);
/**
* 清除未读
*/
public boolean updateChangeStatus(String loginName);
/**
* 新增待办信息
*
* @param backlogInfo 待办信息
* @return 结果
*/
public int insertBacklogInfo(BacklogInfo backlogInfo);
/**
* 修改待办信息
*
* @param backlogInfo 待办信息
* @return 结果
*/
public int updateBacklogInfo(BacklogInfo backlogInfo);
/**
* 批量删除待办信息
*
* @param ids 需要删除的待办信息主键集合
* @return 结果
*/
public int deleteBacklogInfoByIds(String[] ids);
/**
* 删除待办信息信息
*
* @param id 待办信息主键
* @return 结果
*/
public int deleteBacklogInfoById(String id);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.MessageInfo;
import com.github.yulichang.base.MPJBaseService;
/**
* 消息信息Service接口
*
* @author ruoyi
* @date 2024-01-09
*/
public interface IMessageInfoService extends MPJBaseService<MessageInfo>
{
/**
* 查询消息信息
*
* @param id 消息信息主键
* @return 消息信息
*/
public MessageInfo selectMessageInfoById(String id);
/**
* 查询消息信息列表
*
* @param messageInfo 消息信息
* @return 消息信息集合
*/
public List<MessageInfo> selectMessageInfoList(MessageInfo messageInfo);
/**
* 新增消息信息
*
* @param messageInfo 消息信息
* @return 结果
*/
public int insertMessageInfo(MessageInfo messageInfo);
/**
* 修改消息信息
*
* @param messageInfo 消息信息
* @return 结果
*/
public int updateMessageInfo(MessageInfo messageInfo);
/**
* 批量删除消息信息
*
* @param ids 需要删除的消息信息主键集合
* @return 结果
*/
public int deleteMessageInfoByIds(String[] ids);
/**
* 删除消息信息信息
*
* @param id 消息信息主键
* @return 结果
*/
public int deleteMessageInfoById(String id);
}
package com.ruoyi.system.service.impl;
import java.util.List;
import java.util.Map;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BacklogInfoMapper;
import com.ruoyi.system.domain.BacklogInfo;
import com.ruoyi.system.service.IBacklogInfoService;
import com.github.yulichang.base.MPJBaseServiceImpl;
/**
* 待办信息Service业务层处理
*
* @author ruoyi
* @date 2024-01-09
*/
@Service
public class BacklogInfoServiceImpl extends MPJBaseServiceImpl<BacklogInfoMapper, BacklogInfo> implements IBacklogInfoService {
@Autowired
private BacklogInfoMapper backlogInfoMapper;
/**
* 查询待办信息
*
* @param id 待办信息主键
* @return 待办信息
*/
@Override
public BacklogInfo selectBacklogInfoById(String id) {
return backlogInfoMapper.selectBacklogInfoById(id);
}
/**
* 查询待办信息列表
*
* @param backlogInfo 待办信息
* @return 待办信息
*/
@Override
public List<BacklogInfo> selectBacklogInfoList(BacklogInfo backlogInfo) {
return backlogInfoMapper.selectBacklogInfoList(backlogInfo);
}
/**
* 查询待办未读信息数量
*/
@Override
public int selectUnReadCount(String loginName, String app_url, String menu_url) {
return backlogInfoMapper.selectUnReadCount(loginName, app_url, menu_url);
}
@Override
public Map<String, Integer> getStatusCount(String loginName, String beginTime, String endTime, String keyword) {
return backlogInfoMapper.getStatusCount(loginName, beginTime, endTime, keyword);
}
/**
* 清除未读
*/
@Override
public boolean updateChangeStatus(String loginName) {
return backlogInfoMapper.updateChangeStatus(loginName);
}
/**
* 新增待办信息
*
* @param backlogInfo 待办信息
* @return 结果
*/
@Override
public int insertBacklogInfo(BacklogInfo backlogInfo) {
backlogInfo.setCreateTime(DateUtils.getNowDate());
return backlogInfoMapper.insertBacklogInfo(backlogInfo);
}
/**
* 修改待办信息
*
* @param backlogInfo 待办信息
* @return 结果
*/
@Override
public int updateBacklogInfo(BacklogInfo backlogInfo) {
backlogInfo.setUpdateTime(DateUtils.getNowDate());
return backlogInfoMapper.updateBacklogInfo(backlogInfo);
}
/**
* 批量删除待办信息
*
* @param ids 需要删除的待办信息主键
* @return 结果
*/
@Override
public int deleteBacklogInfoByIds(String[] ids) {
return backlogInfoMapper.deleteBacklogInfoByIds(ids);
}
/**
* 删除待办信息信息
*
* @param id 待办信息主键
* @return 结果
*/
@Override
public int deleteBacklogInfoById(String id) {
return backlogInfoMapper.deleteBacklogInfoById(id);
}
}
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;
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
{
@Autowired
private MessageInfoMapper messageInfoMapper;
/**
* 查询消息信息
*
* @param id 消息信息主键
* @return 消息信息
*/
@Override
public MessageInfo selectMessageInfoById(String id)
{
return messageInfoMapper.selectMessageInfoById(id);
}
/**
* 查询消息信息列表
*
* @param messageInfo 消息信息
* @return 消息信息
*/
@Override
public List<MessageInfo> selectMessageInfoList(MessageInfo messageInfo)
{
return messageInfoMapper.selectMessageInfoList(messageInfo);
}
/**
* 新增消息信息
*
* @param messageInfo 消息信息
* @return 结果
*/
@Override
public int insertMessageInfo(MessageInfo messageInfo)
{
messageInfo.setCreateTime(DateUtils.getNowDate());
return messageInfoMapper.insertMessageInfo(messageInfo);
}
/**
* 修改消息信息
*
* @param messageInfo 消息信息
* @return 结果
*/
@Override
public int updateMessageInfo(MessageInfo messageInfo)
{
messageInfo.setUpdateTime(DateUtils.getNowDate());
return messageInfoMapper.updateMessageInfo(messageInfo);
}
/**
* 批量删除消息信息
*
* @param ids 需要删除的消息信息主键
* @return 结果
*/
@Override
public int deleteMessageInfoByIds(String[] ids)
{
return messageInfoMapper.deleteMessageInfoByIds(ids);
}
/**
* 删除消息信息信息
*
* @param id 消息信息主键
* @return 结果
*/
@Override
public int deleteMessageInfoById(String id)
{
return messageInfoMapper.deleteMessageInfoById(id);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.MessageInfoMapper">
<resultMap type="MessageInfo" id="MessageInfoResult">
<result property="id" column="id" />
<result property="nodeId" column="node_id" />
<result property="pid" column="pid" />
<result property="title" column="title" />
<result property="content" column="content" />
<result property="status" column="status" />
<result property="messageBy" column="message_by" />
<result property="menuName" column="menu_name" />
<result property="menuUrl" column="menu_url" />
<result property="appUrl" column="app_url" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectMessageInfoVo">
select id, node_id, pid, title, content, status, message_by, menu_name, menu_url, app_url, create_by, create_time, update_by, update_time, remark from message_info
</sql>
<select id="selectMessageInfoList" parameterType="MessageInfo" resultMap="MessageInfoResult">
select a.id,
a.node_id,
a.pid,
a.title,
a.content,
a.status,
(select user_name from sys_user b where b.user_name = a.message_by and b.del_flag = 0) message_by,
a.menu_name,
a.menu_url,
a.app_url,
(select user_name from sys_user b where b.user_name = a.create_by and b.del_flag = 0) create_by,
a.create_time
from message_info a
<where>
<if test="messageBy != null and messageBy != ''">and a.message_by = #{messageBy}</if>
<if test="status != null and status != ''">and a.status = #{status}</if>
<if test="keyword != null and keyword != ''">and ( a.title like concat('%', #{keyword}, '%')</if>
<if test="keyword != null and keyword != ''">or a.content like concat('%', #{keyword}, '%')</if>
<if test="keyword != null and keyword != ''">or a.menu_name like concat('%', #{keyword}, '%')</if>
<if test="keyword != null and keyword != ''">or a.create_by like concat('%', #{keyword}, '%')</if>
<if test="keyword != null and keyword != ''">or a.update_by like concat('%', #{keyword}, '%') )</if>
<!-- <if test="params.beginTime != null and params.beginTime != ''">&lt;!&ndash; 开始时间检索 &ndash;&gt;-->
<!-- and a.create_time &gt;= #{params.beginTime}-->
<!-- </if>-->
<!-- <if test="params.endTime != null and params.endTime != ''">&lt;!&ndash; 结束时间检索 &ndash;&gt;-->
<!-- and a.create_time &lt;= #{params.endTime}-->
<!-- </if>-->
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
and a.create_time &gt;= #{beginTime}
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
and a.create_time &lt;= #{endTime}
</if>
</where>
order by a.status asc, a.create_time desc
</select>
<select id="selectMessageInfoById" parameterType="String" resultMap="MessageInfoResult">
<include refid="selectMessageInfoVo"/>
where id = #{id}
</select>
<insert id="insertMessageInfo" parameterType="MessageInfo">
insert into message_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="nodeId != null">node_id,</if>
<if test="pid != null">pid,</if>
<if test="title != null">title,</if>
<if test="content != null">content,</if>
<if test="status != null">status,</if>
<if test="messageBy != null">message_by,</if>
<if test="menuName != null">menu_name,</if>
<if test="menuUrl != null">menu_url,</if>
<if test="appUrl != null">app_url,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="nodeId != null">#{nodeId},</if>
<if test="pid != null">#{pid},</if>
<if test="title != null">#{title},</if>
<if test="content != null">#{content},</if>
<if test="status != null">#{status},</if>
<if test="messageBy != null">#{messageBy},</if>
<if test="menuName != null">#{menuName},</if>
<if test="menuUrl != null">#{menuUrl},</if>
<if test="appUrl != null">#{appUrl},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateMessageInfo" parameterType="MessageInfo">
update message_info
<trim prefix="SET" suffixOverrides=",">
<if test="nodeId != null">node_id = #{nodeId},</if>
<if test="pid != null">pid = #{pid},</if>
<if test="title != null">title = #{title},</if>
<if test="content != null">content = #{content},</if>
<if test="status != null">status = #{status},</if>
<if test="messageBy != null">message_by = #{messageBy},</if>
<if test="menuName != null">menu_name = #{menuName},</if>
<if test="menuUrl != null">menu_url = #{menuUrl},</if>
<if test="appUrl != null">app_url = #{appUrl},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMessageInfoById" parameterType="String">
delete from message_info where id = #{id}
</delete>
<delete id="deleteMessageInfoByIds" parameterType="String">
delete from message_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
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