mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 02:25:56 +08:00
update 更新 system 相关表接口 (sys_notice, sys_post) 新增 Bo | Vo 类, 更改请求以及响应参数 ;
fix 修正 Vo (SysConfigVo, SysDeptVo) 没有返回创建时间 ;
This commit is contained in:
parent
88dca47792
commit
cf42c0253f
@ -7,7 +7,8 @@ import com.ruoyi.common.mybatis.core.page.PageQuery;
|
|||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.bo.SysNoticeBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysNoticeVo;
|
||||||
import com.ruoyi.system.service.ISysNoticeService;
|
import com.ruoyi.system.service.ISysNoticeService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -31,8 +32,8 @@ public class SysNoticeController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:notice:list")
|
@SaCheckPermission("system:notice:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<SysNotice> list(SysNotice notice, PageQuery pageQuery) {
|
public TableDataInfo<SysNoticeVo> list(SysNoticeBo bo, PageQuery pageQuery) {
|
||||||
return noticeService.selectPageNoticeList(notice, pageQuery);
|
return noticeService.selectPageNoticeList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,7 +43,7 @@ public class SysNoticeController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:notice:query")
|
@SaCheckPermission("system:notice:query")
|
||||||
@GetMapping(value = "/{noticeId}")
|
@GetMapping(value = "/{noticeId}")
|
||||||
public R<SysNotice> getInfo(@PathVariable Long noticeId) {
|
public R<SysNoticeVo> getInfo(@PathVariable Long noticeId) {
|
||||||
return R.ok(noticeService.selectNoticeById(noticeId));
|
return R.ok(noticeService.selectNoticeById(noticeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,8 +53,8 @@ public class SysNoticeController extends BaseController {
|
|||||||
@SaCheckPermission("system:notice:add")
|
@SaCheckPermission("system:notice:add")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysNotice notice) {
|
public R<Void> add(@Validated @RequestBody SysNoticeBo bo) {
|
||||||
return toAjax(noticeService.insertNotice(notice));
|
return toAjax(noticeService.insertNotice(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,8 +63,8 @@ public class SysNoticeController extends BaseController {
|
|||||||
@SaCheckPermission("system:notice:edit")
|
@SaCheckPermission("system:notice:edit")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysNotice notice) {
|
public R<Void> edit(@Validated @RequestBody SysNoticeBo bo) {
|
||||||
return toAjax(noticeService.updateNotice(notice));
|
return toAjax(noticeService.updateNotice(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -9,7 +9,8 @@ import com.ruoyi.common.core.domain.R;
|
|||||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
import com.ruoyi.common.excel.utils.ExcelUtil;
|
import com.ruoyi.common.excel.utils.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.bo.SysPostBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysPostVo;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -36,8 +37,8 @@ public class SysPostController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:post:list")
|
@SaCheckPermission("system:post:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<SysPost> list(SysPost post, PageQuery pageQuery) {
|
public TableDataInfo<SysPostVo> list(SysPostBo bo, PageQuery pageQuery) {
|
||||||
return postService.selectPagePostList(post, pageQuery);
|
return postService.selectPagePostList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,9 +47,9 @@ public class SysPostController extends BaseController {
|
|||||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||||
@SaCheckPermission("system:post:export")
|
@SaCheckPermission("system:post:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(SysPost post, HttpServletResponse response) {
|
public void export(SysPostBo bo, HttpServletResponse response) {
|
||||||
List<SysPost> list = postService.selectPostList(post);
|
List<SysPostVo> list = postService.selectPostList(bo);
|
||||||
ExcelUtil.exportExcel(list, "岗位数据", SysPost.class, response);
|
ExcelUtil.exportExcel(list, "岗位数据", SysPostVo.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,7 +59,7 @@ public class SysPostController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:post:query")
|
@SaCheckPermission("system:post:query")
|
||||||
@GetMapping(value = "/{postId}")
|
@GetMapping(value = "/{postId}")
|
||||||
public R<SysPost> getInfo(@PathVariable Long postId) {
|
public R<SysPostVo> getInfo(@PathVariable Long postId) {
|
||||||
return R.ok(postService.selectPostById(postId));
|
return R.ok(postService.selectPostById(postId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,13 +69,13 @@ public class SysPostController extends BaseController {
|
|||||||
@SaCheckPermission("system:post:add")
|
@SaCheckPermission("system:post:add")
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysPost post) {
|
public R<Void> add(@Validated @RequestBody SysPostBo bo) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
|
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(bo))) {
|
||||||
return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return R.fail("新增岗位'" + bo.getPostName() + "'失败,岗位名称已存在");
|
||||||
} else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
|
} else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(bo))) {
|
||||||
return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return R.fail("新增岗位'" + bo.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
return toAjax(postService.insertPost(post));
|
return toAjax(postService.insertPost(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -83,13 +84,13 @@ public class SysPostController extends BaseController {
|
|||||||
@SaCheckPermission("system:post:edit")
|
@SaCheckPermission("system:post:edit")
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysPost post) {
|
public R<Void> edit(@Validated @RequestBody SysPostBo bo) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
|
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(bo))) {
|
||||||
return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return R.fail("修改岗位'" + bo.getPostName() + "'失败,岗位名称已存在");
|
||||||
} else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
|
} else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(bo))) {
|
||||||
return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return R.fail("修改岗位'" + bo.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
return toAjax(postService.updatePost(post));
|
return toAjax(postService.updatePost(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,8 +109,8 @@ public class SysPostController extends BaseController {
|
|||||||
* 获取岗位选择框列表
|
* 获取岗位选择框列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/optionselect")
|
@GetMapping("/optionselect")
|
||||||
public R<List<SysPost>> optionselect() {
|
public R<List<SysPostVo>> optionselect() {
|
||||||
List<SysPost> posts = postService.selectPostAll();
|
List<SysPostVo> posts = postService.selectPostAll();
|
||||||
return R.ok(posts);
|
return R.ok(posts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,13 +3,9 @@ package com.ruoyi.system.domain;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.ruoyi.common.mybatis.core.domain.BaseEntity;
|
import com.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||||
import com.ruoyi.common.core.xss.Xss;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import jakarta.validation.constraints.Size;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告表 sys_notice
|
* 通知公告表 sys_notice
|
||||||
@ -30,9 +26,6 @@ public class SysNotice extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 公告标题
|
* 公告标题
|
||||||
*/
|
*/
|
||||||
@Xss(message = "公告标题不能包含脚本字符")
|
|
||||||
@NotBlank(message = "公告标题不能为空")
|
|
||||||
@Size(min = 0, max = 50, message = "公告标题不能超过{max}个字符")
|
|
||||||
private String noticeTitle;
|
private String noticeTitle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -24,44 +24,32 @@ import jakarta.validation.constraints.Size;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("sys_post")
|
@TableName("sys_post")
|
||||||
@ExcelIgnoreUnannotated
|
|
||||||
public class SysPost extends BaseEntity {
|
public class SysPost extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位序号
|
* 岗位序号
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "岗位序号")
|
|
||||||
@TableId(value = "post_id")
|
@TableId(value = "post_id")
|
||||||
private Long postId;
|
private Long postId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位编码
|
* 岗位编码
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "岗位编码")
|
|
||||||
@NotBlank(message = "岗位编码不能为空")
|
|
||||||
@Size(min = 0, max = 64, message = "岗位编码长度不能超过{max}个字符")
|
|
||||||
private String postCode;
|
private String postCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位名称
|
* 岗位名称
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "岗位名称")
|
|
||||||
@NotBlank(message = "岗位名称不能为空")
|
|
||||||
@Size(min = 0, max = 50, message = "岗位名称长度不能超过{max}个字符")
|
|
||||||
private String postName;
|
private String postName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位排序
|
* 岗位排序
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "岗位排序")
|
|
||||||
@NotNull(message = "显示顺序不能为空")
|
|
||||||
private Integer postSort;
|
private Integer postSort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0正常 1停用)
|
* 状态(0正常 1停用)
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
|
||||||
@ExcelDictFormat(dictType = "sys_normal_disable")
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -0,0 +1,60 @@
|
|||||||
|
package com.ruoyi.system.domain.bo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import com.ruoyi.common.core.xss.Xss;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知公告业务对象 sys_notice
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-01
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class SysNoticeBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "公告ID不能为空", groups = { EditGroup.class })
|
||||||
|
private Long noticeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告标题
|
||||||
|
*/
|
||||||
|
@Xss(message = "公告标题不能包含脚本字符")
|
||||||
|
@NotBlank(message = "公告标题不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
@Size(min = 0, max = 50, message = "公告标题不能超过{max}个字符")
|
||||||
|
private String noticeTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告类型(1通知 2公告)
|
||||||
|
*/
|
||||||
|
private String noticeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告内容
|
||||||
|
*/
|
||||||
|
private String noticeContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告状态(0正常 1关闭)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.ruoyi.system.domain.bo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位信息业务对象 sys_post
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-01
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class SysPostBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "岗位ID不能为空", groups = { EditGroup.class })
|
||||||
|
private Long postId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位编码
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "岗位编码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
@Size(min = 0, max = 64, message = "岗位编码长度不能超过{max}个字符")
|
||||||
|
private String postCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "岗位名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
@Size(min = 0, max = 50, message = "岗位名称长度不能超过{max}个字符")
|
||||||
|
private String postName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示顺序
|
||||||
|
*/
|
||||||
|
@NotNull(message = "显示顺序不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Integer postSort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -8,6 +8,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,5 +61,10 @@ public class SysConfigVo implements Serializable {
|
|||||||
@ExcelProperty(value = "备注")
|
@ExcelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门视图对象 sys_dept
|
* 部门视图对象 sys_dept
|
||||||
@ -79,5 +80,10 @@ public class SysDeptVo implements Serializable {
|
|||||||
@ExcelDictFormat(dictType = "sys_normal_disable")
|
@ExcelDictFormat(dictType = "sys_normal_disable")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,6 +87,7 @@ public class SysDictDataVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "创建时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,6 +58,7 @@ public class SysDictTypeVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "创建时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,70 @@
|
|||||||
|
package com.ruoyi.system.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.ruoyi.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import com.ruoyi.common.excel.convert.ExcelDictConvert;
|
||||||
|
import com.ruoyi.common.translation.annotation.Translation;
|
||||||
|
import com.ruoyi.common.translation.constant.TransConstant;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知公告视图对象 sys_notice
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysNoticeVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告ID
|
||||||
|
*/
|
||||||
|
private Long noticeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告标题
|
||||||
|
*/
|
||||||
|
private String noticeTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告类型(1通知 2公告)
|
||||||
|
*/
|
||||||
|
private String noticeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告内容
|
||||||
|
*/
|
||||||
|
private String noticeContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告状态(0正常 1关闭)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建者
|
||||||
|
*/
|
||||||
|
@Translation(type = TransConstant.USER_ID_TO_NAME)
|
||||||
|
private Long createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
package com.ruoyi.system.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.ruoyi.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import com.ruoyi.common.excel.convert.ExcelDictConvert;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位信息视图对象 sys_post
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class SysPostVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "岗位序号")
|
||||||
|
private Long postId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位编码
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "岗位编码")
|
||||||
|
private String postCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "岗位名称")
|
||||||
|
private String postName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示顺序
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "岗位排序")
|
||||||
|
private Integer postSort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(dictType = "sys_normal_disable")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -2,12 +2,13 @@ package com.ruoyi.system.mapper;
|
|||||||
|
|
||||||
import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
|
import com.ruoyi.system.domain.vo.SysNoticeVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告表 数据层
|
* 通知公告表 数据层
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
public interface SysNoticeMapper extends BaseMapperPlus<SysNoticeMapper, SysNotice, SysNotice> {
|
public interface SysNoticeMapper extends BaseMapperPlus<SysNoticeMapper, SysNotice, SysNoticeVo> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
|
|||||||
|
|
||||||
import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
|
import com.ruoyi.system.domain.vo.SysPostVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
public interface SysPostMapper extends BaseMapperPlus<SysPostMapper, SysPost, SysPost> {
|
public interface SysPostMapper extends BaseMapperPlus<SysPostMapper, SysPost, SysPostVo> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID获取岗位选择框列表
|
* 根据用户ID获取岗位选择框列表
|
||||||
@ -26,6 +27,6 @@ public interface SysPostMapper extends BaseMapperPlus<SysPostMapper, SysPost, Sy
|
|||||||
* @param userName 用户名
|
* @param userName 用户名
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
List<SysPost> selectPostsByUserName(String userName);
|
List<SysPostVo> selectPostsByUserName(String userName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,8 @@ package com.ruoyi.system.service;
|
|||||||
|
|
||||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.bo.SysNoticeBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysNoticeVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ import java.util.List;
|
|||||||
public interface ISysNoticeService {
|
public interface ISysNoticeService {
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo<SysNotice> selectPageNoticeList(SysNotice notice, PageQuery pageQuery);
|
TableDataInfo<SysNoticeVo> selectPageNoticeList(SysNoticeBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询公告信息
|
* 查询公告信息
|
||||||
@ -22,31 +23,31 @@ public interface ISysNoticeService {
|
|||||||
* @param noticeId 公告ID
|
* @param noticeId 公告ID
|
||||||
* @return 公告信息
|
* @return 公告信息
|
||||||
*/
|
*/
|
||||||
SysNotice selectNoticeById(Long noticeId);
|
SysNoticeVo selectNoticeById(Long noticeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询公告列表
|
* 查询公告列表
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param bo 公告信息
|
||||||
* @return 公告集合
|
* @return 公告集合
|
||||||
*/
|
*/
|
||||||
List<SysNotice> selectNoticeList(SysNotice notice);
|
List<SysNoticeVo> selectNoticeList(SysNoticeBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增公告
|
* 新增公告
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param bo 公告信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int insertNotice(SysNotice notice);
|
int insertNotice(SysNoticeBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改公告
|
* 修改公告
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param bo 公告信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int updateNotice(SysNotice notice);
|
int updateNotice(SysNoticeBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除公告信息
|
* 删除公告信息
|
||||||
|
|||||||
@ -2,7 +2,8 @@ package com.ruoyi.system.service;
|
|||||||
|
|
||||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.bo.SysPostBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysPostVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -14,22 +15,22 @@ import java.util.List;
|
|||||||
public interface ISysPostService {
|
public interface ISysPostService {
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo<SysPost> selectPagePostList(SysPost post, PageQuery pageQuery);
|
TableDataInfo<SysPostVo> selectPagePostList(SysPostBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询岗位信息集合
|
* 查询岗位信息集合
|
||||||
*
|
*
|
||||||
* @param post 岗位信息
|
* @param bo 岗位信息
|
||||||
* @return 岗位列表
|
* @return 岗位列表
|
||||||
*/
|
*/
|
||||||
List<SysPost> selectPostList(SysPost post);
|
List<SysPostVo> selectPostList(SysPostBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有岗位
|
* 查询所有岗位
|
||||||
*
|
*
|
||||||
* @return 岗位列表
|
* @return 岗位列表
|
||||||
*/
|
*/
|
||||||
List<SysPost> selectPostAll();
|
List<SysPostVo> selectPostAll();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过岗位ID查询岗位信息
|
* 通过岗位ID查询岗位信息
|
||||||
@ -37,7 +38,7 @@ public interface ISysPostService {
|
|||||||
* @param postId 岗位ID
|
* @param postId 岗位ID
|
||||||
* @return 角色对象信息
|
* @return 角色对象信息
|
||||||
*/
|
*/
|
||||||
SysPost selectPostById(Long postId);
|
SysPostVo selectPostById(Long postId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID获取岗位选择框列表
|
* 根据用户ID获取岗位选择框列表
|
||||||
@ -50,18 +51,18 @@ public interface ISysPostService {
|
|||||||
/**
|
/**
|
||||||
* 校验岗位名称
|
* 校验岗位名称
|
||||||
*
|
*
|
||||||
* @param post 岗位信息
|
* @param bo 岗位信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
String checkPostNameUnique(SysPost post);
|
String checkPostNameUnique(SysPostBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验岗位编码
|
* 校验岗位编码
|
||||||
*
|
*
|
||||||
* @param post 岗位信息
|
* @param bo 岗位信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
String checkPostCodeUnique(SysPost post);
|
String checkPostCodeUnique(SysPostBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过岗位ID查询岗位使用数量
|
* 通过岗位ID查询岗位使用数量
|
||||||
@ -90,16 +91,16 @@ public interface ISysPostService {
|
|||||||
/**
|
/**
|
||||||
* 新增保存岗位信息
|
* 新增保存岗位信息
|
||||||
*
|
*
|
||||||
* @param post 岗位信息
|
* @param bo 岗位信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int insertPost(SysPost post);
|
int insertPost(SysPostBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存岗位信息
|
* 修改保存岗位信息
|
||||||
*
|
*
|
||||||
* @param post 岗位信息
|
* @param bo 岗位信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int updatePost(SysPost post);
|
int updatePost(SysPostBo bo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,16 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
|
import com.ruoyi.system.domain.bo.SysNoticeBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysNoticeVo;
|
||||||
import com.ruoyi.system.mapper.SysNoticeMapper;
|
import com.ruoyi.system.mapper.SysNoticeMapper;
|
||||||
import com.ruoyi.system.service.ISysNoticeService;
|
import com.ruoyi.system.service.ISysNoticeService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -27,12 +31,9 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
|||||||
private final SysNoticeMapper baseMapper;
|
private final SysNoticeMapper baseMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysNotice> selectPageNoticeList(SysNotice notice, PageQuery pageQuery) {
|
public TableDataInfo<SysNoticeVo> selectPageNoticeList(SysNoticeBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysNotice> lqw = new LambdaQueryWrapper<SysNotice>()
|
LambdaQueryWrapper<SysNotice> lqw = buildQueryWrapper(bo);
|
||||||
.like(StringUtils.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle())
|
Page<SysNoticeVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
.eq(StringUtils.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType())
|
|
||||||
.like(ObjectUtil.isNotNull(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy());
|
|
||||||
Page<SysNotice> page = baseMapper.selectPage(pageQuery.build(), lqw);
|
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,43 +44,51 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
|||||||
* @return 公告信息
|
* @return 公告信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysNotice selectNoticeById(Long noticeId) {
|
public SysNoticeVo selectNoticeById(Long noticeId) {
|
||||||
return baseMapper.selectById(noticeId);
|
return baseMapper.selectVoById(noticeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询公告列表
|
* 查询公告列表
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param bo 公告信息
|
||||||
* @return 公告集合
|
* @return 公告集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysNotice> selectNoticeList(SysNotice notice) {
|
public List<SysNoticeVo> selectNoticeList(SysNoticeBo bo) {
|
||||||
return baseMapper.selectList(new LambdaQueryWrapper<SysNotice>()
|
LambdaQueryWrapper<SysNotice> lqw = buildQueryWrapper(bo);
|
||||||
.like(StringUtils.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle())
|
return baseMapper.selectVoList(lqw);
|
||||||
.eq(StringUtils.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType())
|
}
|
||||||
.like(ObjectUtil.isNotNull(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy()));
|
|
||||||
|
private LambdaQueryWrapper<SysNotice> buildQueryWrapper(SysNoticeBo bo) {
|
||||||
|
LambdaQueryWrapper<SysNotice> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getNoticeTitle()), SysNotice::getNoticeTitle, bo.getNoticeTitle());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getNoticeType()), SysNotice::getNoticeType, bo.getNoticeType());
|
||||||
|
lqw.eq(ObjectUtil.isNotNull(bo.getCreateBy()), SysNotice::getCreateBy, bo.getCreateBy());
|
||||||
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增公告
|
* 新增公告
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param bo 公告信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertNotice(SysNotice notice) {
|
public int insertNotice(SysNoticeBo bo) {
|
||||||
|
SysNotice notice = BeanUtil.toBean(bo, SysNotice.class);
|
||||||
return baseMapper.insert(notice);
|
return baseMapper.insert(notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改公告
|
* 修改公告
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param bo 公告信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateNotice(SysNotice notice) {
|
public int updateNotice(SysNoticeBo bo) {
|
||||||
|
SysNotice notice = BeanUtil.toBean(bo, SysNotice.class);
|
||||||
return baseMapper.updateById(notice);
|
return baseMapper.updateById(notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.core.constant.UserConstants;
|
import com.ruoyi.common.core.constant.UserConstants;
|
||||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||||
@ -10,6 +13,8 @@ import com.ruoyi.common.core.exception.ServiceException;
|
|||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
import com.ruoyi.system.domain.SysUserPost;
|
import com.ruoyi.system.domain.SysUserPost;
|
||||||
|
import com.ruoyi.system.domain.bo.SysPostBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysPostVo;
|
||||||
import com.ruoyi.system.mapper.SysPostMapper;
|
import com.ruoyi.system.mapper.SysPostMapper;
|
||||||
import com.ruoyi.system.mapper.SysUserPostMapper;
|
import com.ruoyi.system.mapper.SysUserPostMapper;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
@ -32,27 +37,31 @@ public class SysPostServiceImpl implements ISysPostService {
|
|||||||
private final SysUserPostMapper userPostMapper;
|
private final SysUserPostMapper userPostMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysPost> selectPagePostList(SysPost post, PageQuery pageQuery) {
|
public TableDataInfo<SysPostVo> selectPagePostList(SysPostBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysPost> lqw = new LambdaQueryWrapper<SysPost>()
|
LambdaQueryWrapper<SysPost> lqw = buildQueryWrapper(bo);
|
||||||
.like(StringUtils.isNotBlank(post.getPostCode()), SysPost::getPostCode, post.getPostCode())
|
Page<SysPostVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
.eq(StringUtils.isNotBlank(post.getStatus()), SysPost::getStatus, post.getStatus())
|
|
||||||
.like(StringUtils.isNotBlank(post.getPostName()), SysPost::getPostName, post.getPostName());
|
|
||||||
Page<SysPost> page = baseMapper.selectPage(pageQuery.build(), lqw);
|
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询岗位信息集合
|
* 查询岗位信息集合
|
||||||
*
|
*
|
||||||
* @param post 岗位信息
|
* @param bo 岗位信息
|
||||||
* @return 岗位信息集合
|
* @return 岗位信息集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysPost> selectPostList(SysPost post) {
|
public List<SysPostVo> selectPostList(SysPostBo bo) {
|
||||||
return baseMapper.selectList(new LambdaQueryWrapper<SysPost>()
|
LambdaQueryWrapper<SysPost> lqw = buildQueryWrapper(bo);
|
||||||
.like(StringUtils.isNotBlank(post.getPostCode()), SysPost::getPostCode, post.getPostCode())
|
return baseMapper.selectVoList(lqw);
|
||||||
.eq(StringUtils.isNotBlank(post.getStatus()), SysPost::getStatus, post.getStatus())
|
}
|
||||||
.like(StringUtils.isNotBlank(post.getPostName()), SysPost::getPostName, post.getPostName()));
|
|
||||||
|
private LambdaQueryWrapper<SysPost> buildQueryWrapper(SysPostBo bo) {
|
||||||
|
LambdaQueryWrapper<SysPost> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getPostCode()), SysPost::getPostCode, bo.getPostCode());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getPostName()), SysPost::getPostName, bo.getPostName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysPost::getStatus, bo.getStatus());
|
||||||
|
lqw.orderByAsc(SysPost::getPostSort);
|
||||||
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,8 +70,8 @@ public class SysPostServiceImpl implements ISysPostService {
|
|||||||
* @return 岗位列表
|
* @return 岗位列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysPost> selectPostAll() {
|
public List<SysPostVo> selectPostAll() {
|
||||||
return baseMapper.selectList();
|
return baseMapper.selectVoList(new QueryWrapper<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,8 +81,8 @@ public class SysPostServiceImpl implements ISysPostService {
|
|||||||
* @return 角色对象信息
|
* @return 角色对象信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysPost selectPostById(Long postId) {
|
public SysPostVo selectPostById(Long postId) {
|
||||||
return baseMapper.selectById(postId);
|
return baseMapper.selectVoById(postId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,14 +99,14 @@ public class SysPostServiceImpl implements ISysPostService {
|
|||||||
/**
|
/**
|
||||||
* 校验岗位名称是否唯一
|
* 校验岗位名称是否唯一
|
||||||
*
|
*
|
||||||
* @param post 岗位信息
|
* @param bo 岗位信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkPostNameUnique(SysPost post) {
|
public String checkPostNameUnique(SysPostBo bo) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysPost>()
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysPost>()
|
||||||
.eq(SysPost::getPostName, post.getPostName())
|
.eq(SysPost::getPostName, bo.getPostName())
|
||||||
.ne(ObjectUtil.isNotNull(post.getPostId()), SysPost::getPostId, post.getPostId()));
|
.ne(ObjectUtil.isNotNull(bo.getPostId()), SysPost::getPostId, bo.getPostId()));
|
||||||
if (exist) {
|
if (exist) {
|
||||||
return UserConstants.NOT_UNIQUE;
|
return UserConstants.NOT_UNIQUE;
|
||||||
}
|
}
|
||||||
@ -107,14 +116,14 @@ public class SysPostServiceImpl implements ISysPostService {
|
|||||||
/**
|
/**
|
||||||
* 校验岗位编码是否唯一
|
* 校验岗位编码是否唯一
|
||||||
*
|
*
|
||||||
* @param post 岗位信息
|
* @param bo 岗位信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkPostCodeUnique(SysPost post) {
|
public String checkPostCodeUnique(SysPostBo bo) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysPost>()
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysPost>()
|
||||||
.eq(SysPost::getPostCode, post.getPostCode())
|
.eq(SysPost::getPostCode, bo.getPostCode())
|
||||||
.ne(ObjectUtil.isNotNull(post.getPostId()), SysPost::getPostId, post.getPostId()));
|
.ne(ObjectUtil.isNotNull(bo.getPostId()), SysPost::getPostId, bo.getPostId()));
|
||||||
if (exist) {
|
if (exist) {
|
||||||
return UserConstants.NOT_UNIQUE;
|
return UserConstants.NOT_UNIQUE;
|
||||||
}
|
}
|
||||||
@ -152,7 +161,7 @@ public class SysPostServiceImpl implements ISysPostService {
|
|||||||
@Override
|
@Override
|
||||||
public int deletePostByIds(Long[] postIds) {
|
public int deletePostByIds(Long[] postIds) {
|
||||||
for (Long postId : postIds) {
|
for (Long postId : postIds) {
|
||||||
SysPost post = selectPostById(postId);
|
SysPost post = baseMapper.selectById(postId);
|
||||||
if (countUserPostById(postId) > 0) {
|
if (countUserPostById(postId) > 0) {
|
||||||
throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName()));
|
throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName()));
|
||||||
}
|
}
|
||||||
@ -163,22 +172,24 @@ public class SysPostServiceImpl implements ISysPostService {
|
|||||||
/**
|
/**
|
||||||
* 新增保存岗位信息
|
* 新增保存岗位信息
|
||||||
*
|
*
|
||||||
* @param post 岗位信息
|
* @param bo 岗位信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertPost(SysPost post) {
|
public int insertPost(SysPostBo bo) {
|
||||||
|
SysPost post = BeanUtil.toBean(bo, SysPost.class);
|
||||||
return baseMapper.insert(post);
|
return baseMapper.insert(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存岗位信息
|
* 修改保存岗位信息
|
||||||
*
|
*
|
||||||
* @param post 岗位信息
|
* @param bo 岗位信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updatePost(SysPost post) {
|
public int updatePost(SysPostBo bo) {
|
||||||
|
SysPost post = BeanUtil.toBean(bo, SysPost.class);
|
||||||
return baseMapper.updateById(post);
|
return baseMapper.updateById(post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
|||||||
import com.ruoyi.common.mybatis.helper.DataBaseHelper;
|
import com.ruoyi.common.mybatis.helper.DataBaseHelper;
|
||||||
import com.ruoyi.common.satoken.utils.LoginHelper;
|
import com.ruoyi.common.satoken.utils.LoginHelper;
|
||||||
import com.ruoyi.system.domain.*;
|
import com.ruoyi.system.domain.*;
|
||||||
|
import com.ruoyi.system.domain.vo.SysPostVo;
|
||||||
import com.ruoyi.system.mapper.*;
|
import com.ruoyi.system.mapper.*;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -179,11 +180,11 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String selectUserPostGroup(String userName) {
|
public String selectUserPostGroup(String userName) {
|
||||||
List<SysPost> list = postMapper.selectPostsByUserName(userName);
|
List<SysPostVo> list = postMapper.selectPostsByUserName(userName);
|
||||||
if (CollUtil.isEmpty(list)) {
|
if (CollUtil.isEmpty(list)) {
|
||||||
return StringUtils.EMPTY;
|
return StringUtils.EMPTY;
|
||||||
}
|
}
|
||||||
return StreamUtils.join(list, SysPost::getPostName);
|
return StreamUtils.join(list, SysPostVo::getPostName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.system.mapper.SysPostMapper">
|
<mapper namespace="com.ruoyi.system.mapper.SysPostMapper">
|
||||||
|
|
||||||
<resultMap type="com.ruoyi.system.domain.SysPost" id="SysPostResult">
|
<resultMap type="com.ruoyi.system.domain.vo.SysPostVo" id="SysPostResult">
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
|
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user