From 79c6e154603be33088ae2386a3a6533332f067ef Mon Sep 17 00:00:00 2001
From: xiaofajia <1665375861@qq.com>
Date: Wed, 9 Oct 2024 15:08:58 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=AC=E5=91=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../admin/DlBaseNoticeController.java         | 84 +++++++++++++++++++
 .../module/notice/entity/DlBaseNotice.java    | 53 ++++++++++++
 .../notice/mapper/DlBaseNoticeMapper.java     | 32 +++++++
 .../notice/service/DlBaseNoticeService.java   | 45 ++++++++++
 .../service/impl/DlBaseNoticeServiceImpl.java | 65 ++++++++++++++
 .../module/notice/vo/DlBaseNoticeReqVO.java   | 14 ++++
 .../module/notice/vo/DlBaseNoticeRespVO.java  | 14 ++++
 .../mapper/notice/DlBaseNoticeMapper.xml      | 43 ++++++++++
 8 files changed, 350 insertions(+)
 create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/controller/admin/DlBaseNoticeController.java
 create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/entity/DlBaseNotice.java
 create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/mapper/DlBaseNoticeMapper.java
 create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/service/DlBaseNoticeService.java
 create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/service/impl/DlBaseNoticeServiceImpl.java
 create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/vo/DlBaseNoticeReqVO.java
 create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/vo/DlBaseNoticeRespVO.java
 create mode 100644 dl-module-base/src/main/resources/mapper/notice/DlBaseNoticeMapper.xml

diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/controller/admin/DlBaseNoticeController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/controller/admin/DlBaseNoticeController.java
new file mode 100644
index 00000000..767afdef
--- /dev/null
+++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/controller/admin/DlBaseNoticeController.java
@@ -0,0 +1,84 @@
+package cn.iocoder.yudao.module.notice.controller.admin;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.module.notice.entity.DlBaseNotice;
+import cn.iocoder.yudao.module.notice.service.DlBaseNoticeService;
+import cn.iocoder.yudao.module.notice.vo.DlBaseNoticeReqVO;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.v3.oas.annotations.Operation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+/**
+ * 平台通用信息公告(DlBaseNotice)表控制层
+ *
+ * @author 小李
+ * @date 9:48 2024/10/9
+**/
+@RestController
+@RequestMapping("/base/notice")
+public class DlBaseNoticeController {
+    /**
+     * 服务对象
+     */
+    @Resource
+    private DlBaseNoticeService dlBaseNoticeService;
+
+    /**
+     * 平台通用信息公告 分页查询 按服务
+     *
+     * @author 小李
+     * @date 9:52 2024/10/9
+     * @param reqVO 查询对象
+     * @param pageNo 页数
+     * @param pageSize 条数
+    **/
+    @GetMapping("/page")
+    @Operation(summary = "平台通用信息公告 分页查询 按服务")
+    public CommonResult<?> pageNotice(DlBaseNoticeReqVO reqVO,
+                                      @RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo,
+                                      @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize) {
+        Page<DlBaseNotice> page = new Page<>(pageNo, pageSize);
+        return success(dlBaseNoticeService.pageNotice(reqVO, page));
+    }
+
+    /**
+     * 平台通用信息公告 新增、修改 按服务
+     *
+     * @author 小李
+     * @date 10:04 2024/10/9
+     * @param reqVO 请求对象
+    **/
+    @PostMapping("/update")
+    @Operation(summary = "平台通用信息公告 新增、修改 按服务")
+    public CommonResult<?> updateNotice(@RequestBody DlBaseNoticeReqVO reqVO) {
+        dlBaseNoticeService.updateNotice(reqVO);
+        return CommonResult.ok();
+    }
+
+    /**
+     * 平台通用信息公告 删除 按服务
+     *
+     * @author 小李
+     * @date 10:10 2024/10/9
+     * @param ids ids
+    **/
+    @DeleteMapping("/remove")
+    @Operation(summary = "平台通用信息公告 删除 按服务")
+    public CommonResult<?> removeNotice(@RequestParam("ids") List<String> ids) {
+        dlBaseNoticeService.removeNotice(ids);
+        return CommonResult.ok();
+    }
+
+    @GetMapping("get")
+    @Operation(summary = "平台通用信息公告 查询 按服务")
+    public CommonResult<?> getNoticeById(@RequestParam("id") String id) {
+        return success(dlBaseNoticeService.getById(id));
+    }
+}
+
diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/entity/DlBaseNotice.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/entity/DlBaseNotice.java
new file mode 100644
index 00000000..7afcb0c2
--- /dev/null
+++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/entity/DlBaseNotice.java
@@ -0,0 +1,53 @@
+package cn.iocoder.yudao.module.notice.entity;
+
+import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 平台通用信息公告
+ *
+ * @author 小李
+ * @date 9:41 2024/10/9
+**/
+@TableName(value ="dl_base_notice")
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class DlBaseNotice extends TenantBaseDO {
+    /**
+     * 公告ID
+     */
+    @TableId(type = IdType.ASSIGN_UUID)
+    private String id;
+
+    /**
+     * 公告标题
+     */
+    private String title;
+
+    /**
+     * 公告内容
+     */
+    private String content;
+
+    /**
+     * 公告类型(1通知 2公告)
+     */
+    private Integer type;
+
+    /**
+     * 公告状态(0正常 1关闭)
+     */
+    private Integer status;
+
+    /** 父服务(服务拼音,例:维修业务即weixiu) */
+    private String parentServer;
+
+    /**
+     * 展示在那个服务(使用端,例:小程序即wx,APP即app)
+     */
+    private String server;
+}
\ No newline at end of file
diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/mapper/DlBaseNoticeMapper.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/mapper/DlBaseNoticeMapper.java
new file mode 100644
index 00000000..2c1157e4
--- /dev/null
+++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/mapper/DlBaseNoticeMapper.java
@@ -0,0 +1,32 @@
+package cn.iocoder.yudao.module.notice.mapper;
+
+import cn.iocoder.yudao.module.notice.entity.DlBaseNotice;
+import cn.iocoder.yudao.module.notice.vo.DlBaseNoticeReqVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 针对表【dl_base_notice(平台通用信息公告)】的数据库操作Mapper
+ *
+ * @author 小李
+ * @date 9:44 2024/10/9
+**/
+@Mapper
+public interface DlBaseNoticeMapper extends BaseMapper<DlBaseNotice> {
+
+    /**
+     * 平台通用信息公告 分页查询 按服务
+     *
+     * @author 小李
+     * @date 9:52 2024/10/9
+     * @param reqVO 查询对象
+     **/
+    IPage<DlBaseNotice> pageNotice(@Param("map") DlBaseNoticeReqVO reqVO, Page<DlBaseNotice> page);
+}
+
+
+
+
diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/service/DlBaseNoticeService.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/service/DlBaseNoticeService.java
new file mode 100644
index 00000000..aa18ae3d
--- /dev/null
+++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/service/DlBaseNoticeService.java
@@ -0,0 +1,45 @@
+package cn.iocoder.yudao.module.notice.service;
+
+import cn.iocoder.yudao.module.notice.entity.DlBaseNotice;
+import cn.iocoder.yudao.module.notice.vo.DlBaseNoticeReqVO;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 针对表【dl_base_notice(平台通用信息公告)】的数据库操作Service
+ *
+ * @author 小李
+ * @date 9:45 2024/10/9
+**/
+public interface DlBaseNoticeService extends IService<DlBaseNotice> {
+
+    /**
+     * 平台通用信息公告 分页查询 按服务
+     *
+     * @author 小李
+     * @date 9:52 2024/10/9
+     * @param reqVO 查询对象
+     **/
+    IPage<DlBaseNotice> pageNotice(DlBaseNoticeReqVO reqVO, Page<DlBaseNotice> page);
+
+    /**
+     * 平台通用信息公告 新增、修改 按服务
+     *
+     * @author 小李
+     * @date 10:04 2024/10/9
+     * @param reqVO 请求对象
+     **/
+    void updateNotice(DlBaseNoticeReqVO reqVO);
+
+    /**
+     * 平台通用信息公告 删除 按服务
+     *
+     * @author 小李
+     * @date 10:10 2024/10/9
+     * @param ids ids
+     **/
+    void removeNotice(List<String> ids);
+}
diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/service/impl/DlBaseNoticeServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/service/impl/DlBaseNoticeServiceImpl.java
new file mode 100644
index 00000000..0121b06b
--- /dev/null
+++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/service/impl/DlBaseNoticeServiceImpl.java
@@ -0,0 +1,65 @@
+package cn.iocoder.yudao.module.notice.service.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.iocoder.yudao.module.notice.entity.DlBaseNotice;
+import cn.iocoder.yudao.module.notice.mapper.DlBaseNoticeMapper;
+import cn.iocoder.yudao.module.notice.service.DlBaseNoticeService;
+import cn.iocoder.yudao.module.notice.vo.DlBaseNoticeReqVO;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 针对表【dl_base_notice(平台通用信息公告)】的数据库操作Service实现
+ *
+ * @author 小李
+ * @date 9:45 2024/10/9
+**/
+@Service
+public class DlBaseNoticeServiceImpl extends ServiceImpl<DlBaseNoticeMapper, DlBaseNotice>
+    implements DlBaseNoticeService {
+
+    /**
+     * 平台通用信息公告 分页查询 按服务
+     *
+     * @author 小李
+     * @date 9:52 2024/10/9
+     * @param reqVO 查询对象
+     **/
+    @Override
+    public IPage<DlBaseNotice> pageNotice(DlBaseNoticeReqVO reqVO, Page<DlBaseNotice> page){
+        return baseMapper.pageNotice(reqVO, page);
+    }
+
+    /**
+     * 平台通用信息公告 新增、修改 按服务
+     *
+     * @author 小李
+     * @date 10:04 2024/10/9
+     * @param reqVO 请求对象
+     **/
+    @Override
+    public void updateNotice(DlBaseNoticeReqVO reqVO){
+        baseMapper.insertOrUpdate(reqVO);
+    }
+
+    /**
+     * 平台通用信息公告 删除 按服务
+     *
+     * @author 小李
+     * @date 10:10 2024/10/9
+     * @param ids ids
+     **/
+    @Override
+    public void removeNotice(List<String> ids){
+        baseMapper.deleteByIds(ids);
+    }
+}
+
+
+
+
diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/vo/DlBaseNoticeReqVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/vo/DlBaseNoticeReqVO.java
new file mode 100644
index 00000000..fcfb4cd3
--- /dev/null
+++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/vo/DlBaseNoticeReqVO.java
@@ -0,0 +1,14 @@
+package cn.iocoder.yudao.module.notice.vo;
+
+import cn.iocoder.yudao.module.notice.entity.DlBaseNotice;
+import lombok.Data;
+
+/**
+ * 平台通用信息公告 请求VO
+ *
+ * @author 小李
+ * @date 9:43 2024/10/9
+**/
+@Data
+public class DlBaseNoticeReqVO extends DlBaseNotice {
+}
diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/vo/DlBaseNoticeRespVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/vo/DlBaseNoticeRespVO.java
new file mode 100644
index 00000000..f1aa1723
--- /dev/null
+++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/notice/vo/DlBaseNoticeRespVO.java
@@ -0,0 +1,14 @@
+package cn.iocoder.yudao.module.notice.vo;
+
+import cn.iocoder.yudao.module.notice.entity.DlBaseNotice;
+import lombok.Data;
+
+/**
+ * 平台通用信息公告 响应VO
+ *
+ * @author 小李
+ * @date 9:43 2024/10/9
+**/
+@Data
+public class DlBaseNoticeRespVO extends DlBaseNotice {
+}
diff --git a/dl-module-base/src/main/resources/mapper/notice/DlBaseNoticeMapper.xml b/dl-module-base/src/main/resources/mapper/notice/DlBaseNoticeMapper.xml
new file mode 100644
index 00000000..02e19db8
--- /dev/null
+++ b/dl-module-base/src/main/resources/mapper/notice/DlBaseNoticeMapper.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.iocoder.yudao.module.notice.mapper.DlBaseNoticeMapper">
+
+    <resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.notice.entity.DlBaseNotice">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="title" column="title" jdbcType="VARCHAR"/>
+            <result property="content" column="content" jdbcType="VARCHAR"/>
+            <result property="type" column="type" jdbcType="TINYINT"/>
+            <result property="status" column="status" jdbcType="TINYINT"/>
+            <result property="parentServer" column="parent_server" jdbcType="VARCHAR"/>
+            <result property="server" column="server" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_SQL">
+        select id,
+               title,
+               content,
+               type,
+               status,
+               parent_server,
+               server
+        from dl_base_notice dbn
+        where dbn.deleted = '0'
+    </sql>
+
+    <select id="pageNotice" resultMap="BaseResultMap">
+        <include refid="Base_SQL" />
+        and dbn.parent_server = #{map.parentServer}
+        <if test="map.server != null and map.server != ''">
+            and dbn.server = #{map.server}
+        </if>
+        <if test="map.status != null">
+            and dbn.status = #{map.status}
+        </if>
+        <if test="map.title != null and map.title != ''">
+            and dbn.title like concat('%', #{map.title}, '%')
+        </if>
+        order by dbn.create_time desc
+    </select>
+</mapper>