mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 06:51:23 +08:00
nitice module modified query with mybatis plus linked table to xml
This commit is contained in:
@@ -42,12 +42,12 @@ public class NoticeController {
|
||||
|
||||
//查询所有公告
|
||||
@GetMapping
|
||||
public ResponseResult selectAllNotice(String title, String type, String startTime,String endTime) {
|
||||
public ResponseResult selectAllNotice(String title, String type, String startTime, String endTime) {
|
||||
List<Notice> noticeList;
|
||||
if (!StringUtils.hasText(title) && !StringUtils.hasText(type) && !StringUtils.hasText(startTime) && !StringUtils.hasText(endTime)) {
|
||||
if (!StringUtils.hasText(title) && !StringUtils.hasText(type) && !StringUtils.hasText(startTime) && !StringUtils.hasText(endTime)) {
|
||||
noticeList = noticeService.selectAllNotice();
|
||||
} else {
|
||||
noticeList = noticeService.selectByCond(title, type, startTime,endTime);
|
||||
noticeList = noticeService.selectByCond(title, type, startTime, endTime);
|
||||
}
|
||||
|
||||
int code = noticeList != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
||||
@@ -55,6 +55,14 @@ public class NoticeController {
|
||||
return ResponseResult.build(code, msg, noticeList);
|
||||
}
|
||||
|
||||
//根据登录用户id查询所接收的公告
|
||||
@GetMapping("/ByUserId")
|
||||
public ResponseResult selectAllByUserId() {
|
||||
List<Notice> noticesByUserId = noticeReceiveService.selectAllByUserId();
|
||||
Integer code = noticesByUserId != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
||||
String msg = noticesByUserId != null ? "" : "数据查询失败,请尝试!";
|
||||
return ResponseResult.build(code, msg, noticesByUserId);
|
||||
}
|
||||
|
||||
//更新公告
|
||||
@PutMapping
|
||||
@@ -67,19 +75,9 @@ public class NoticeController {
|
||||
//添加公告
|
||||
@PostMapping
|
||||
public ResponseResult addNotice(@RequestBody Notice notice) {
|
||||
notice.setSenderId(WebUtil.getLoginUser().getUser().getId());
|
||||
boolean insertNotice = noticeService.save(notice);
|
||||
Long noticeId = notice.getId();
|
||||
boolean flag = false;
|
||||
for (Long receiveId :
|
||||
notice.getReceivers()) {
|
||||
NoticeReceive noticeReceive = new NoticeReceive();
|
||||
noticeReceive.setNoticeId(noticeId);
|
||||
noticeReceive.setUserId(receiveId);
|
||||
flag = noticeReceiveService.save(noticeReceive);
|
||||
}
|
||||
String msg = (insertNotice && flag) ? "" : "数据添加失败,请尝试!";
|
||||
return ResponseResult.build((insertNotice && flag) ? ResponseCode.DATABASE_SAVE_OK : ResponseCode.DATABASE_SAVE_ERROR, msg, noticeId);
|
||||
Boolean insertNotice = noticeService.addNotice(notice);
|
||||
String msg = insertNotice ? "" : "数据添加失败,请尝试!";
|
||||
return ResponseResult.build(insertNotice ? ResponseCode.DATABASE_SAVE_OK : ResponseCode.DATABASE_SAVE_ERROR, msg, insertNotice);
|
||||
}
|
||||
|
||||
//删除公告
|
||||
@@ -88,6 +86,6 @@ public class NoticeController {
|
||||
boolean removeById = noticeService.deleteById(nid);
|
||||
String msg = removeById ? "" : "数据删除失败,请尝试!";
|
||||
return ResponseResult.build(removeById ? ResponseCode.DATABASE_DELETE_OK : ResponseCode.DATABASE_DELETE_ERROR, msg, removeById);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -128,6 +128,9 @@ public class Notice implements Serializable {
|
||||
@TableField("old")
|
||||
private Integer old;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer isRead;
|
||||
|
||||
@TableField("deleted")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.cfive.pinnacle.entity.Department;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门 Mapper 接口
|
||||
@@ -14,5 +16,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
*/
|
||||
@Mapper
|
||||
public interface DepartmentMapper extends BaseMapper<Department> {
|
||||
|
||||
List<Department> getDepartAndUser();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.cfive.pinnacle.entity.Notice;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -19,4 +20,6 @@ public interface NoticeMapper extends BaseMapper<Notice> {
|
||||
Notice selectByNoticeId(Long nid);
|
||||
|
||||
List<Notice> selectAllNotice();
|
||||
|
||||
List<Notice> selectByCond(String title, String type, LocalDateTime startTime, LocalDateTime endTime);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.cfive.pinnacle.mapper;
|
||||
|
||||
import com.cfive.pinnacle.entity.Notice;
|
||||
import com.cfive.pinnacle.entity.NoticeReceive;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公告接收 Mapper 接口
|
||||
@@ -14,5 +17,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
*/
|
||||
@Mapper
|
||||
public interface NoticeReceiveMapper extends BaseMapper<NoticeReceive> {
|
||||
List<Notice> selectAllByUserId(Long userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.cfive.pinnacle.service;
|
||||
|
||||
import com.cfive.pinnacle.entity.Notice;
|
||||
import com.cfive.pinnacle.entity.NoticeReceive;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公告接收 服务类
|
||||
@@ -12,5 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
* @since 2023-04-30
|
||||
*/
|
||||
public interface INoticeReceiveService extends IService<NoticeReceive> {
|
||||
|
||||
List<Notice> selectAllByUserId();
|
||||
}
|
||||
|
||||
@@ -23,4 +23,6 @@ public interface INoticeService extends IService<Notice> {
|
||||
Boolean deleteById(Long nid);
|
||||
|
||||
Boolean updateNotice(Notice notice);
|
||||
|
||||
Boolean addNotice(Notice notice);
|
||||
}
|
||||
|
||||
@@ -29,13 +29,6 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
||||
private UserMapper userMapper;
|
||||
@Override
|
||||
public List<Department> getDepartAndUser() {
|
||||
List<Department> departments = departmentMapper.selectList(null);
|
||||
for (Department department:
|
||||
departments) {
|
||||
LambdaQueryWrapper<User> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(User::getDepartmentId, department.getId());
|
||||
department.setUserList(userMapper.selectList(lqw));
|
||||
}
|
||||
return departments;
|
||||
return departmentMapper.getDepartAndUser();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package com.cfive.pinnacle.service.impl;
|
||||
|
||||
import com.cfive.pinnacle.entity.Notice;
|
||||
import com.cfive.pinnacle.entity.NoticeReceive;
|
||||
import com.cfive.pinnacle.mapper.NoticeReceiveMapper;
|
||||
import com.cfive.pinnacle.service.INoticeReceiveService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cfive.pinnacle.utils.WebUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公告接收 服务实现类
|
||||
@@ -16,5 +21,11 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class NoticeReceiveServiceImpl extends ServiceImpl<NoticeReceiveMapper, NoticeReceive> implements INoticeReceiveService {
|
||||
|
||||
@Autowired
|
||||
private NoticeReceiveMapper noticeReceiveMapper;
|
||||
@Override
|
||||
public List<Notice> selectAllByUserId() {
|
||||
Long userId = WebUtil.getLoginUser().getUser().getId();
|
||||
return noticeReceiveMapper.selectAllByUserId(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.cfive.pinnacle.mapper.NoticeTypeMapper;
|
||||
import com.cfive.pinnacle.mapper.UserMapper;
|
||||
import com.cfive.pinnacle.service.INoticeService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cfive.pinnacle.utils.WebUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -47,56 +48,59 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
||||
@Override
|
||||
public List<Notice> selectAllNotice() {
|
||||
List<Notice> notices = noticeMapper.selectAllNotice();
|
||||
if (null != notices) {
|
||||
for (Notice notice :
|
||||
notices) {
|
||||
LambdaQueryWrapper<NoticeReceive> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(NoticeReceive::getNoticeId, notice.getId());
|
||||
List<NoticeReceive> noticeReceives = noticeReceiveMapper.selectList(lqw);
|
||||
List<Long> receiverIdList = new ArrayList<>();
|
||||
for (NoticeReceive noticeReceive :
|
||||
noticeReceives) {
|
||||
receiverIdList.add(noticeReceive.getUserId());
|
||||
}
|
||||
notice.setReceivers(receiverIdList);
|
||||
}
|
||||
}
|
||||
// if (null != notices) {
|
||||
// for (Notice notice :
|
||||
// notices) {
|
||||
// LambdaQueryWrapper<NoticeReceive> lqw = new LambdaQueryWrapper<>();
|
||||
// lqw.eq(NoticeReceive::getNoticeId, notice.getId());
|
||||
// List<NoticeReceive> noticeReceives = noticeReceiveMapper.selectList(lqw);
|
||||
// List<Long> receiverIdList = new ArrayList<>();
|
||||
// for (NoticeReceive noticeReceive :
|
||||
// noticeReceives) {
|
||||
// receiverIdList.add(noticeReceive.getUserId());
|
||||
// }
|
||||
// notice.setReceivers(receiverIdList);
|
||||
// }
|
||||
// }
|
||||
return notices;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Notice> selectByCond(String title, String type, String startTime,String endTime) {
|
||||
List<Notice> notices = new ArrayList<>();
|
||||
LocalDateTime start = null;
|
||||
LocalDateTime end = null;
|
||||
LocalDateTime start;
|
||||
LocalDateTime end;
|
||||
try {
|
||||
start = LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
end = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
} catch (Exception e) {
|
||||
startTime = null;
|
||||
endTime = null;
|
||||
}
|
||||
LambdaQueryWrapper<Notice> lqw_notice = new LambdaQueryWrapper<>();
|
||||
LambdaQueryWrapper<NoticeType> lqw_type = new LambdaQueryWrapper<>();
|
||||
lqw_type.like(null != type, NoticeType::getName, type);
|
||||
List<NoticeType> noticeTypes = noticeTypeMapper.selectList(lqw_type);
|
||||
for (NoticeType noticeType : noticeTypes
|
||||
) {
|
||||
lqw_notice.clear();
|
||||
lqw_notice.eq(!noticeTypes.isEmpty(), Notice::getTypeId, noticeType.getId()).like(null != title, Notice::getTitle, title);
|
||||
lqw_notice.ge(StringUtils.hasText(startTime), Notice::getSendTime, start);
|
||||
lqw_notice.le(StringUtils.hasText(endTime), Notice::getEndTime, end);
|
||||
List<Notice> temp_notice = noticeMapper.selectList(lqw_notice);
|
||||
notices.addAll(temp_notice);
|
||||
}
|
||||
for (Notice n : notices
|
||||
) {
|
||||
n.setSender(userMapper.selectById(n.getSenderId()));
|
||||
n.setNoticeType(noticeTypeMapper.selectById(n.getTypeId()));
|
||||
start = null;
|
||||
end = null;
|
||||
}
|
||||
// LambdaQueryWrapper<Notice> lqw_notice = new LambdaQueryWrapper<>();
|
||||
// LambdaQueryWrapper<NoticeType> lqw_type = new LambdaQueryWrapper<>();
|
||||
// lqw_type.like(null != type, NoticeType::getName, type);
|
||||
// List<NoticeType> noticeTypes = noticeTypeMapper.selectList(lqw_type);
|
||||
// for (NoticeType noticeType : noticeTypes
|
||||
// ) {
|
||||
// lqw_notice.clear();
|
||||
// lqw_notice.eq(!noticeTypes.isEmpty(), Notice::getTypeId, noticeType.getId()).like(null != title, Notice::getTitle, title);
|
||||
// lqw_notice.ge(StringUtils.hasText(startTime), Notice::getSendTime, start);
|
||||
// lqw_notice.le(StringUtils.hasText(endTime), Notice::getEndTime, end);
|
||||
// lqw_notice.eq(Notice::getOld, 0);
|
||||
// List<Notice> temp_notice = noticeMapper.selectList(lqw_notice);
|
||||
// notices.addAll(temp_notice);
|
||||
// }
|
||||
// for (Notice n : notices
|
||||
// ) {
|
||||
// n.setSender(userMapper.selectById(n.getSenderId()));
|
||||
// n.setNoticeType(noticeTypeMapper.selectById(n.getTypeId()));
|
||||
// }
|
||||
|
||||
List<Notice> notices=noticeMapper.selectByCond(title, type, start, end);
|
||||
return notices;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean deleteById(Long nid) {
|
||||
LambdaQueryWrapper<NoticeReceive> lqw = new LambdaQueryWrapper<>();
|
||||
@@ -120,4 +124,24 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
||||
return noticeMapper.insert(notice) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean addNotice(Notice notice) {
|
||||
Boolean noticeFlag,noticeRecFlag=false;
|
||||
// notice.setSenderId(WebUtil.getLoginUser().getUser().getId());
|
||||
notice.setSenderId(1652714496280469506L);
|
||||
noticeFlag = noticeMapper.insert(notice)>0;
|
||||
Long noticeId = notice.getId();
|
||||
for (Long receiveId :
|
||||
notice.getReceivers()) {
|
||||
NoticeReceive noticeReceive = new NoticeReceive();
|
||||
noticeReceive.setNoticeId(noticeId);
|
||||
noticeReceive.setUserId(receiveId);
|
||||
noticeRecFlag = noticeReceiveMapper.insert(noticeReceive)>0;
|
||||
if (!noticeRecFlag){
|
||||
break;
|
||||
}
|
||||
}
|
||||
return noticeFlag && noticeRecFlag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cfive.pinnacle.mapper.DepartmentMapper">
|
||||
<select id="getDepartAndUser" resultMap="department">
|
||||
select d.id,name,u.id,username from t_department d,t_user u where d.id=u.department_id and d.deleted=0 and u.deleted=0
|
||||
select d.id did,name,u.id uid,username from t_department d,t_user u where d.id=u.department_id and d.deleted=0 and u.deleted=0
|
||||
</select>
|
||||
<resultMap id="department" type="department" autoMapping="true">
|
||||
<id column="id" property="id"/>
|
||||
<id column="did" property="id"/>
|
||||
<collection property="userList" ofType="user" autoMapping="true">
|
||||
<id column="uid" property="id"/>
|
||||
<result column="uid" property="id"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
t_notice n,
|
||||
t_notice_type type
|
||||
where u.id = n.sender_id
|
||||
and type.id=n.type_id
|
||||
and type.id = n.type_id
|
||||
and n.id = #{nid}
|
||||
and n.deleted = 0
|
||||
and n.old=0
|
||||
and n.old = 0
|
||||
</select>
|
||||
<resultMap id="NoticeByIdResultMap" type="notice" autoMapping="true">
|
||||
<association property="sender" javaType="user" autoMapping="true"/>
|
||||
@@ -20,13 +20,9 @@
|
||||
|
||||
<!-- 查询所有公告 -->
|
||||
<select id="selectAllNotice" resultMap="NoticeAllResultMap">
|
||||
select u.id uid,
|
||||
select u.id uid,
|
||||
username,
|
||||
passwd,
|
||||
department_id,
|
||||
u.deleted ude,
|
||||
u.version uve,
|
||||
n.id nid,
|
||||
n.id nid,
|
||||
title,
|
||||
content,
|
||||
type_id,
|
||||
@@ -38,37 +34,62 @@
|
||||
top,
|
||||
modify_time,
|
||||
origin_id,
|
||||
old,
|
||||
n.deleted nde,
|
||||
n.version nve,
|
||||
type.id typeId,
|
||||
type.id typeId,
|
||||
name,
|
||||
type.enable,
|
||||
type.deleted typeDe,
|
||||
type.version typeVe
|
||||
from t_user u,
|
||||
t_notice n,
|
||||
t_notice_type type
|
||||
where u.id = n.sender_id
|
||||
and type.id = n.type_id
|
||||
and n.deleted = 0
|
||||
type.enable
|
||||
from t_notice n
|
||||
left join t_notice_type type on n.type_id = type.id
|
||||
left join t_user u on n.sender_id = u.id
|
||||
where n.deleted = 0
|
||||
and n.old = 0
|
||||
order by create_time desc
|
||||
</select>
|
||||
<resultMap id="NoticeAllResultMap" type="notice" autoMapping="true">
|
||||
<id property="id" column="nid"/>
|
||||
<result property="deleted" column="nde"/>
|
||||
<result property="version" column="nve"/>
|
||||
<association property="sender" javaType="user" autoMapping="true">
|
||||
<id property="id" column="uid"/>
|
||||
<result property="deleted" column="ude"/>
|
||||
<result property="version" column="uve"/>
|
||||
</association>
|
||||
<association property="noticeType" javaType="noticeType" autoMapping="true">
|
||||
<id property="id" column="typeId"/>
|
||||
<result property="deleted" column="typeDe"/>
|
||||
<result property="version" column="typeVe"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
<!-- 模糊查询-->
|
||||
<!-- 模糊查询-->
|
||||
<select id="selectByCond" resultMap="NoticeAllResultMap">
|
||||
select u.id uid,
|
||||
username,
|
||||
n.id nid,
|
||||
title,
|
||||
content,
|
||||
type_id,
|
||||
sender_id,
|
||||
create_time,
|
||||
send_time,
|
||||
end_time,
|
||||
priority,
|
||||
top,
|
||||
modify_time,
|
||||
origin_id,
|
||||
type.id typeId,
|
||||
type.name,
|
||||
type.enable
|
||||
from t_notice n
|
||||
left join t_notice_type type on n.type_id = type.id
|
||||
left join t_user u on n.sender_id = u.id
|
||||
<where>
|
||||
<if test="null!=title and title!=''">
|
||||
and instr(title,#{title})>0
|
||||
</if>
|
||||
<if test="null!=type and type!=''">
|
||||
and instr(type.name,#{type})>0
|
||||
</if>
|
||||
<if test="null!=startTime">
|
||||
and send_time >= #{startTime}
|
||||
</if>
|
||||
<if test="null !=endTime">
|
||||
and end_time < #{endTime}
|
||||
</if>
|
||||
and n.deleted = 0
|
||||
and n.old = 0
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,5 +1,40 @@
|
||||
<?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.cfive.pinnacle.mapper.NoticeReceiveMapper">
|
||||
|
||||
<select id="selectAllByUserId" parameterType="Long" resultMap="selectAllMap">
|
||||
select u.id uid,
|
||||
username,
|
||||
n.id nid,
|
||||
title,
|
||||
content,
|
||||
type_id,
|
||||
sender_id,
|
||||
create_time,
|
||||
send_time,
|
||||
end_time,
|
||||
priority,
|
||||
top,
|
||||
modify_time,
|
||||
origin_id,
|
||||
type.id typeId,
|
||||
name,
|
||||
type.enable,
|
||||
notice_receive.id receiveId,
|
||||
notice_receive.already_read receiveRead
|
||||
from t_notice_receive notice_receive
|
||||
left join t_notice n on n.id = notice_receive.notice_id
|
||||
left join t_notice_type type on type.id = n.type_id
|
||||
left join t_user u on n.sender_id = u.id
|
||||
where notice_receive.user_id=#{userId}
|
||||
</select>
|
||||
<resultMap id="selectAllMap" type="notice" autoMapping="true">
|
||||
<id property="id" column="nid"/>
|
||||
<result property="isRead" column="receiveRead"/>
|
||||
<association property="noticeType" javaType="noticeType" autoMapping="true">
|
||||
<id property="id" column="typeId"/>
|
||||
</association>
|
||||
<association property="sender" javaType="user" autoMapping="true">
|
||||
<id property="id" column="uid"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cfive.pinnacle.controller.NoticeController;
|
||||
import com.cfive.pinnacle.entity.*;
|
||||
import com.cfive.pinnacle.entity.common.ResponseResult;
|
||||
import com.cfive.pinnacle.mapper.NoticeMapper;
|
||||
import com.cfive.pinnacle.service.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -19,6 +20,8 @@ public class NoticeTest {
|
||||
@Autowired
|
||||
private NoticeController noticeController;
|
||||
@Autowired
|
||||
private NoticeMapper noticeMapper;
|
||||
@Autowired
|
||||
private INoticeService iNoticeService;
|
||||
@Autowired
|
||||
private INoticeTypeService iNoticeTypeService;
|
||||
@@ -48,7 +51,7 @@ public class NoticeTest {
|
||||
|
||||
@Test
|
||||
void insertNoticeTest() {
|
||||
for (int i = 20; i < 40; i++) {
|
||||
for (int i = 11; i < 40; i++) {
|
||||
Notice notice = new Notice();
|
||||
notice.setTitle("title" + i);
|
||||
notice.setTypeId(1654069011361476609L);
|
||||
@@ -59,7 +62,7 @@ public class NoticeTest {
|
||||
notice.setSendTime(sendTime);
|
||||
notice.setEndTime(endTime);
|
||||
notice.setContent("Content" + i);
|
||||
noticeController.addNotice(notice);
|
||||
noticeMapper.insert(notice);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +89,7 @@ public class NoticeTest {
|
||||
@Test
|
||||
void insertNoticeRecTest() {
|
||||
NoticeReceive receive = new NoticeReceive();
|
||||
receive.setNoticeId(1654070031407886338L);
|
||||
receive.setNoticeId(1655408487006437377L);
|
||||
receive.setUserId(1652714496280469506L);
|
||||
iNoticeReceiveService.save(receive);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user