Commit 6a36fe65b2732e9f8787ccefbb9069d60fb76139
1 parent
42a984c8
1. 基本完成通知模块的迁移
Showing
28 changed files
with
384 additions
and
233 deletions
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java deleted
| 1 | -package com.ruoyi.system.service.impl; | ||
| 2 | - | ||
| 3 | -import java.util.List; | ||
| 4 | - | ||
| 5 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | -import org.springframework.stereotype.Service; | ||
| 7 | -import com.ruoyi.system.domain.SysNotice; | ||
| 8 | -import com.ruoyi.system.mapper.SysNoticeMapper; | ||
| 9 | -import com.ruoyi.system.service.ISysNoticeService; | ||
| 10 | - | ||
| 11 | -/** | ||
| 12 | - * 公告 服务层实现 | ||
| 13 | - * | ||
| 14 | - * @author ruoyi | ||
| 15 | - */ | ||
| 16 | -@Service | ||
| 17 | -public class SysNoticeServiceImpl implements ISysNoticeService { | ||
| 18 | - @Autowired | ||
| 19 | - private SysNoticeMapper noticeMapper; | ||
| 20 | - | ||
| 21 | - /** | ||
| 22 | - * 查询公告信息 | ||
| 23 | - * | ||
| 24 | - * @param noticeId 公告ID | ||
| 25 | - * @return 公告信息 | ||
| 26 | - */ | ||
| 27 | - @Override | ||
| 28 | - public SysNotice selectNoticeById(Long noticeId) { | ||
| 29 | - return noticeMapper.selectNoticeById(noticeId); | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - /** | ||
| 33 | - * 查询公告列表 | ||
| 34 | - * | ||
| 35 | - * @param notice 公告信息 | ||
| 36 | - * @return 公告集合 | ||
| 37 | - */ | ||
| 38 | - @Override | ||
| 39 | - public List<SysNotice> selectNoticeList(SysNotice notice) { | ||
| 40 | - return noticeMapper.selectNoticeList(notice); | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - /** | ||
| 44 | - * 新增公告 | ||
| 45 | - * | ||
| 46 | - * @param notice 公告信息 | ||
| 47 | - * @return 结果 | ||
| 48 | - */ | ||
| 49 | - @Override | ||
| 50 | - public int insertNotice(SysNotice notice) { | ||
| 51 | - return noticeMapper.insertNotice(notice); | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - /** | ||
| 55 | - * 修改公告 | ||
| 56 | - * | ||
| 57 | - * @param notice 公告信息 | ||
| 58 | - * @return 结果 | ||
| 59 | - */ | ||
| 60 | - @Override | ||
| 61 | - public int updateNotice(SysNotice notice) { | ||
| 62 | - return noticeMapper.updateNotice(notice); | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - /** | ||
| 66 | - * 删除公告对象 | ||
| 67 | - * | ||
| 68 | - * @param noticeId 公告ID | ||
| 69 | - * @return 结果 | ||
| 70 | - */ | ||
| 71 | - @Override | ||
| 72 | - public int deleteNoticeById(Long noticeId) { | ||
| 73 | - return noticeMapper.deleteNoticeById(noticeId); | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - /** | ||
| 77 | - * 批量删除公告信息 | ||
| 78 | - * | ||
| 79 | - * @param noticeIds 需要删除的公告ID | ||
| 80 | - * @return 结果 | ||
| 81 | - */ | ||
| 82 | - @Override | ||
| 83 | - public int deleteNoticeByIds(Long[] noticeIds) { | ||
| 84 | - return noticeMapper.deleteNoticeByIds(noticeIds); | ||
| 85 | - } | ||
| 86 | -} |
ruoyi-ui/src/api/system/notice.js
| @@ -3,7 +3,7 @@ import request from '@/utils/request' | @@ -3,7 +3,7 @@ import request from '@/utils/request' | ||
| 3 | // 查询公告列表 | 3 | // 查询公告列表 |
| 4 | export function listNotice(query) { | 4 | export function listNotice(query) { |
| 5 | return request({ | 5 | return request({ |
| 6 | - url: '/system/notice/list', | 6 | + url: '/system/notice/page', |
| 7 | method: 'get', | 7 | method: 'get', |
| 8 | params: query | 8 | params: query |
| 9 | }) | 9 | }) |
| @@ -12,7 +12,7 @@ export function listNotice(query) { | @@ -12,7 +12,7 @@ export function listNotice(query) { | ||
| 12 | // 查询公告详细 | 12 | // 查询公告详细 |
| 13 | export function getNotice(noticeId) { | 13 | export function getNotice(noticeId) { |
| 14 | return request({ | 14 | return request({ |
| 15 | - url: '/system/notice/' + noticeId, | 15 | + url: '/system/notice/get?id=' + noticeId, |
| 16 | method: 'get' | 16 | method: 'get' |
| 17 | }) | 17 | }) |
| 18 | } | 18 | } |
| @@ -20,7 +20,7 @@ export function getNotice(noticeId) { | @@ -20,7 +20,7 @@ export function getNotice(noticeId) { | ||
| 20 | // 新增公告 | 20 | // 新增公告 |
| 21 | export function addNotice(data) { | 21 | export function addNotice(data) { |
| 22 | return request({ | 22 | return request({ |
| 23 | - url: '/system/notice', | 23 | + url: '/system/notice/create', |
| 24 | method: 'post', | 24 | method: 'post', |
| 25 | data: data | 25 | data: data |
| 26 | }) | 26 | }) |
| @@ -29,7 +29,7 @@ export function addNotice(data) { | @@ -29,7 +29,7 @@ export function addNotice(data) { | ||
| 29 | // 修改公告 | 29 | // 修改公告 |
| 30 | export function updateNotice(data) { | 30 | export function updateNotice(data) { |
| 31 | return request({ | 31 | return request({ |
| 32 | - url: '/system/notice', | 32 | + url: '/system/notice/update', |
| 33 | method: 'put', | 33 | method: 'put', |
| 34 | data: data | 34 | data: data |
| 35 | }) | 35 | }) |
| @@ -38,7 +38,7 @@ export function updateNotice(data) { | @@ -38,7 +38,7 @@ export function updateNotice(data) { | ||
| 38 | // 删除公告 | 38 | // 删除公告 |
| 39 | export function delNotice(noticeId) { | 39 | export function delNotice(noticeId) { |
| 40 | return request({ | 40 | return request({ |
| 41 | - url: '/system/notice/' + noticeId, | 41 | + url: '/system/notice/delete?id=' + noticeId, |
| 42 | method: 'delete' | 42 | method: 'delete' |
| 43 | }) | 43 | }) |
| 44 | -} | ||
| 45 | \ No newline at end of file | 44 | \ No newline at end of file |
| 45 | +} |
ruoyi-ui/src/utils/dict.js
| @@ -11,6 +11,7 @@ export const DICT_TYPE = { | @@ -11,6 +11,7 @@ export const DICT_TYPE = { | ||
| 11 | SYS_ROLE_TYPE: 'sys_role_type', | 11 | SYS_ROLE_TYPE: 'sys_role_type', |
| 12 | SYS_DATA_SCOPE: 'sys_data_scope', | 12 | SYS_DATA_SCOPE: 'sys_data_scope', |
| 13 | SYS_USER_SEX: 'sys_user_sex', | 13 | SYS_USER_SEX: 'sys_user_sex', |
| 14 | + SYS_NOTICE_TYPE: 'sys_notice_type', | ||
| 14 | } | 15 | } |
| 15 | 16 | ||
| 16 | /** | 17 | /** |
ruoyi-ui/src/views/system/notice/index.vue
| 1 | <template> | 1 | <template> |
| 2 | <div class="app-container"> | 2 | <div class="app-container"> |
| 3 | <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> | 3 | <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> |
| 4 | - <el-form-item label="公告标题" prop="noticeTitle"> | 4 | + <el-form-item label="公告标题" prop="title"> |
| 5 | <el-input | 5 | <el-input |
| 6 | - v-model="queryParams.noticeTitle" | 6 | + v-model="queryParams.title" |
| 7 | placeholder="请输入公告标题" | 7 | placeholder="请输入公告标题" |
| 8 | clearable | 8 | clearable |
| 9 | size="small" | 9 | size="small" |
| @@ -19,13 +19,13 @@ | @@ -19,13 +19,13 @@ | ||
| 19 | @keyup.enter.native="handleQuery" | 19 | @keyup.enter.native="handleQuery" |
| 20 | /> | 20 | /> |
| 21 | </el-form-item> | 21 | </el-form-item> |
| 22 | - <el-form-item label="类型" prop="noticeType"> | ||
| 23 | - <el-select v-model="queryParams.noticeType" placeholder="公告类型" clearable size="small"> | 22 | + <el-form-item label="类型" prop="type"> |
| 23 | + <el-select v-model="queryParams.type" placeholder="公告类型" clearable size="small"> | ||
| 24 | <el-option | 24 | <el-option |
| 25 | - v-for="dict in typeOptions" | ||
| 26 | - :key="dict.dictValue" | ||
| 27 | - :label="dict.dictLabel" | ||
| 28 | - :value="dict.dictValue" | 25 | + v-for="dict in noticeTypeDictDatas" |
| 26 | + :key="parseInt(dict.value)" | ||
| 27 | + :label="dict.label" | ||
| 28 | + :value="parseInt(dict.value)" | ||
| 29 | /> | 29 | /> |
| 30 | </el-select> | 30 | </el-select> |
| 31 | </el-form-item> | 31 | </el-form-item> |
| @@ -45,42 +45,21 @@ | @@ -45,42 +45,21 @@ | ||
| 45 | v-hasPermi="['system:notice:add']" | 45 | v-hasPermi="['system:notice:add']" |
| 46 | >新增</el-button> | 46 | >新增</el-button> |
| 47 | </el-col> | 47 | </el-col> |
| 48 | - <el-col :span="1.5"> | ||
| 49 | - <el-button | ||
| 50 | - type="success" | ||
| 51 | - icon="el-icon-edit" | ||
| 52 | - size="mini" | ||
| 53 | - :disabled="single" | ||
| 54 | - @click="handleUpdate" | ||
| 55 | - v-hasPermi="['system:notice:edit']" | ||
| 56 | - >修改</el-button> | ||
| 57 | - </el-col> | ||
| 58 | - <el-col :span="1.5"> | ||
| 59 | - <el-button | ||
| 60 | - type="danger" | ||
| 61 | - icon="el-icon-delete" | ||
| 62 | - size="mini" | ||
| 63 | - :disabled="multiple" | ||
| 64 | - @click="handleDelete" | ||
| 65 | - v-hasPermi="['system:notice:remove']" | ||
| 66 | - >删除</el-button> | ||
| 67 | - </el-col> | ||
| 68 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | 48 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| 69 | </el-row> | 49 | </el-row> |
| 70 | 50 | ||
| 71 | - <el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange"> | ||
| 72 | - <el-table-column type="selection" width="55" align="center" /> | 51 | + <el-table v-loading="loading" :data="noticeList"> |
| 73 | <el-table-column label="序号" align="center" prop="noticeId" width="100" /> | 52 | <el-table-column label="序号" align="center" prop="noticeId" width="100" /> |
| 74 | <el-table-column | 53 | <el-table-column |
| 75 | label="公告标题" | 54 | label="公告标题" |
| 76 | align="center" | 55 | align="center" |
| 77 | - prop="noticeTitle" | 56 | + prop="title" |
| 78 | :show-overflow-tooltip="true" | 57 | :show-overflow-tooltip="true" |
| 79 | /> | 58 | /> |
| 80 | <el-table-column | 59 | <el-table-column |
| 81 | label="公告类型" | 60 | label="公告类型" |
| 82 | align="center" | 61 | align="center" |
| 83 | - prop="noticeType" | 62 | + prop="type" |
| 84 | :formatter="typeFormat" | 63 | :formatter="typeFormat" |
| 85 | width="100" | 64 | width="100" |
| 86 | /> | 65 | /> |
| @@ -120,7 +99,7 @@ | @@ -120,7 +99,7 @@ | ||
| 120 | <pagination | 99 | <pagination |
| 121 | v-show="total>0" | 100 | v-show="total>0" |
| 122 | :total="total" | 101 | :total="total" |
| 123 | - :page.sync="queryParams.pageNum" | 102 | + :page.sync="queryParams.pageNo" |
| 124 | :limit.sync="queryParams.pageSize" | 103 | :limit.sync="queryParams.pageSize" |
| 125 | @pagination="getList" | 104 | @pagination="getList" |
| 126 | /> | 105 | /> |
| @@ -130,13 +109,13 @@ | @@ -130,13 +109,13 @@ | ||
| 130 | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> | 109 | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| 131 | <el-row> | 110 | <el-row> |
| 132 | <el-col :span="12"> | 111 | <el-col :span="12"> |
| 133 | - <el-form-item label="公告标题" prop="noticeTitle"> | ||
| 134 | - <el-input v-model="form.noticeTitle" placeholder="请输入公告标题" /> | 112 | + <el-form-item label="公告标题" prop="title"> |
| 113 | + <el-input v-model="form.title" placeholder="请输入公告标题" /> | ||
| 135 | </el-form-item> | 114 | </el-form-item> |
| 136 | </el-col> | 115 | </el-col> |
| 137 | <el-col :span="12"> | 116 | <el-col :span="12"> |
| 138 | - <el-form-item label="公告类型" prop="noticeType"> | ||
| 139 | - <el-select v-model="form.noticeType" placeholder="请选择"> | 117 | + <el-form-item label="公告类型" prop="type"> |
| 118 | + <el-select v-model="form.type" placeholder="请选择"> | ||
| 140 | <el-option | 119 | <el-option |
| 141 | v-for="dict in typeOptions" | 120 | v-for="dict in typeOptions" |
| 142 | :key="dict.dictValue" | 121 | :key="dict.dictValue" |
| @@ -150,16 +129,16 @@ | @@ -150,16 +129,16 @@ | ||
| 150 | <el-form-item label="状态"> | 129 | <el-form-item label="状态"> |
| 151 | <el-radio-group v-model="form.status"> | 130 | <el-radio-group v-model="form.status"> |
| 152 | <el-radio | 131 | <el-radio |
| 153 | - v-for="dict in statusOptions" | ||
| 154 | - :key="dict.dictValue" | ||
| 155 | - :label="dict.dictValue" | ||
| 156 | - >{{dict.dictLabel}}</el-radio> | ||
| 157 | - </el-radio-group> | 132 | + v-for="dict in statusDictDatas" |
| 133 | + :key="parseInt(dict.value)" | ||
| 134 | + :label="dict.label" | ||
| 135 | + :value="parseInt(dict.value)" | ||
| 136 | + >{{dict.label}}</el-radio> | ||
| 158 | </el-form-item> | 137 | </el-form-item> |
| 159 | </el-col> | 138 | </el-col> |
| 160 | <el-col :span="24"> | 139 | <el-col :span="24"> |
| 161 | <el-form-item label="内容"> | 140 | <el-form-item label="内容"> |
| 162 | - <editor v-model="form.noticeContent" :min-height="192"/> | 141 | + <editor v-model="form.content" :min-height="192"/> |
| 163 | </el-form-item> | 142 | </el-form-item> |
| 164 | </el-col> | 143 | </el-col> |
| 165 | </el-row> | 144 | </el-row> |
| @@ -173,9 +152,12 @@ | @@ -173,9 +152,12 @@ | ||
| 173 | </template> | 152 | </template> |
| 174 | 153 | ||
| 175 | <script> | 154 | <script> |
| 176 | -import { listNotice, getNotice, delNotice, addNotice, updateNotice, exportNotice } from "@/api/system/notice"; | 155 | +import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"; |
| 177 | import Editor from '@/components/Editor'; | 156 | import Editor from '@/components/Editor'; |
| 178 | 157 | ||
| 158 | +import {SysCommonStatusEnum} from '@/utils/constants' | ||
| 159 | +import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict' | ||
| 160 | + | ||
| 179 | export default { | 161 | export default { |
| 180 | name: "Notice", | 162 | name: "Notice", |
| 181 | components: { | 163 | components: { |
| @@ -185,12 +167,6 @@ export default { | @@ -185,12 +167,6 @@ export default { | ||
| 185 | return { | 167 | return { |
| 186 | // 遮罩层 | 168 | // 遮罩层 |
| 187 | loading: true, | 169 | loading: true, |
| 188 | - // 选中数组 | ||
| 189 | - ids: [], | ||
| 190 | - // 非单个禁用 | ||
| 191 | - single: true, | ||
| 192 | - // 非多个禁用 | ||
| 193 | - multiple: true, | ||
| 194 | // 显示搜索条件 | 170 | // 显示搜索条件 |
| 195 | showSearch: true, | 171 | showSearch: true, |
| 196 | // 总条数 | 172 | // 总条数 |
| @@ -207,9 +183,9 @@ export default { | @@ -207,9 +183,9 @@ export default { | ||
| 207 | typeOptions: [], | 183 | typeOptions: [], |
| 208 | // 查询参数 | 184 | // 查询参数 |
| 209 | queryParams: { | 185 | queryParams: { |
| 210 | - pageNum: 1, | 186 | + pageNo: 1, |
| 211 | pageSize: 10, | 187 | pageSize: 10, |
| 212 | - noticeTitle: undefined, | 188 | + title: undefined, |
| 213 | createBy: undefined, | 189 | createBy: undefined, |
| 214 | status: undefined | 190 | status: undefined |
| 215 | }, | 191 | }, |
| @@ -217,41 +193,41 @@ export default { | @@ -217,41 +193,41 @@ export default { | ||
| 217 | form: {}, | 193 | form: {}, |
| 218 | // 表单校验 | 194 | // 表单校验 |
| 219 | rules: { | 195 | rules: { |
| 220 | - noticeTitle: [ | 196 | + title: [ |
| 221 | { required: true, message: "公告标题不能为空", trigger: "blur" } | 197 | { required: true, message: "公告标题不能为空", trigger: "blur" } |
| 222 | ], | 198 | ], |
| 223 | - noticeType: [ | 199 | + type: [ |
| 224 | { required: true, message: "公告类型不能为空", trigger: "change" } | 200 | { required: true, message: "公告类型不能为空", trigger: "change" } |
| 225 | ] | 201 | ] |
| 226 | - } | 202 | + }, |
| 203 | + | ||
| 204 | + // 枚举 | ||
| 205 | + CommonStatusEnum: SysCommonStatusEnum, | ||
| 206 | + // 数据字典 | ||
| 207 | + noticeTypeDictDatas: getDictDatas(DICT_TYPE.SYS_NOTICE_TYPE), | ||
| 208 | + statusDictDatas: getDictDatas(DICT_TYPE.SYS_COMMON_STATUS) | ||
| 227 | }; | 209 | }; |
| 228 | }, | 210 | }, |
| 229 | created() { | 211 | created() { |
| 230 | this.getList(); | 212 | this.getList(); |
| 231 | - this.getDicts("sys_notice_status").then(response => { | ||
| 232 | - this.statusOptions = response.data; | ||
| 233 | - }); | ||
| 234 | - this.getDicts("sys_notice_type").then(response => { | ||
| 235 | - this.typeOptions = response.data; | ||
| 236 | - }); | ||
| 237 | }, | 213 | }, |
| 238 | methods: { | 214 | methods: { |
| 239 | /** 查询公告列表 */ | 215 | /** 查询公告列表 */ |
| 240 | getList() { | 216 | getList() { |
| 241 | this.loading = true; | 217 | this.loading = true; |
| 242 | listNotice(this.queryParams).then(response => { | 218 | listNotice(this.queryParams).then(response => { |
| 243 | - this.noticeList = response.rows; | ||
| 244 | - this.total = response.total; | 219 | + this.noticeList = response.data.list; |
| 220 | + this.total = response.data.total; | ||
| 245 | this.loading = false; | 221 | this.loading = false; |
| 246 | }); | 222 | }); |
| 247 | }, | 223 | }, |
| 248 | // 公告状态字典翻译 | 224 | // 公告状态字典翻译 |
| 249 | statusFormat(row, column) { | 225 | statusFormat(row, column) { |
| 250 | - return this.selectDictLabel(this.statusOptions, row.status); | 226 | + return getDictDataLabel(DICT_TYPE.SYS_COMMON_STATUS, row.status) |
| 251 | }, | 227 | }, |
| 252 | // 公告状态字典翻译 | 228 | // 公告状态字典翻译 |
| 253 | typeFormat(row, column) { | 229 | typeFormat(row, column) { |
| 254 | - return this.selectDictLabel(this.typeOptions, row.noticeType); | 230 | + return getDictDataLabel(DICT_TYPE.SYS_NOTICE_TYPE, row.status) |
| 255 | }, | 231 | }, |
| 256 | // 取消按钮 | 232 | // 取消按钮 |
| 257 | cancel() { | 233 | cancel() { |
| @@ -262,16 +238,16 @@ export default { | @@ -262,16 +238,16 @@ export default { | ||
| 262 | reset() { | 238 | reset() { |
| 263 | this.form = { | 239 | this.form = { |
| 264 | noticeId: undefined, | 240 | noticeId: undefined, |
| 265 | - noticeTitle: undefined, | ||
| 266 | - noticeType: undefined, | ||
| 267 | - noticeContent: undefined, | ||
| 268 | - status: "0" | 241 | + title: undefined, |
| 242 | + type: undefined, | ||
| 243 | + content: undefined, | ||
| 244 | + status: SysCommonStatusEnum.ENABLE | ||
| 269 | }; | 245 | }; |
| 270 | this.resetForm("form"); | 246 | this.resetForm("form"); |
| 271 | }, | 247 | }, |
| 272 | /** 搜索按钮操作 */ | 248 | /** 搜索按钮操作 */ |
| 273 | handleQuery() { | 249 | handleQuery() { |
| 274 | - this.queryParams.pageNum = 1; | 250 | + this.queryParams.pageNo = 1; |
| 275 | this.getList(); | 251 | this.getList(); |
| 276 | }, | 252 | }, |
| 277 | /** 重置按钮操作 */ | 253 | /** 重置按钮操作 */ |
| @@ -279,12 +255,6 @@ export default { | @@ -279,12 +255,6 @@ export default { | ||
| 279 | this.resetForm("queryForm"); | 255 | this.resetForm("queryForm"); |
| 280 | this.handleQuery(); | 256 | this.handleQuery(); |
| 281 | }, | 257 | }, |
| 282 | - // 多选框选中数据 | ||
| 283 | - handleSelectionChange(selection) { | ||
| 284 | - this.ids = selection.map(item => item.noticeId) | ||
| 285 | - this.single = selection.length!=1 | ||
| 286 | - this.multiple = !selection.length | ||
| 287 | - }, | ||
| 288 | /** 新增按钮操作 */ | 258 | /** 新增按钮操作 */ |
| 289 | handleAdd() { | 259 | handleAdd() { |
| 290 | this.reset(); | 260 | this.reset(); |
| @@ -305,7 +275,7 @@ export default { | @@ -305,7 +275,7 @@ export default { | ||
| 305 | submitForm: function() { | 275 | submitForm: function() { |
| 306 | this.$refs["form"].validate(valid => { | 276 | this.$refs["form"].validate(valid => { |
| 307 | if (valid) { | 277 | if (valid) { |
| 308 | - if (this.form.noticeId != undefined) { | 278 | + if (this.form.noticeId !== undefined) { |
| 309 | updateNotice(this.form).then(response => { | 279 | updateNotice(this.form).then(response => { |
| 310 | this.msgSuccess("修改成功"); | 280 | this.msgSuccess("修改成功"); |
| 311 | this.open = false; | 281 | this.open = false; |
| @@ -337,4 +307,4 @@ export default { | @@ -337,4 +307,4 @@ export default { | ||
| 337 | } | 307 | } |
| 338 | } | 308 | } |
| 339 | }; | 309 | }; |
| 340 | -</script> | ||
| 341 | \ No newline at end of file | 310 | \ No newline at end of file |
| 311 | +</script> |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/dept/SysDeptRespVO.java
| @@ -13,7 +13,7 @@ import java.util.Date; | @@ -13,7 +13,7 @@ import java.util.Date; | ||
| 13 | public class SysDeptRespVO extends SysDeptBaseVO { | 13 | public class SysDeptRespVO extends SysDeptBaseVO { |
| 14 | 14 | ||
| 15 | @ApiModelProperty(value = "部门编号", required = true, example = "1024") | 15 | @ApiModelProperty(value = "部门编号", required = true, example = "1024") |
| 16 | - private Integer id; | 16 | + private Long id; |
| 17 | 17 | ||
| 18 | @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类") | 18 | @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类") |
| 19 | private Integer status; | 19 | private Integer status; |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/dept/SysDeptSimpleRespVO.java
| @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; | @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; | ||
| 13 | public class SysDeptSimpleRespVO { | 13 | public class SysDeptSimpleRespVO { |
| 14 | 14 | ||
| 15 | @ApiModelProperty(value = "部门编号", required = true, example = "1024") | 15 | @ApiModelProperty(value = "部门编号", required = true, example = "1024") |
| 16 | - private Integer id; | 16 | + private Long id; |
| 17 | 17 | ||
| 18 | @ApiModelProperty(value = "部门名称", required = true, example = "芋道") | 18 | @ApiModelProperty(value = "部门名称", required = true, example = "芋道") |
| 19 | private String name; | 19 | private String name; |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/post/SysPostRespVO.java
| @@ -13,7 +13,7 @@ import java.util.Date; | @@ -13,7 +13,7 @@ import java.util.Date; | ||
| 13 | public class SysPostRespVO extends SysPostBaseVO { | 13 | public class SysPostRespVO extends SysPostBaseVO { |
| 14 | 14 | ||
| 15 | @ApiModelProperty(value = "岗位序号", required = true, example = "1024") | 15 | @ApiModelProperty(value = "岗位序号", required = true, example = "1024") |
| 16 | - private Integer id; | 16 | + private Long id; |
| 17 | 17 | ||
| 18 | @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") | 18 | @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") |
| 19 | private Date createTime; | 19 | private Date createTime; |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/post/SysPostSimpleRespVO.java
| @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; | @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; | ||
| 13 | public class SysPostSimpleRespVO { | 13 | public class SysPostSimpleRespVO { |
| 14 | 14 | ||
| 15 | @ApiModelProperty(value = "岗位编号", required = true, example = "1024") | 15 | @ApiModelProperty(value = "岗位编号", required = true, example = "1024") |
| 16 | - private Integer id; | 16 | + private Long id; |
| 17 | 17 | ||
| 18 | @ApiModelProperty(value = "岗位名称", required = true, example = "芋道") | 18 | @ApiModelProperty(value = "岗位名称", required = true, example = "芋道") |
| 19 | private String name; | 19 | private String name; |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataRespVO.java
| @@ -17,7 +17,7 @@ import java.util.Date; | @@ -17,7 +17,7 @@ import java.util.Date; | ||
| 17 | public class SysDictDataRespVO extends SysDictDataBaseVO { | 17 | public class SysDictDataRespVO extends SysDictDataBaseVO { |
| 18 | 18 | ||
| 19 | @ApiModelProperty(value = "字典数据编号", required = true, example = "1024") | 19 | @ApiModelProperty(value = "字典数据编号", required = true, example = "1024") |
| 20 | - private Integer id; | 20 | + private Long id; |
| 21 | 21 | ||
| 22 | @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") | 22 | @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") |
| 23 | private Date createTime; | 23 | private Date createTime; |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeRespVO.java
| @@ -17,7 +17,7 @@ import java.util.Date; | @@ -17,7 +17,7 @@ import java.util.Date; | ||
| 17 | public class SysDictTypeRespVO extends SysDictTypeBaseVO { | 17 | public class SysDictTypeRespVO extends SysDictTypeBaseVO { |
| 18 | 18 | ||
| 19 | @ApiModelProperty(value = "字典类型编号", required = true, example = "1024") | 19 | @ApiModelProperty(value = "字典类型编号", required = true, example = "1024") |
| 20 | - private Integer id; | 20 | + private Long id; |
| 21 | 21 | ||
| 22 | @ApiModelProperty(value = "字典类型", required = true, example = "sys_common_sex") | 22 | @ApiModelProperty(value = "字典类型", required = true, example = "sys_common_sex") |
| 23 | private String type; | 23 | private String type; |
src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/SysNoticeController.java
| 1 | package cn.iocoder.dashboard.modules.system.controller.notice; | 1 | package cn.iocoder.dashboard.modules.system.controller.notice; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.dashboard.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.dashboard.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeCreateReqVO; | ||
| 6 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticePageReqVO; | ||
| 7 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeRespVO; | ||
| 8 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeUpdateReqVO; | ||
| 9 | +import cn.iocoder.dashboard.modules.system.convert.notice.SysNoticeConvert; | ||
| 10 | +import cn.iocoder.dashboard.modules.system.service.notice.SysNoticeService; | ||
| 3 | import io.swagger.annotations.Api; | 11 | import io.swagger.annotations.Api; |
| 4 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 5 | -import org.springframework.web.bind.annotation.RestController; | 12 | +import io.swagger.annotations.ApiImplicitParam; |
| 13 | +import io.swagger.annotations.ApiOperation; | ||
| 14 | +import org.springframework.validation.annotation.Validated; | ||
| 15 | +import org.springframework.web.bind.annotation.*; | ||
| 16 | + | ||
| 17 | +import javax.annotation.Resource; | ||
| 18 | + | ||
| 19 | +import static cn.iocoder.dashboard.common.pojo.CommonResult.success; | ||
| 6 | 20 | ||
| 7 | @Api(tags = "通知公告 API") | 21 | @Api(tags = "通知公告 API") |
| 8 | @RestController | 22 | @RestController |
| 9 | @RequestMapping("/system/notice") | 23 | @RequestMapping("/system/notice") |
| 10 | public class SysNoticeController { | 24 | public class SysNoticeController { |
| 11 | 25 | ||
| 12 | -// /** | ||
| 13 | -// * 获取通知公告列表 | ||
| 14 | -// */ | 26 | + @Resource |
| 27 | + private SysNoticeService noticeService; | ||
| 28 | + | ||
| 29 | + @ApiOperation("获取通知公告列表") | ||
| 30 | + @GetMapping("/page") | ||
| 15 | // @PreAuthorize("@ss.hasPermi('system:notice:list')") | 31 | // @PreAuthorize("@ss.hasPermi('system:notice:list')") |
| 16 | -// @GetMapping("/list") | ||
| 17 | -// public TableDataInfo list(SysNotice notice) { | ||
| 18 | -// startPage(); | ||
| 19 | -// List<SysNotice> list = noticeService.selectNoticeList(notice); | ||
| 20 | -// return getDataTable(list); | ||
| 21 | -// } | ||
| 22 | -// | ||
| 23 | -// /** | ||
| 24 | -// * 根据通知公告编号获取详细信息 | ||
| 25 | -// */ | 32 | + public CommonResult<PageResult<SysNoticeRespVO>> pageNotices(@Validated SysNoticePageReqVO reqVO) { |
| 33 | + return success(SysNoticeConvert.INSTANCE.convertPage(noticeService.pageNotices(reqVO))); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @ApiOperation("获得通知公告") | ||
| 37 | + @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | ||
| 26 | // @PreAuthorize("@ss.hasPermi('system:notice:query')") | 38 | // @PreAuthorize("@ss.hasPermi('system:notice:query')") |
| 27 | -// @GetMapping(value = "/{noticeId}") | ||
| 28 | -// public AjaxResult getInfo(@PathVariable Long noticeId) { | ||
| 29 | -// return AjaxResult.success(noticeService.selectNoticeById(noticeId)); | ||
| 30 | -// } | ||
| 31 | -// | ||
| 32 | -// /** | ||
| 33 | -// * 新增通知公告 | ||
| 34 | -// */ | 39 | + @GetMapping(value = "/get") |
| 40 | + public CommonResult<SysNoticeRespVO> getNotice(@RequestParam("id") Long id) { | ||
| 41 | + return success(SysNoticeConvert.INSTANCE.convert(noticeService.getNotice(id))); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @ApiOperation("新增通知公告") | ||
| 35 | // @PreAuthorize("@ss.hasPermi('system:notice:add')") | 45 | // @PreAuthorize("@ss.hasPermi('system:notice:add')") |
| 36 | // @Log(title = "通知公告", businessType = BusinessType.INSERT) | 46 | // @Log(title = "通知公告", businessType = BusinessType.INSERT) |
| 37 | -// @PostMapping | ||
| 38 | -// public AjaxResult add(@Validated @RequestBody SysNotice notice) { | ||
| 39 | -// notice.setCreateBy(SecurityUtils.getUsername()); | ||
| 40 | -// return toAjax(noticeService.insertNotice(notice)); | ||
| 41 | -// } | ||
| 42 | -// | ||
| 43 | -// /** | ||
| 44 | -// * 修改通知公告 | ||
| 45 | -// */ | 47 | + @PostMapping("/create") |
| 48 | + public CommonResult<Long> createNotice(@Validated @RequestBody SysNoticeCreateReqVO reqVO) { | ||
| 49 | + Long noticeId = noticeService.createNotice(reqVO); | ||
| 50 | + return success(noticeId); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @ApiOperation("修改通知公告") | ||
| 46 | // @PreAuthorize("@ss.hasPermi('system:notice:edit')") | 54 | // @PreAuthorize("@ss.hasPermi('system:notice:edit')") |
| 47 | // @Log(title = "通知公告", businessType = BusinessType.UPDATE) | 55 | // @Log(title = "通知公告", businessType = BusinessType.UPDATE) |
| 48 | -// @PutMapping | ||
| 49 | -// public AjaxResult edit(@Validated @RequestBody SysNotice notice) { | ||
| 50 | -// notice.setUpdateBy(SecurityUtils.getUsername()); | ||
| 51 | -// return toAjax(noticeService.updateNotice(notice)); | ||
| 52 | -// } | ||
| 53 | -// | ||
| 54 | -// /** | ||
| 55 | -// * 删除通知公告 | ||
| 56 | -// */ | 56 | + @PostMapping("/update") |
| 57 | + public CommonResult<Boolean> updateNotice(@Validated @RequestBody SysNoticeUpdateReqVO reqVO) { | ||
| 58 | + noticeService.updateNotice(reqVO); | ||
| 59 | + return success(true); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @ApiOperation("删除通知公告") | ||
| 63 | + @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | ||
| 57 | // @PreAuthorize("@ss.hasPermi('system:notice:remove')") | 64 | // @PreAuthorize("@ss.hasPermi('system:notice:remove')") |
| 58 | // @Log(title = "通知公告", businessType = BusinessType.DELETE) | 65 | // @Log(title = "通知公告", businessType = BusinessType.DELETE) |
| 59 | -// @DeleteMapping("/{noticeIds}") | ||
| 60 | -// public AjaxResult remove(@PathVariable Long[] noticeIds) { | ||
| 61 | -// return toAjax(noticeService.deleteNoticeByIds(noticeIds)); | ||
| 62 | -// } | 66 | + @PostMapping("/delete") |
| 67 | + public CommonResult<Boolean> deleteNotice(@RequestParam("id") Long id) { | ||
| 68 | + noticeService.deleteNotice(id); | ||
| 69 | + return success(true); | ||
| 70 | + } | ||
| 63 | 71 | ||
| 64 | } | 72 | } |
src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/vo/SysNoticeBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.dashboard.modules.system.controller.notice.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModelProperty; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import javax.validation.constraints.NotBlank; | ||
| 7 | +import javax.validation.constraints.NotNull; | ||
| 8 | +import javax.validation.constraints.Size; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 通知公告 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 12 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 13 | + */ | ||
| 14 | +@Data | ||
| 15 | +public class SysNoticeBaseVO { | ||
| 16 | + | ||
| 17 | + @ApiModelProperty(value = "公告标题", required = true, example = "小博主") | ||
| 18 | + @NotBlank(message = "公告标题不能为空") | ||
| 19 | + @Size(max = 50, message = "公告标题不能超过50个字符") | ||
| 20 | + private String title; | ||
| 21 | + | ||
| 22 | + @ApiModelProperty(value = "公告标题", required = true, example = "小博主") | ||
| 23 | + @NotNull(message = "公告类型不能为空") | ||
| 24 | + private Integer type; | ||
| 25 | + | ||
| 26 | + @ApiModelProperty(value = "公告内容", required = true, example = "半生编码") | ||
| 27 | + private String content; | ||
| 28 | + | ||
| 29 | + @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类") | ||
| 30 | + private Integer status; | ||
| 31 | + | ||
| 32 | +} |
src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/vo/SysNoticeCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.dashboard.modules.system.controller.notice.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.dashboard.modules.system.controller.dept.vo.post.SysPostBaseVO; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.EqualsAndHashCode; | ||
| 7 | + | ||
| 8 | +@ApiModel("通知公告创建 Request VO") | ||
| 9 | +@Data | ||
| 10 | +@EqualsAndHashCode(callSuper = true) | ||
| 11 | +public class SysNoticeCreateReqVO extends SysPostBaseVO { | ||
| 12 | +} |
src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/vo/SysNoticePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.dashboard.modules.system.controller.notice.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.dashboard.common.pojo.PageParam; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import lombok.EqualsAndHashCode; | ||
| 8 | + | ||
| 9 | +@ApiModel("通知公告分页 Request VO") | ||
| 10 | +@Data | ||
| 11 | +@EqualsAndHashCode(callSuper = true) | ||
| 12 | +public class SysNoticePageReqVO extends PageParam { | ||
| 13 | + | ||
| 14 | + @ApiModelProperty(value = "通知公告名称", example = "芋道", notes = "模糊匹配") | ||
| 15 | + private String title; | ||
| 16 | + | ||
| 17 | + @ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类") | ||
| 18 | + private Integer status; | ||
| 19 | + | ||
| 20 | +} |
src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/vo/SysNoticeRespVO.java
0 → 100644
| 1 | +package cn.iocoder.dashboard.modules.system.controller.notice.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.dashboard.modules.system.controller.dept.vo.post.SysPostBaseVO; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import lombok.EqualsAndHashCode; | ||
| 8 | + | ||
| 9 | +import java.util.Date; | ||
| 10 | + | ||
| 11 | +@ApiModel("通知公告信息 Response VO") | ||
| 12 | +@Data | ||
| 13 | +@EqualsAndHashCode(callSuper = true) | ||
| 14 | +public class SysNoticeRespVO extends SysPostBaseVO { | ||
| 15 | + | ||
| 16 | + @ApiModelProperty(value = "通知公告序号", required = true, example = "1024") | ||
| 17 | + private Long id; | ||
| 18 | + | ||
| 19 | + @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") | ||
| 20 | + private Date createTime; | ||
| 21 | + | ||
| 22 | +} |
src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/vo/SysNoticeUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.dashboard.modules.system.controller.notice.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.dashboard.modules.system.controller.dept.vo.post.SysPostBaseVO; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import lombok.EqualsAndHashCode; | ||
| 8 | + | ||
| 9 | +import javax.validation.constraints.NotNull; | ||
| 10 | + | ||
| 11 | +@ApiModel("岗位公告更新 Request VO") | ||
| 12 | +@Data | ||
| 13 | +@EqualsAndHashCode(callSuper = true) | ||
| 14 | +public class SysNoticeUpdateReqVO extends SysPostBaseVO { | ||
| 15 | + | ||
| 16 | + @ApiModelProperty(value = "岗位公告编号", required = true, example = "1024") | ||
| 17 | + @NotNull(message = "岗位公告编号不能为空") | ||
| 18 | + private Long id; | ||
| 19 | + | ||
| 20 | +} |
src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/menu/SysMenuRespVO.java
| @@ -17,7 +17,7 @@ import java.util.Date; | @@ -17,7 +17,7 @@ import java.util.Date; | ||
| 17 | public class SysMenuRespVO extends SysMenuBaseVO { | 17 | public class SysMenuRespVO extends SysMenuBaseVO { |
| 18 | 18 | ||
| 19 | @ApiModelProperty(value = "菜单编号", required = true, example = "1024") | 19 | @ApiModelProperty(value = "菜单编号", required = true, example = "1024") |
| 20 | - private Integer id; | 20 | + private Long id; |
| 21 | 21 | ||
| 22 | @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类") | 22 | @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类") |
| 23 | private Integer status; | 23 | private Integer status; |
src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/menu/SysMenuSimpleRespVO.java
| @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; | @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; | ||
| 13 | public class SysMenuSimpleRespVO { | 13 | public class SysMenuSimpleRespVO { |
| 14 | 14 | ||
| 15 | @ApiModelProperty(value = "菜单编号", required = true, example = "1024") | 15 | @ApiModelProperty(value = "菜单编号", required = true, example = "1024") |
| 16 | - private Integer id; | 16 | + private Long id; |
| 17 | 17 | ||
| 18 | @ApiModelProperty(value = "菜单名称", required = true, example = "芋道") | 18 | @ApiModelProperty(value = "菜单名称", required = true, example = "芋道") |
| 19 | private String name; | 19 | private String name; |
src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleRespVO.java
| @@ -18,7 +18,7 @@ import java.util.Set; | @@ -18,7 +18,7 @@ import java.util.Set; | ||
| 18 | public class SysRoleRespVO extends SysRoleBaseVO { | 18 | public class SysRoleRespVO extends SysRoleBaseVO { |
| 19 | 19 | ||
| 20 | @ApiModelProperty(value = "角色编号", required = true, example = "1") | 20 | @ApiModelProperty(value = "角色编号", required = true, example = "1") |
| 21 | - private Integer id; | 21 | + private Long id; |
| 22 | 22 | ||
| 23 | @ApiModelProperty(value = "数据范围", required = true, example = "1", notes = "参见 DataScopeEnum 枚举类") | 23 | @ApiModelProperty(value = "数据范围", required = true, example = "1", notes = "参见 DataScopeEnum 枚举类") |
| 24 | private Integer dataScope; | 24 | private Integer dataScope; |
src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleSimpleRespVO.java
| @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; | @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; | ||
| 13 | public class SysRoleSimpleRespVO { | 13 | public class SysRoleSimpleRespVO { |
| 14 | 14 | ||
| 15 | @ApiModelProperty(value = "角色编号", required = true, example = "1024") | 15 | @ApiModelProperty(value = "角色编号", required = true, example = "1024") |
| 16 | - private Integer id; | 16 | + private Long id; |
| 17 | 17 | ||
| 18 | @ApiModelProperty(value = "角色名称", required = true, example = "芋道") | 18 | @ApiModelProperty(value = "角色名称", required = true, example = "芋道") |
| 19 | private String name; | 19 | private String name; |
src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserPageItemRespVO.java
| @@ -24,7 +24,7 @@ public class SysUserPageItemRespVO extends SysUserRespVO { | @@ -24,7 +24,7 @@ public class SysUserPageItemRespVO extends SysUserRespVO { | ||
| 24 | public static class Dept { | 24 | public static class Dept { |
| 25 | 25 | ||
| 26 | @ApiModelProperty(value = "部门编号", required = true, example = "1") | 26 | @ApiModelProperty(value = "部门编号", required = true, example = "1") |
| 27 | - private Integer id; | 27 | + private Long id; |
| 28 | 28 | ||
| 29 | @ApiModelProperty(value = "部门名称", required = true, example = "研发部") | 29 | @ApiModelProperty(value = "部门名称", required = true, example = "研发部") |
| 30 | private String name; | 30 | private String name; |
src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserRespVO.java
| @@ -17,7 +17,7 @@ import java.util.Date; | @@ -17,7 +17,7 @@ import java.util.Date; | ||
| 17 | public class SysUserRespVO extends SysUserBaseVO { | 17 | public class SysUserRespVO extends SysUserBaseVO { |
| 18 | 18 | ||
| 19 | @ApiModelProperty(value = "用户编号", required = true, example = "1") | 19 | @ApiModelProperty(value = "用户编号", required = true, example = "1") |
| 20 | - private Integer id; | 20 | + private Long id; |
| 21 | 21 | ||
| 22 | @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类") | 22 | @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类") |
| 23 | private Integer status; | 23 | private Integer status; |
src/main/java/cn/iocoder/dashboard/modules/system/convert/notice/SysNoticeConvert.java
| 1 | package cn.iocoder.dashboard.modules.system.convert.notice; | 1 | package cn.iocoder.dashboard.modules.system.convert.notice; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.dashboard.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeCreateReqVO; | ||
| 5 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeRespVO; | ||
| 6 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeUpdateReqVO; | ||
| 7 | +import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO; | ||
| 8 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
| 3 | import org.mapstruct.Mapper; | 9 | import org.mapstruct.Mapper; |
| 10 | +import org.mapstruct.Mapping; | ||
| 4 | import org.mapstruct.factory.Mappers; | 11 | import org.mapstruct.factory.Mappers; |
| 5 | 12 | ||
| 6 | @Mapper | 13 | @Mapper |
| @@ -8,4 +15,15 @@ public interface SysNoticeConvert { | @@ -8,4 +15,15 @@ public interface SysNoticeConvert { | ||
| 8 | 15 | ||
| 9 | SysNoticeConvert INSTANCE = Mappers.getMapper(SysNoticeConvert.class); | 16 | SysNoticeConvert INSTANCE = Mappers.getMapper(SysNoticeConvert.class); |
| 10 | 17 | ||
| 18 | + PageResult<SysNoticeRespVO> convertPage(PageResult<SysNoticeDO> page); | ||
| 19 | + | ||
| 20 | + SysNoticeRespVO convert(SysNoticeDO bean); | ||
| 21 | + | ||
| 22 | + SysNoticeDO convert(SysNoticeUpdateReqVO bean); | ||
| 23 | + | ||
| 24 | + SysNoticeDO convert(SysNoticeCreateReqVO bean); | ||
| 25 | + | ||
| 26 | + @Mapping(source = "records", target = "list") | ||
| 27 | + PageResult<SysNoticeDO> convertPage02(IPage<SysNoticeDO> page); | ||
| 28 | + | ||
| 11 | } | 29 | } |
src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/notice/SysNoticeMapper.java
| 1 | package cn.iocoder.dashboard.modules.system.dal.mysql.dao.notice; | 1 | package cn.iocoder.dashboard.modules.system.dal.mysql.dao.notice; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; | ||
| 4 | +import cn.iocoder.dashboard.framework.mybatis.core.util.MyBatisUtils; | ||
| 5 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticePageReqVO; | ||
| 3 | import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO; | 6 | import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO; |
| 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| 8 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
| 5 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 6 | 10 | ||
| 7 | @Mapper | 11 | @Mapper |
| 8 | public interface SysNoticeMapper extends BaseMapper<SysNoticeDO> { | 12 | public interface SysNoticeMapper extends BaseMapper<SysNoticeDO> { |
| 13 | + | ||
| 14 | + default IPage<SysNoticeDO> selectList(SysNoticePageReqVO reqVO) { | ||
| 15 | + return selectPage(MyBatisUtils.buildPage(reqVO), | ||
| 16 | + new QueryWrapperX<SysNoticeDO>().likeIfPresent("title", reqVO.getTitle()) | ||
| 17 | + .eqIfPresent("status", reqVO.getStatus())); | ||
| 18 | + } | ||
| 19 | + | ||
| 9 | } | 20 | } |
src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dataobject/notice/SysNoticeDO.java
| @@ -8,9 +8,6 @@ import com.baomidou.mybatisplus.annotation.TableName; | @@ -8,9 +8,6 @@ import com.baomidou.mybatisplus.annotation.TableName; | ||
| 8 | import lombok.Data; | 8 | import lombok.Data; |
| 9 | import lombok.EqualsAndHashCode; | 9 | import lombok.EqualsAndHashCode; |
| 10 | 10 | ||
| 11 | -import javax.validation.constraints.NotBlank; | ||
| 12 | -import javax.validation.constraints.Size; | ||
| 13 | - | ||
| 14 | /** | 11 | /** |
| 15 | * 通知公告表 | 12 | * 通知公告表 |
| 16 | * | 13 | * |
| @@ -28,8 +25,7 @@ public class SysNoticeDO extends BaseDO { | @@ -28,8 +25,7 @@ public class SysNoticeDO extends BaseDO { | ||
| 28 | /** | 25 | /** |
| 29 | * 公告标题 | 26 | * 公告标题 |
| 30 | */ | 27 | */ |
| 31 | - @NotBlank(message = "公告标题不能为空") | ||
| 32 | - @Size(max = 50, message = "公告标题不能超过50个字符") | 28 | + |
| 33 | private String title; | 29 | private String title; |
| 34 | /** | 30 | /** |
| 35 | * 公告类型 | 31 | * 公告类型 |
| @@ -37,7 +33,7 @@ public class SysNoticeDO extends BaseDO { | @@ -37,7 +33,7 @@ public class SysNoticeDO extends BaseDO { | ||
| 37 | * 枚举 {@link SysNoticeTypeEnum} | 33 | * 枚举 {@link SysNoticeTypeEnum} |
| 38 | */ | 34 | */ |
| 39 | @TableField("notice_type") | 35 | @TableField("notice_type") |
| 40 | - private String type; | 36 | + private Integer type; |
| 41 | /** | 37 | /** |
| 42 | * 公告内容 | 38 | * 公告内容 |
| 43 | */ | 39 | */ |
src/main/java/cn/iocoder/dashboard/modules/system/enums/SysErrorCodeConstants.java
| @@ -66,4 +66,7 @@ public interface SysErrorCodeConstants { | @@ -66,4 +66,7 @@ public interface SysErrorCodeConstants { | ||
| 66 | ErrorCode DICT_DATA_NOT_ENABLE = new ErrorCode(1002007002, "字典数据不处于开启状态,不允许选择"); | 66 | ErrorCode DICT_DATA_NOT_ENABLE = new ErrorCode(1002007002, "字典数据不处于开启状态,不允许选择"); |
| 67 | ErrorCode DICT_DATA_VALUE_DUPLICATE = new ErrorCode(1002007003, "已经存在该值的字典数据"); | 67 | ErrorCode DICT_DATA_VALUE_DUPLICATE = new ErrorCode(1002007003, "已经存在该值的字典数据"); |
| 68 | 68 | ||
| 69 | + // ========== 通知公告 1002008000 ========== | ||
| 70 | + ErrorCode NOTICE_NOT_FOUND = new ErrorCode(1002008001, "当前通知公告不存在"); | ||
| 71 | + | ||
| 69 | } | 72 | } |
src/main/java/cn/iocoder/dashboard/modules/system/service/notice/SysNoticeService.java
0 → 100644
| 1 | +package cn.iocoder.dashboard.modules.system.service.notice; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.dashboard.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeCreateReqVO; | ||
| 5 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticePageReqVO; | ||
| 6 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeUpdateReqVO; | ||
| 7 | +import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 通知公告 Service 接口 | ||
| 11 | + */ | ||
| 12 | +public interface SysNoticeService { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 获得岗位公告公告分页列表 | ||
| 16 | + * | ||
| 17 | + * @param reqVO 分页条件 | ||
| 18 | + * @return 部门分页列表 | ||
| 19 | + */ | ||
| 20 | + PageResult<SysNoticeDO> pageNotices(SysNoticePageReqVO reqVO); | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 获得岗位公告公告信息 | ||
| 24 | + * | ||
| 25 | + * @param id 岗位公告公告编号 | ||
| 26 | + * @return 岗位公告公告信息 | ||
| 27 | + */ | ||
| 28 | + SysNoticeDO getNotice(Long id); | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 创建岗位公告公告 | ||
| 32 | + * | ||
| 33 | + * @param reqVO 岗位公告公告信息 | ||
| 34 | + * @return 岗位公告公告编号 | ||
| 35 | + */ | ||
| 36 | + Long createNotice(SysNoticeCreateReqVO reqVO); | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 更新岗位公告公告 | ||
| 40 | + * | ||
| 41 | + * @param reqVO 岗位公告公告信息 | ||
| 42 | + */ | ||
| 43 | + void updateNotice(SysNoticeUpdateReqVO reqVO); | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 删除岗位公告公告信息 | ||
| 47 | + * | ||
| 48 | + * @param id 岗位公告公告编号 | ||
| 49 | + */ | ||
| 50 | + void deleteNotice(Long id); | ||
| 51 | +} |
src/main/java/cn/iocoder/dashboard/modules/system/service/notice/impl/SysNoticeServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.dashboard.modules.system.service.notice.impl; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil; | ||
| 4 | +import cn.iocoder.dashboard.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeCreateReqVO; | ||
| 6 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticePageReqVO; | ||
| 7 | +import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeUpdateReqVO; | ||
| 8 | +import cn.iocoder.dashboard.modules.system.convert.dept.SysPostConvert; | ||
| 9 | +import cn.iocoder.dashboard.modules.system.convert.notice.SysNoticeConvert; | ||
| 10 | +import cn.iocoder.dashboard.modules.system.dal.mysql.dao.notice.SysNoticeMapper; | ||
| 11 | +import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO; | ||
| 12 | +import cn.iocoder.dashboard.modules.system.service.notice.SysNoticeService; | ||
| 13 | +import org.springframework.stereotype.Service; | ||
| 14 | + | ||
| 15 | +import javax.annotation.Resource; | ||
| 16 | + | ||
| 17 | +import static cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants.NOTICE_NOT_FOUND; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * 通知公告 Service 实现类 | ||
| 21 | + * | ||
| 22 | + * @author 芋道源码 | ||
| 23 | + */ | ||
| 24 | +@Service | ||
| 25 | +public class SysNoticeServiceImpl implements SysNoticeService { | ||
| 26 | + | ||
| 27 | + @Resource | ||
| 28 | + private SysNoticeMapper noticeMapper; | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public PageResult<SysNoticeDO> pageNotices(SysNoticePageReqVO reqVO) { | ||
| 32 | + return SysNoticeConvert.INSTANCE.convertPage02(noticeMapper.selectList(reqVO)); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public SysNoticeDO getNotice(Long id) { | ||
| 37 | + return noticeMapper.selectById(id); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public Long createNotice(SysNoticeCreateReqVO reqVO) { | ||
| 42 | + SysNoticeDO notice = SysNoticeConvert.INSTANCE.convert(reqVO); | ||
| 43 | + return notice.getId(); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @Override | ||
| 47 | + public void updateNotice(SysNoticeUpdateReqVO reqVO) { | ||
| 48 | + // 校验是否存在 | ||
| 49 | + this.checkNoticeExists(reqVO.getId()); | ||
| 50 | + // 更新通知公告 | ||
| 51 | + SysNoticeDO updateObj = SysNoticeConvert.INSTANCE.convert(reqVO); | ||
| 52 | + noticeMapper.updateById(updateObj); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @Override | ||
| 56 | + public void deleteNotice(Long id) { | ||
| 57 | + // 校验是否存在 | ||
| 58 | + this.checkNoticeExists(id); | ||
| 59 | + // 删除通知公告 | ||
| 60 | + noticeMapper.deleteById(id); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + private void checkNoticeExists(Long id) { | ||
| 64 | + if (id == null) { | ||
| 65 | + return; | ||
| 66 | + } | ||
| 67 | + SysNoticeDO notice = noticeMapper.selectById(id); | ||
| 68 | + if (notice == null) { | ||
| 69 | + throw ServiceExceptionUtil.exception(NOTICE_NOT_FOUND); | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | +} |