mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 02:08:43 +08:00 
			
		
		
		
	1. 基本完成通知模块的迁移
This commit is contained in:
		| @@ -13,7 +13,7 @@ import java.util.Date; | ||||
| public class SysDeptRespVO extends SysDeptBaseVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "部门编号", required = true, example = "1024") | ||||
|     private Integer id; | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类") | ||||
|     private Integer status; | ||||
|   | ||||
| @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; | ||||
| public class SysDeptSimpleRespVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "部门编号", required = true, example = "1024") | ||||
|     private Integer id; | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "部门名称", required = true, example = "芋道") | ||||
|     private String name; | ||||
|   | ||||
| @@ -13,7 +13,7 @@ import java.util.Date; | ||||
| public class SysPostRespVO extends SysPostBaseVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "岗位序号", required = true, example = "1024") | ||||
|     private Integer id; | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") | ||||
|     private Date createTime; | ||||
|   | ||||
| @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; | ||||
| public class SysPostSimpleRespVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "岗位编号", required = true, example = "1024") | ||||
|     private Integer id; | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "岗位名称", required = true, example = "芋道") | ||||
|     private String name; | ||||
|   | ||||
| @@ -17,7 +17,7 @@ import java.util.Date; | ||||
| public class SysDictDataRespVO extends SysDictDataBaseVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "字典数据编号", required = true, example = "1024") | ||||
|     private Integer id; | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") | ||||
|     private Date createTime; | ||||
|   | ||||
| @@ -17,7 +17,7 @@ import java.util.Date; | ||||
| public class SysDictTypeRespVO extends SysDictTypeBaseVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "字典类型编号", required = true, example = "1024") | ||||
|     private Integer id; | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "字典类型", required = true, example = "sys_common_sex") | ||||
|     private String type; | ||||
|   | ||||
| @@ -1,64 +1,72 @@ | ||||
| package cn.iocoder.dashboard.modules.system.controller.notice; | ||||
|  | ||||
| import cn.iocoder.dashboard.common.pojo.CommonResult; | ||||
| import cn.iocoder.dashboard.common.pojo.PageResult; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeCreateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticePageReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeRespVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeUpdateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.convert.notice.SysNoticeConvert; | ||||
| import cn.iocoder.dashboard.modules.system.service.notice.SysNoticeService; | ||||
| import io.swagger.annotations.Api; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiOperation; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
|  | ||||
| import static cn.iocoder.dashboard.common.pojo.CommonResult.success; | ||||
|  | ||||
| @Api(tags = "通知公告 API") | ||||
| @RestController | ||||
| @RequestMapping("/system/notice") | ||||
| public class SysNoticeController { | ||||
|  | ||||
| //    /** | ||||
| //     * 获取通知公告列表 | ||||
| //     */ | ||||
|     @Resource | ||||
|     private SysNoticeService noticeService; | ||||
|  | ||||
|     @ApiOperation("获取通知公告列表") | ||||
|     @GetMapping("/page") | ||||
| //    @PreAuthorize("@ss.hasPermi('system:notice:list')") | ||||
| //    @GetMapping("/list") | ||||
| //    public TableDataInfo list(SysNotice notice) { | ||||
| //        startPage(); | ||||
| //        List<SysNotice> list = noticeService.selectNoticeList(notice); | ||||
| //        return getDataTable(list); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 根据通知公告编号获取详细信息 | ||||
| //     */ | ||||
|     public CommonResult<PageResult<SysNoticeRespVO>> pageNotices(@Validated SysNoticePageReqVO reqVO) { | ||||
|         return success(SysNoticeConvert.INSTANCE.convertPage(noticeService.pageNotices(reqVO))); | ||||
|     } | ||||
|  | ||||
|     @ApiOperation("获得通知公告") | ||||
|     @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | ||||
| //    @PreAuthorize("@ss.hasPermi('system:notice:query')") | ||||
| //    @GetMapping(value = "/{noticeId}") | ||||
| //    public AjaxResult getInfo(@PathVariable Long noticeId) { | ||||
| //        return AjaxResult.success(noticeService.selectNoticeById(noticeId)); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 新增通知公告 | ||||
| //     */ | ||||
|     @GetMapping(value = "/get") | ||||
|     public CommonResult<SysNoticeRespVO> getNotice(@RequestParam("id") Long id) { | ||||
|         return success(SysNoticeConvert.INSTANCE.convert(noticeService.getNotice(id))); | ||||
|     } | ||||
|  | ||||
|     @ApiOperation("新增通知公告") | ||||
| //    @PreAuthorize("@ss.hasPermi('system:notice:add')") | ||||
| //    @Log(title = "通知公告", businessType = BusinessType.INSERT) | ||||
| //    @PostMapping | ||||
| //    public AjaxResult add(@Validated @RequestBody SysNotice notice) { | ||||
| //        notice.setCreateBy(SecurityUtils.getUsername()); | ||||
| //        return toAjax(noticeService.insertNotice(notice)); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 修改通知公告 | ||||
| //     */ | ||||
|     @PostMapping("/create") | ||||
|     public CommonResult<Long> createNotice(@Validated @RequestBody SysNoticeCreateReqVO reqVO) { | ||||
|         Long noticeId = noticeService.createNotice(reqVO); | ||||
|         return success(noticeId); | ||||
|     } | ||||
|  | ||||
|     @ApiOperation("修改通知公告") | ||||
| //    @PreAuthorize("@ss.hasPermi('system:notice:edit')") | ||||
| //    @Log(title = "通知公告", businessType = BusinessType.UPDATE) | ||||
| //    @PutMapping | ||||
| //    public AjaxResult edit(@Validated @RequestBody SysNotice notice) { | ||||
| //        notice.setUpdateBy(SecurityUtils.getUsername()); | ||||
| //        return toAjax(noticeService.updateNotice(notice)); | ||||
| //    } | ||||
| // | ||||
| //    /** | ||||
| //     * 删除通知公告 | ||||
| //     */ | ||||
|     @PostMapping("/update") | ||||
|     public CommonResult<Boolean> updateNotice(@Validated @RequestBody SysNoticeUpdateReqVO reqVO) { | ||||
|         noticeService.updateNotice(reqVO); | ||||
|         return success(true); | ||||
|     } | ||||
|  | ||||
|     @ApiOperation("删除通知公告") | ||||
|     @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | ||||
| //    @PreAuthorize("@ss.hasPermi('system:notice:remove')") | ||||
| //    @Log(title = "通知公告", businessType = BusinessType.DELETE) | ||||
| //    @DeleteMapping("/{noticeIds}") | ||||
| //    public AjaxResult remove(@PathVariable Long[] noticeIds) { | ||||
| //        return toAjax(noticeService.deleteNoticeByIds(noticeIds)); | ||||
| //    } | ||||
|     @PostMapping("/delete") | ||||
|     public CommonResult<Boolean> deleteNotice(@RequestParam("id") Long id) { | ||||
|         noticeService.deleteNotice(id); | ||||
|         return success(true); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,32 @@ | ||||
| package cn.iocoder.dashboard.modules.system.controller.notice.vo; | ||||
|  | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | ||||
|  | ||||
| import javax.validation.constraints.NotBlank; | ||||
| import javax.validation.constraints.NotNull; | ||||
| import javax.validation.constraints.Size; | ||||
|  | ||||
| /** | ||||
|  * 通知公告 Base VO,提供给添加、修改、详细的子 VO 使用 | ||||
|  * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||||
|  */ | ||||
| @Data | ||||
| public class SysNoticeBaseVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "公告标题", required = true, example = "小博主") | ||||
|     @NotBlank(message = "公告标题不能为空") | ||||
|     @Size(max = 50, message = "公告标题不能超过50个字符") | ||||
|     private String title; | ||||
|  | ||||
|     @ApiModelProperty(value = "公告标题", required = true, example = "小博主") | ||||
|     @NotNull(message = "公告类型不能为空") | ||||
|     private Integer type; | ||||
|  | ||||
|     @ApiModelProperty(value = "公告内容", required = true, example = "半生编码") | ||||
|     private String content; | ||||
|  | ||||
|     @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类") | ||||
|     private Integer status; | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,12 @@ | ||||
| package cn.iocoder.dashboard.modules.system.controller.notice.vo; | ||||
|  | ||||
| import cn.iocoder.dashboard.modules.system.controller.dept.vo.post.SysPostBaseVO; | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
|  | ||||
| @ApiModel("通知公告创建 Request VO") | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = true) | ||||
| public class SysNoticeCreateReqVO extends SysPostBaseVO { | ||||
| } | ||||
| @@ -0,0 +1,20 @@ | ||||
| package cn.iocoder.dashboard.modules.system.controller.notice.vo; | ||||
|  | ||||
| import cn.iocoder.dashboard.common.pojo.PageParam; | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
|  | ||||
| @ApiModel("通知公告分页 Request VO") | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = true) | ||||
| public class SysNoticePageReqVO extends PageParam { | ||||
|  | ||||
|     @ApiModelProperty(value = "通知公告名称", example = "芋道", notes = "模糊匹配") | ||||
|     private String title; | ||||
|  | ||||
|     @ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类") | ||||
|     private Integer status; | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,22 @@ | ||||
| package cn.iocoder.dashboard.modules.system.controller.notice.vo; | ||||
|  | ||||
| import cn.iocoder.dashboard.modules.system.controller.dept.vo.post.SysPostBaseVO; | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
|  | ||||
| import java.util.Date; | ||||
|  | ||||
| @ApiModel("通知公告信息 Response VO") | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = true) | ||||
| public class SysNoticeRespVO extends SysPostBaseVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "通知公告序号", required = true, example = "1024") | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") | ||||
|     private Date createTime; | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,20 @@ | ||||
| package cn.iocoder.dashboard.modules.system.controller.notice.vo; | ||||
|  | ||||
| import cn.iocoder.dashboard.modules.system.controller.dept.vo.post.SysPostBaseVO; | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
|  | ||||
| import javax.validation.constraints.NotNull; | ||||
|  | ||||
| @ApiModel("岗位公告更新 Request VO") | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = true) | ||||
| public class SysNoticeUpdateReqVO extends SysPostBaseVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "岗位公告编号", required = true, example = "1024") | ||||
|     @NotNull(message = "岗位公告编号不能为空") | ||||
|     private Long id; | ||||
|  | ||||
| } | ||||
| @@ -17,7 +17,7 @@ import java.util.Date; | ||||
| public class SysMenuRespVO extends SysMenuBaseVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "菜单编号", required = true, example = "1024") | ||||
|     private Integer id; | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类") | ||||
|     private Integer status; | ||||
|   | ||||
| @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; | ||||
| public class SysMenuSimpleRespVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "菜单编号", required = true, example = "1024") | ||||
|     private Integer id; | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "菜单名称", required = true, example = "芋道") | ||||
|     private String name; | ||||
|   | ||||
| @@ -18,7 +18,7 @@ import java.util.Set; | ||||
| public class SysRoleRespVO extends SysRoleBaseVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "角色编号", required = true, example = "1") | ||||
|     private Integer id; | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "数据范围", required = true, example = "1", notes = "参见 DataScopeEnum 枚举类") | ||||
|     private Integer dataScope; | ||||
|   | ||||
| @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; | ||||
| public class SysRoleSimpleRespVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "角色编号", required = true, example = "1024") | ||||
|     private Integer id; | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "角色名称", required = true, example = "芋道") | ||||
|     private String name; | ||||
|   | ||||
| @@ -24,7 +24,7 @@ public class SysUserPageItemRespVO extends SysUserRespVO { | ||||
|     public static class Dept { | ||||
|  | ||||
|         @ApiModelProperty(value = "部门编号", required = true, example = "1") | ||||
|         private Integer id; | ||||
|         private Long id; | ||||
|  | ||||
|         @ApiModelProperty(value = "部门名称", required = true, example = "研发部") | ||||
|         private String name; | ||||
|   | ||||
| @@ -17,7 +17,7 @@ import java.util.Date; | ||||
| public class SysUserRespVO extends SysUserBaseVO { | ||||
|  | ||||
|     @ApiModelProperty(value = "用户编号", required = true, example = "1") | ||||
|     private Integer id; | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类") | ||||
|     private Integer status; | ||||
|   | ||||
| @@ -1,6 +1,13 @@ | ||||
| package cn.iocoder.dashboard.modules.system.convert.notice; | ||||
|  | ||||
| import cn.iocoder.dashboard.common.pojo.PageResult; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeCreateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeRespVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeUpdateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO; | ||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
| import org.mapstruct.Mapper; | ||||
| import org.mapstruct.Mapping; | ||||
| import org.mapstruct.factory.Mappers; | ||||
|  | ||||
| @Mapper | ||||
| @@ -8,4 +15,15 @@ public interface SysNoticeConvert { | ||||
|  | ||||
|     SysNoticeConvert INSTANCE = Mappers.getMapper(SysNoticeConvert.class); | ||||
|  | ||||
|     PageResult<SysNoticeRespVO> convertPage(PageResult<SysNoticeDO> page); | ||||
|  | ||||
|     SysNoticeRespVO convert(SysNoticeDO bean); | ||||
|  | ||||
|     SysNoticeDO convert(SysNoticeUpdateReqVO bean); | ||||
|  | ||||
|     SysNoticeDO convert(SysNoticeCreateReqVO bean); | ||||
|  | ||||
|     @Mapping(source = "records", target = "list") | ||||
|     PageResult<SysNoticeDO> convertPage02(IPage<SysNoticeDO> page); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -1,9 +1,20 @@ | ||||
| package cn.iocoder.dashboard.modules.system.dal.mysql.dao.notice; | ||||
|  | ||||
| import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; | ||||
| import cn.iocoder.dashboard.framework.mybatis.core.util.MyBatisUtils; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticePageReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO; | ||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
| import org.apache.ibatis.annotations.Mapper; | ||||
|  | ||||
| @Mapper | ||||
| public interface SysNoticeMapper extends BaseMapper<SysNoticeDO> { | ||||
|  | ||||
|     default IPage<SysNoticeDO> selectList(SysNoticePageReqVO reqVO) { | ||||
|         return selectPage(MyBatisUtils.buildPage(reqVO), | ||||
|                 new QueryWrapperX<SysNoticeDO>().likeIfPresent("title", reqVO.getTitle()) | ||||
|                         .eqIfPresent("status", reqVO.getStatus())); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -8,9 +8,6 @@ import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
|  | ||||
| import javax.validation.constraints.NotBlank; | ||||
| import javax.validation.constraints.Size; | ||||
|  | ||||
| /** | ||||
|  * 通知公告表 | ||||
|  * | ||||
| @@ -28,8 +25,7 @@ public class SysNoticeDO extends BaseDO { | ||||
|     /** | ||||
|      * 公告标题 | ||||
|      */ | ||||
|     @NotBlank(message = "公告标题不能为空") | ||||
|     @Size(max = 50, message = "公告标题不能超过50个字符") | ||||
|  | ||||
|     private String title; | ||||
|     /** | ||||
|      * 公告类型 | ||||
| @@ -37,7 +33,7 @@ public class SysNoticeDO extends BaseDO { | ||||
|      * 枚举 {@link SysNoticeTypeEnum} | ||||
|      */ | ||||
|     @TableField("notice_type") | ||||
|     private String type; | ||||
|     private Integer type; | ||||
|     /** | ||||
|      * 公告内容 | ||||
|      */ | ||||
|   | ||||
| @@ -66,4 +66,7 @@ public interface SysErrorCodeConstants { | ||||
|     ErrorCode DICT_DATA_NOT_ENABLE = new ErrorCode(1002007002, "字典数据不处于开启状态,不允许选择"); | ||||
|     ErrorCode DICT_DATA_VALUE_DUPLICATE = new ErrorCode(1002007003, "已经存在该值的字典数据"); | ||||
|  | ||||
|     // ========== 通知公告 1002008000 ========== | ||||
|     ErrorCode NOTICE_NOT_FOUND = new ErrorCode(1002008001, "当前通知公告不存在"); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,51 @@ | ||||
| package cn.iocoder.dashboard.modules.system.service.notice; | ||||
|  | ||||
| import cn.iocoder.dashboard.common.pojo.PageResult; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeCreateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticePageReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeUpdateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO; | ||||
|  | ||||
| /** | ||||
|  * 通知公告 Service 接口 | ||||
|  */ | ||||
| public interface SysNoticeService { | ||||
|  | ||||
|     /** | ||||
|      * 获得岗位公告公告分页列表 | ||||
|      * | ||||
|      * @param reqVO 分页条件 | ||||
|      * @return 部门分页列表 | ||||
|      */ | ||||
|     PageResult<SysNoticeDO> pageNotices(SysNoticePageReqVO reqVO); | ||||
|  | ||||
|     /** | ||||
|      * 获得岗位公告公告信息 | ||||
|      * | ||||
|      * @param id 岗位公告公告编号 | ||||
|      * @return 岗位公告公告信息 | ||||
|      */ | ||||
|     SysNoticeDO getNotice(Long id); | ||||
|  | ||||
|     /** | ||||
|      * 创建岗位公告公告 | ||||
|      * | ||||
|      * @param reqVO 岗位公告公告信息 | ||||
|      * @return 岗位公告公告编号 | ||||
|      */ | ||||
|     Long createNotice(SysNoticeCreateReqVO reqVO); | ||||
|  | ||||
|     /** | ||||
|      * 更新岗位公告公告 | ||||
|      * | ||||
|      * @param reqVO 岗位公告公告信息 | ||||
|      */ | ||||
|     void updateNotice(SysNoticeUpdateReqVO reqVO); | ||||
|  | ||||
|     /** | ||||
|      * 删除岗位公告公告信息 | ||||
|      * | ||||
|      * @param id 岗位公告公告编号 | ||||
|      */ | ||||
|     void deleteNotice(Long id); | ||||
| } | ||||
| @@ -0,0 +1,73 @@ | ||||
| package cn.iocoder.dashboard.modules.system.service.notice.impl; | ||||
|  | ||||
| import cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil; | ||||
| import cn.iocoder.dashboard.common.pojo.PageResult; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeCreateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticePageReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeUpdateReqVO; | ||||
| import cn.iocoder.dashboard.modules.system.convert.dept.SysPostConvert; | ||||
| import cn.iocoder.dashboard.modules.system.convert.notice.SysNoticeConvert; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dao.notice.SysNoticeMapper; | ||||
| import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO; | ||||
| import cn.iocoder.dashboard.modules.system.service.notice.SysNoticeService; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
|  | ||||
| import static cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants.NOTICE_NOT_FOUND; | ||||
|  | ||||
| /** | ||||
|  * 通知公告 Service 实现类 | ||||
|  * | ||||
|  * @author 芋道源码 | ||||
|  */ | ||||
| @Service | ||||
| public class SysNoticeServiceImpl implements SysNoticeService { | ||||
|  | ||||
|     @Resource | ||||
|     private SysNoticeMapper noticeMapper; | ||||
|  | ||||
|     @Override | ||||
|     public PageResult<SysNoticeDO> pageNotices(SysNoticePageReqVO reqVO) { | ||||
|         return SysNoticeConvert.INSTANCE.convertPage02(noticeMapper.selectList(reqVO)); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public SysNoticeDO getNotice(Long id) { | ||||
|         return noticeMapper.selectById(id); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public Long createNotice(SysNoticeCreateReqVO reqVO) { | ||||
|         SysNoticeDO notice = SysNoticeConvert.INSTANCE.convert(reqVO); | ||||
|         return notice.getId(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void updateNotice(SysNoticeUpdateReqVO reqVO) { | ||||
|         // 校验是否存在 | ||||
|         this.checkNoticeExists(reqVO.getId()); | ||||
|         // 更新通知公告 | ||||
|         SysNoticeDO updateObj = SysNoticeConvert.INSTANCE.convert(reqVO); | ||||
|         noticeMapper.updateById(updateObj); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void deleteNotice(Long id) { | ||||
|         // 校验是否存在 | ||||
|         this.checkNoticeExists(id); | ||||
|         // 删除通知公告 | ||||
|         noticeMapper.deleteById(id); | ||||
|     } | ||||
|  | ||||
|     private void checkNoticeExists(Long id) { | ||||
|         if (id == null) { | ||||
|             return; | ||||
|         } | ||||
|         SysNoticeDO notice = noticeMapper.selectById(id); | ||||
|         if (notice == null) { | ||||
|             throw ServiceExceptionUtil.exception(NOTICE_NOT_FOUND); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV