1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 15:01:23 +08:00

Temp commit deleteByNoticeId solve

This commit is contained in:
cccccyb
2023-05-01 23:03:03 +08:00
parent e8bc1f5945
commit 42dd714ed1
8 changed files with 151 additions and 27 deletions

View File

@@ -10,6 +10,8 @@ import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -30,6 +32,7 @@ public class Notice implements Serializable {
private static final long serialVersionUID = 1L;
@TableId("id")
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
@@ -48,6 +51,7 @@ public class Notice implements Serializable {
* 公告类型Id
*/
@TableField("type_id")
@JsonSerialize(using = ToStringSerializer.class)
private Long typeId;
/**
@@ -60,6 +64,7 @@ public class Notice implements Serializable {
* 发布者id
*/
@TableField("sender_id")
@JsonSerialize(using = ToStringSerializer.class)
private Long senderId;
/**
@@ -108,6 +113,7 @@ public class Notice implements Serializable {
* 源ID
*/
@TableField("origin_id")
@JsonSerialize(using = ToStringSerializer.class)
private Long originId;
/**

View File

@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.annotation.Version;
import java.io.Serial;
import java.io.Serializable;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -29,12 +31,14 @@ public class NoticeReceive implements Serializable {
private static final long serialVersionUID = 1L;
@TableId("id")
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 用户Id
*/
@TableField("user_id")
@JsonSerialize(using = ToStringSerializer.class)
private Long userId;
/**
@@ -47,6 +51,7 @@ public class NoticeReceive implements Serializable {
* 公告Id
*/
@TableField("notice_id")
@JsonSerialize(using = ToStringSerializer.class)
private Long noticeId;
/**

View File

@@ -9,6 +9,9 @@ import com.baomidou.mybatisplus.annotation.Version;
import java.io.Serial;
import java.io.Serializable;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -29,6 +32,7 @@ public class NoticeType implements Serializable {
private static final long serialVersionUID = 1L;
@TableId("id")
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**

View File

@@ -45,7 +45,7 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
noticeReceives) {
noticeReceiveMapper.deleteById(nrc.getId());
}
return noticeMapper.deleteById(nid)==0;
return noticeMapper.deleteById(nid)>0;
}
}

View File

@@ -20,17 +20,54 @@
<!-- 查询所有公告 -->
<select id="selectAllNotice" resultMap="NoticeAllResultMap">
select *
select u.id uid,
username,
passwd,
department_id,
u.deleted ude,
u.version uve,
n.id nid,
title,
content,
type_id,
sender_id,
create_time,
send_time,
end_time,
priority,
top,
modify_time,
origin_id,
old,
n.deleted nde,
n.version nve,
type.id typeId,
name,
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 type.id = n.type_id
and n.deleted = 0
and n.old=0
and n.old = 0
</select>
<resultMap id="NoticeAllResultMap" type="notice" autoMapping="true">
<association property="sender" javaType="user" autoMapping="true"/>
<association property="noticeType" javaType="noticeType" 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>
</mapper>

View File

@@ -52,17 +52,19 @@ public class NoticeTest {
@Test
void insertNoticeTest() {
Notice notice = new Notice();
notice.setTitle("title1");
notice.setTypeId(1652684907554496514L);
notice.setSenderId(1652714496280469506L);
LocalDateTime sendTime = LocalDateTime.parse("2023-05-11 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
LocalDateTime endTime = LocalDateTime.parse("2023-09-01 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
notice.setPriority(2);
notice.setSendTime(sendTime);
notice.setEndTime(endTime);
notice.setContent("Content1");
noticeController.addNotice(notice);
for (int i = 2; i < 20; i++) {
Notice notice = new Notice();
notice.setTitle("title"+i);
notice.setTypeId(1652684907554496514L);
notice.setSenderId(1652714496280469506L);
LocalDateTime sendTime = LocalDateTime.parse("2023-05-11 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
LocalDateTime endTime = LocalDateTime.parse("2023-09-01 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
notice.setPriority(2);
notice.setSendTime(sendTime);
notice.setEndTime(endTime);
notice.setContent("Content"+i);
noticeController.addNotice(notice);
}
}
@Test
void insertNoticeTypeTest(){