mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-04 22:41:24 +08:00
Temp commit deleteByNoticeId solve
This commit is contained in:
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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(){
|
||||
|
||||
56
ui/src/components/NoticeEdit.vue
Normal file
56
ui/src/components/NoticeEdit.vue
Normal file
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<el-form :model="form">
|
||||
<el-form-item label="Promotion name" :label-width="formLabelWidth">
|
||||
<el-input v-model="form.name" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="Zones" :label-width="formLabelWidth">
|
||||
<el-select v-model="form.region" placeholder="Please select a zone">
|
||||
<el-option label="Zone No.1" value="shanghai" />
|
||||
<el-option label="Zone No.2" value="beijing" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">Cancel</el-button>
|
||||
<el-button type="primary" @click="dialogFormVisible = false">
|
||||
Confirm
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "NoticeEdit",
|
||||
data(){
|
||||
return{
|
||||
dialogFormVisible:false,
|
||||
formLabelWidth:'140px',
|
||||
form:[{
|
||||
name: '',
|
||||
region: '',
|
||||
date1: '',
|
||||
date2: '',
|
||||
delivery: false,
|
||||
type: [],
|
||||
resource: '',
|
||||
desc: '',
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-button--text {
|
||||
margin-right: 15px;
|
||||
}
|
||||
.el-select {
|
||||
width: 300px;
|
||||
}
|
||||
.el-input {
|
||||
width: 300px;
|
||||
}
|
||||
.dialog-footer button:first-child {
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -63,23 +63,36 @@
|
||||
<el-table-column label="Operations">
|
||||
<template #default="scope">
|
||||
<el-button size="small" @click="handleEdit(scope.$index, scope.row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
>编辑
|
||||
</el-button>
|
||||
<el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)"
|
||||
>删除</el-button
|
||||
>
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 编辑会话框-->
|
||||
<el-dialog v-model="dialogFormVisible">
|
||||
<template #title>
|
||||
{{ dialogFormTitle }}
|
||||
</template>
|
||||
<notice-edit />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
<script lang="ts">
|
||||
import axios from "axios";
|
||||
import NoticeEdit from "@/components/NoticeEdit.vue";
|
||||
|
||||
|
||||
export default {
|
||||
components: {NoticeEdit},
|
||||
component: {NoticeEdit},
|
||||
data() {
|
||||
return {
|
||||
tableData: []
|
||||
tableData: [],
|
||||
dialogFormVisible: false,
|
||||
dialogFormTitle: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -108,10 +121,11 @@ export default {
|
||||
return dt
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
console.log(index, row.id)
|
||||
this.dialogFormVisible = true
|
||||
this.dialogFormTitle = row.title
|
||||
console.log(index + " " + row);
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
// console.log(row.id)
|
||||
axios.delete('http://localhost:8621/notice/' + row.id).then((response) => {
|
||||
console.log(response.data)
|
||||
this.selectAllNotice()
|
||||
@@ -120,7 +134,7 @@ export default {
|
||||
selectAllNotice() {
|
||||
axios.get('http://localhost:8621/notice').then((response) => {
|
||||
this.tableData = response.data.data;
|
||||
console.log(response.data.data[0].id)
|
||||
console.log(response.data.data)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user