feat: 一些优化
This commit is contained in:
parent
131dc542fa
commit
be2de42902
|
|
@ -0,0 +1,55 @@
|
|||
package com.nflg.mobilebroken.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 消息
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@TableName("app_message")
|
||||
public class AppMessage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 工单id
|
||||
*/
|
||||
private Integer ticketId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 提醒事项
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 是否已读
|
||||
*/
|
||||
private Boolean isRead;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.nflg.mobilebroken.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@TableName("t_base_department")
|
||||
public class TBaseDepartment implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id 自增id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 部门编码
|
||||
*/
|
||||
private String deptCode;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 部门父类ID
|
||||
*/
|
||||
private Integer deptParentId;
|
||||
|
||||
/**
|
||||
* 有效状态 0否1是
|
||||
*/
|
||||
private Byte dataValidStatus;
|
||||
|
||||
/**
|
||||
* 创建人编号
|
||||
*/
|
||||
private String dataCreateUserNo;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String dataCreateUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime dataCreateTime;
|
||||
|
||||
/**
|
||||
* 修改人编号
|
||||
*/
|
||||
private String dataModifyUserNo;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String dataModifyUserName;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime dataModifyTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.nflg.mobilebroken.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.MessageVO;
|
||||
import com.nflg.mobilebroken.repository.entity.AppMessage;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 消息 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
public interface AppMessageMapper extends BaseMapper<AppMessage> {
|
||||
|
||||
List<MessageVO> getNotReadMessage(Integer userId, Integer num);
|
||||
|
||||
void search(Integer userId, String title, IPage<MessageVO> page);
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nflg.mobilebroken.repository.mapper;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.TBaseDepartment;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
public interface TBaseDepartmentMapper extends BaseMapper<TBaseDepartment> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.nflg.mobilebroken.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.MessageVO;
|
||||
import com.nflg.mobilebroken.repository.entity.AppMessage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 消息 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
public interface IAppMessageService extends IService<AppMessage> {
|
||||
|
||||
List<MessageVO> getNotReadMessage(Integer userId, Integer num);
|
||||
|
||||
void search(Integer userId, String title, IPage<MessageVO> page);
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nflg.mobilebroken.repository.service;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.TBaseDepartment;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
public interface ITBaseDepartmentService extends IService<TBaseDepartment> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.nflg.mobilebroken.repository.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.MessageVO;
|
||||
import com.nflg.mobilebroken.repository.entity.AppMessage;
|
||||
import com.nflg.mobilebroken.repository.mapper.AppMessageMapper;
|
||||
import com.nflg.mobilebroken.repository.service.IAppMessageService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 消息 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
@Service
|
||||
public class AppMessageServiceImpl extends ServiceImpl<AppMessageMapper, AppMessage> implements IAppMessageService {
|
||||
|
||||
@Override
|
||||
public List<MessageVO> getNotReadMessage(Integer userId, Integer num) {
|
||||
return baseMapper.getNotReadMessage(userId,num);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void search(Integer userId, String title, IPage<MessageVO> page) {
|
||||
baseMapper.search(userId,title,page);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.nflg.mobilebroken.repository.service.impl;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.TBaseDepartment;
|
||||
import com.nflg.mobilebroken.repository.mapper.TBaseDepartmentMapper;
|
||||
import com.nflg.mobilebroken.repository.service.ITBaseDepartmentService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
@Service
|
||||
public class TBaseDepartmentServiceImpl extends ServiceImpl<TBaseDepartmentMapper, TBaseDepartment> implements ITBaseDepartmentService {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?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.nflg.mobilebroken.repository.mapper.AppMessageMapper">
|
||||
|
||||
<select id="getNotReadMessage" resultType="com.nflg.mobilebroken.common.pojo.vo.MessageVO">
|
||||
SELECT t.id AS 'ticketId',t.`no` AS 'ticketNo',t.title AS 'ticketTitle',m.content,m.create_time AS 'createTime',u.`name` AS 'ticketCreateBy',t.create_time AS 'ticketCreateTime',t.handle AS 'ticketHandleBy',m.is_read AS 'isRead'
|
||||
FROM message m
|
||||
INNER JOIN ticket t ON m.ticket_id=t.id
|
||||
INNER JOIN app_user u ON t.user_id=u.id
|
||||
WHERE m.is_read=0 AND m.user_id=#{userId}
|
||||
ORDER BY m.id
|
||||
LIMIT #{num}
|
||||
</select>
|
||||
<select id="search" resultType="com.nflg.mobilebroken.common.pojo.vo.MessageVO">
|
||||
SELECT t.id AS 'ticketId',t.`no` AS 'ticketNo',t.title AS 'ticketTitle',m.content,m.create_time AS 'createTime',u.`name` AS 'ticketCreateBy',t.create_time AS 'ticketCreateTime',t.handle AS 'ticketHandleBy',m.is_read AS 'isRead'
|
||||
FROM message m
|
||||
INNER JOIN ticket t ON m.ticket_id=t.id
|
||||
INNER JOIN app_user u ON t.user_id=u.id
|
||||
WHERE m.user_id=#{userId}
|
||||
<if test="title != null and title != ''">
|
||||
AND (t.title LIKE CONCAT('%',#{title},'%') OR t.no LIKE CONCAT('%',#{title},'%'))
|
||||
</if>
|
||||
ORDER BY m.id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?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.nflg.mobilebroken.repository.mapper.TBaseDepartmentMapper">
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue