Commit c327e149 authored by huyuchen's avatar huyuchen

消息提醒修改

parent 396a91a1
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.msg.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
/**
* 消息提醒
*
* @author huyc
* @date 2023-07-26 14:19:33
*/
@Data
@TableName("t_message_info")
@EqualsAndHashCode()
@Schema(description = "消息提醒")
public class TMessageInfo {
/**
* ID
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("ID")
@Schema(description = "ID")
private String id;
/**
* 提交人-表单制作人
*/
@ExcelAttribute(name = "提交人-表单制作人", maxLength = 10)
@Length(max = 10, message = "提交人-表单制作人不能超过10个字符")
@ExcelProperty("提交人-表单制作人")
@Schema(description = "提交人-表单制作人")
private String submitUser;
/**
* 0 待办 1 待阅
*/
@ExcelAttribute(name = "0 待办 1 待阅", maxLength = 1)
@Length(max = 1, message = "0 待办 1 待阅不能超过1个字符")
@ExcelProperty("0 待办 1 待阅")
@Schema(description = "0 待办 1 待阅")
private String alertType;
/**
* 0 已处理 1 未处理
*/
@ExcelAttribute(name = "0 已处理 1 未处理", maxLength = 1)
@Length(max = 1, message = "0 已处理 1 未处理不能超过1个字符")
@ExcelProperty("0 已处理 1 未处理")
@Schema(description = "0 已处理 1 未处理")
private String handlerStatus;
/**
* 处理人-当前提醒人
*/
@ExcelAttribute(name = "处理人-当前提醒人", maxLength = 10)
@Length(max = 10, message = "处理人-当前提醒人不能超过10个字符")
@ExcelProperty("处理人-当前提醒人")
@Schema(description = "处理人-当前提醒人")
private String alertUser;
/**
* listUrl
*/
@ExcelAttribute(name = "listUrl", maxLength = 200)
@Length(max = 200, message = "listUrl不能超过200个字符")
@ExcelProperty("listUrl")
@Schema(description = "listUrl")
private String listUrl;
/**
* infoUrl
*/
@ExcelAttribute(name = "infoUrl", maxLength = 200)
@Length(max = 200, message = "infoUrl不能超过200个字符")
@ExcelProperty("infoUrl")
@Schema(description = "infoUrl")
private String infoUrl;
/**
* 模块
*/
@ExcelAttribute(name = "模块", maxLength = 20)
@Length(max = 20, message = "模块不能超过20个字符")
@ExcelProperty("模块")
@Schema(description = "模块")
private String modelType;
/**
* 关联id
*/
@ExcelAttribute(name = "关联id", maxLength = 32)
@Length(max = 32, message = "关联id不能超过32个字符")
@ExcelProperty("关联id")
@Schema(description = "关联id")
private String modelId;
/**
* 创建时间
*/
@ExcelAttribute(name = "创建时间", isDate = true)
@ExcelProperty("创建时间")
@Schema(description = "创建时间")
private Date createTime;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.msg.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.msg.entity.TMessageInfo;
import com.yifu.cloud.plus.v1.msg.service.TMessageInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
/**
* 消息提醒
*
* @author huyc
* @date 2023-07-26 14:19:33
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/tmessageinfo" )
@Tag(name = "消息提醒管理")
public class TMessageInfoController {
private final TMessageInfoService tMessageInfoService;
/**
* 简单分页查询
* @param page 分页对象
* @param tMessageInfo 消息提醒
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TMessageInfo>> getTMessageInfoPage(Page<TMessageInfo> page, TMessageInfo tMessageInfo) {
return new R<>(tMessageInfoService.getTMessageInfoPage(page,tMessageInfo));
}
/**
* 通过id查询消息提醒
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('demo_tmessageinfo_get')" )
public R<TMessageInfo> getById(@PathVariable("id" ) String id) {
return R.ok(tMessageInfoService.getById(id));
}
/**
* 新增消息提醒
* @param tMessageInfo 消息提醒
* @return R
*/
@Operation(summary = "新增消息提醒", description = "新增消息提醒")
@SysLog("新增消息提醒" )
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_tmessageinfo_add')" )
public R<Boolean> save(@RequestBody TMessageInfo tMessageInfo) {
return R.ok(tMessageInfoService.save(tMessageInfo));
}
/**
* 修改消息提醒
* @param tMessageInfo 消息提醒
* @return R
*/
@Operation(summary = "修改消息提醒", description = "修改消息提醒")
@SysLog("修改消息提醒" )
@PutMapping
@PreAuthorize("@pms.hasPermission('demo_tmessageinfo_edit')" )
public R<Boolean> updateById(@RequestBody TMessageInfo tMessageInfo) {
return R.ok(tMessageInfoService.updateById(tMessageInfo));
}
/**
* @Author huyc
* @Description 更新消息信息
* @Date 14:30 2023/7/26
* @Param
* @return
**/
@Operation(summary = "更新消息信息", description = "更新消息信息")
@Inner
@PostMapping("/inner/updateMessageInfo")
public void updateMessageInfo(@RequestBody TMessageInfo tMessageInfo) {
tMessageInfoService.updateMessageInfo(tMessageInfo);
}
/**
* @Author huyc
* @Description 查询消息数量
* @Date 14:30 2023/7/26
* @Param
* @return
**/
@Operation(summary = "查询消息数量", description = "查询消息数量")
@PostMapping("/selectMessageCount")
public long selectMessageCount(@RequestBody TMessageInfo tMessageInfo) {
return tMessageInfoService.selectMessageCount(tMessageInfo);
}
/**
* 通过id删除消息提醒
* @param id id
* @return R
*/
@Operation(summary = "通过id删除消息提醒", description = "通过id删除消息提醒")
@SysLog("通过id删除消息提醒" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('demo_tmessageinfo_del')" )
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(tMessageInfoService.removeById(id));
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.msg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.msg.entity.TMessageInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 消息提醒
*
* @author huyc
* @date 2023-07-26 14:19:33
*/
@Mapper
public interface TMessageInfoMapper extends BaseMapper<TMessageInfo> {
/**
* 消息提醒简单分页查询
* @param tMessageInfo 消息提醒
* @return
*/
IPage<TMessageInfo> getTMessageInfoPage(Page<TMessageInfo> page, @Param("tMessageInfo") TMessageInfo tMessageInfo);
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.msg.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.msg.entity.TMessageInfo;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 消息提醒
*
* @author huyc
* @date 2023-07-26 14:19:33
*/
public interface TMessageInfoService extends IService<TMessageInfo> {
/**
* 消息提醒简单分页查询
* @param tMessageInfo 消息提醒
* @return
*/
IPage<TMessageInfo> getTMessageInfoPage(Page<TMessageInfo> page, TMessageInfo tMessageInfo);
void updateMessageInfo(@RequestBody TMessageInfo tMessageInfo);
long selectMessageCount(@RequestBody TMessageInfo tMessageInfo);
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.msg.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.msg.entity.TMessageInfo;
import com.yifu.cloud.plus.v1.msg.mapper.TMessageInfoMapper;
import com.yifu.cloud.plus.v1.msg.service.TMessageInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
/**
* 消息提醒
*
* @author huyc
* @date 2023-07-26 14:19:33
*/
@Log4j2
@Service
public class TMessageInfoServiceImpl extends ServiceImpl<TMessageInfoMapper, TMessageInfo> implements TMessageInfoService {
/**
* 消息提醒简单分页查询
* @param tMessageInfo 消息提醒
* @return
*/
@Override
public IPage<TMessageInfo> getTMessageInfoPage(Page<TMessageInfo> page, TMessageInfo tMessageInfo){
return baseMapper.getTMessageInfoPage(page,tMessageInfo);
}
@Override
public void updateMessageInfo(TMessageInfo tMessageInfo) {
if (Common.isNotNull(tMessageInfo) && Common.isNotNull(tMessageInfo.getAlertUser())) {
TMessageInfo tMessageInfo1 = null;
if (Common.isNotNull(tMessageInfo.getModelId())) {
tMessageInfo1 = baseMapper.selectOne(Wrappers.<TMessageInfo>query().lambda()
.eq(TMessageInfo::getAlertUser, tMessageInfo.getAlertUser())
.eq(TMessageInfo::getModelId, tMessageInfo.getModelId())
.orderByDesc(TMessageInfo::getCreateTime).last(CommonConstants.LAST_ONE_SQL));
} else if (Common.isNotNull(tMessageInfo.getInfoUrl())){
tMessageInfo1 = baseMapper.selectOne(Wrappers.<TMessageInfo>query().lambda()
.eq(TMessageInfo::getAlertUser, tMessageInfo.getAlertUser())
.eq(TMessageInfo::getInfoUrl, tMessageInfo.getInfoUrl())
.orderByDesc(TMessageInfo::getCreateTime).last(CommonConstants.LAST_ONE_SQL));
}
if (Common.isNotNull(tMessageInfo1)) {
tMessageInfo1.setHandlerStatus(tMessageInfo.getHandlerStatus());
}
}
}
@Override
public long selectMessageCount(TMessageInfo tMessageInfo) {
return baseMapper.selectCount(Wrappers.<TMessageInfo>query().lambda()
.eq(TMessageInfo::getAlertUser,tMessageInfo.getAlertUser())
.eq(TMessageInfo::getModelId,tMessageInfo.getModelId())
.eq(TMessageInfo::getHandlerStatus,CommonConstants.ONE_STRING));
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.msg.mapper.TMessageInfoMapper">
<resultMap id="tMessageInfoMap" type="com.yifu.cloud.plus.v1.msg.entity.TMessageInfo">
<id property="id" column="ID"/>
<result property="submitUser" column="SUBMIT_USER"/>
<result property="alertType" column="ALERT_TYPE"/>
<result property="handlerStatus" column="HANDLER_STATUS"/>
<result property="alertUser" column="ALERT_USER"/>
<result property="listUrl" column="LIST_URL"/>
<result property="infoUrl" column="INFO_URL"/>
<result property="modelType" column="MODEL_TYPE"/>
<result property="modelId" column="MODEL_ID"/>
<result property="createTime" column="CREATE_TIME"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.SUBMIT_USER,
a.ALERT_TYPE,
a.HANDLER_STATUS,
a.ALERT_USER,
a.LIST_URL,
a.INFO_URL,
a.MODEL_TYPE,
a.MODEL_ID,
a.CREATE_TIME
</sql>
<sql id="tMessageInfo_where">
<if test="tMessageInfo != null">
<if test="tMessageInfo.submitUser != null and tMessageInfo.submitUser.trim() != ''">
AND a.SUBMIT_USER = #{tMessageInfo.submitUser}
</if>
<if test="tMessageInfo.alertType != null and tMessageInfo.alertType.trim() != ''">
AND a.ALERT_TYPE = #{tMessageInfo.alertType}
</if>
<if test="tMessageInfo.handlerStatus != null and tMessageInfo.handlerStatus.trim() != ''">
AND a.HANDLER_STATUS = #{tMessageInfo.handlerStatus}
</if>
<if test="tMessageInfo.alertUser != null and tMessageInfo.alertUser.trim() != ''">
AND a.ALERT_USER = #{tMessageInfo.alertUser}
</if>
<if test="tMessageInfo.infoUrl != null and tMessageInfo.infoUrl.trim() != ''">
AND a.INFO_URL = #{tMessageInfo.infoUrl}
</if>
<if test="tMessageInfo.listUrl != null and tMessageInfo.listUrl.trim() != ''">
AND a.LIST_URL = #{tMessageInfo.listUrl}
</if>
<if test="tMessageInfo.modelType != null and tMessageInfo.modelType.trim() != ''">
AND a.MODEL_TYPE = #{tMessageInfo.modelType}
</if>
</if>
</sql>
<!--tMessageInfo简单分页查询-->
<select id="getTMessageInfoPage" resultMap="tMessageInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_message_info a
<where>
1=1
<include refid="tMessageInfo_where"/>
</where>
order by a.CREATE_TIME desc
</select>
</mapper>
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