소스 검색

公告已读初步实现

Signed-off-by: hamjin <335908093@qq.com>
hamjin 2 년 전
부모
커밋
70607f8048

+ 19 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/PoNoticeController.java

@@ -5,8 +5,10 @@ import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.system.domain.PoNotice;
 import com.ruoyi.system.service.IPoNoticeService;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -30,17 +32,31 @@ public class PoNoticeController extends BaseController {
      */
     @PreAuthorize("@ss.hasPermi('system:notice:list')")
     @GetMapping("/list")
+    @ApiOperation("获取通知公告")
     public TableDataInfo list(PoNotice poNotice) {
         startPage();
         List<PoNotice> list = poNoticeService.selectPoNoticeList(poNotice);
         return getDataTable(list);
     }
 
+    /**
+     * 获取通知公告列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:notice:list')")
+    @GetMapping("/export")
+    @ApiOperation("导出通知公告")
+    public AjaxResult export(PoNotice poNotice) {
+        List<PoNotice> list = poNoticeService.selectPoNoticeList(poNotice);
+        ExcelUtil<PoNotice> util = new ExcelUtil<>(PoNotice.class);
+        return util.exportExcel(list, "通知公告列表");
+    }
+
     /**
      * 根据通知公告编号获取详细信息
      */
     @PreAuthorize("@ss.hasPermi('system:notice:query')")
     @GetMapping(value = "/{poNoticeId}")
+    @ApiOperation("获取通知公告内容")
     public AjaxResult getInfo(@PathVariable Long poNoticeId) {
         return success(poNoticeService.selectPoNoticeById(poNoticeId));
     }
@@ -50,6 +66,7 @@ public class PoNoticeController extends BaseController {
      */
     @PreAuthorize("@ss.hasPermi('system:notice:add')")
     @Log(title = "通知公告", businessType = BusinessType.INSERT)
+    @ApiOperation("添加通知公告")
     @PostMapping
     public AjaxResult add(@Validated @RequestBody PoNotice poNotice) {
         System.out.println(poNotice);
@@ -61,6 +78,7 @@ public class PoNoticeController extends BaseController {
      */
     @PreAuthorize("@ss.hasPermi('system:notice:edit')")
     @Log(title = "通知公告", businessType = BusinessType.UPDATE)
+    @ApiOperation("编辑通知公告")
     @PutMapping
     public AjaxResult edit(@Validated @RequestBody PoNotice poNotice) {
         List<PoNotice> poNotice1 = poNoticeService.selectPoNoticeList(poNotice);
@@ -76,6 +94,7 @@ public class PoNoticeController extends BaseController {
      */
     @PreAuthorize("@ss.hasPermi('system:notice:remove')")
     @Log(title = "通知公告", businessType = BusinessType.DELETE)
+    @ApiOperation("删除通知公告")
     @DeleteMapping("/{poNoticeIds}")
     public AjaxResult remove(@PathVariable Long[] poNoticeIds) {
         return toAjax(poNoticeService.deletePoNoticeByIds(poNoticeIds));

+ 15 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/PoNotice.java

@@ -56,6 +56,12 @@ public class PoNotice extends BaseEntity {
     @Excel(name = "通知公告接收人ID")
     private List<String> userId;
 
+    /**
+     * 通知公告已读人ID
+     */
+    @Excel(name = "通知公告接收人ID")
+    private List<String> readUserId;
+
     /**
      * 通知公告逻辑删除状态 0未删除 1删除
      */
@@ -118,6 +124,14 @@ public class PoNotice extends BaseEntity {
         this.userId = userId;
     }
 
+    public List<String> getReadUserId() {
+        return readUserId;
+    }
+
+    public void setReadUserId(List<String> readUserId) {
+        this.readUserId = readUserId;
+    }
+
     public Boolean getDelFlag() {
         return delFlag;
     }
@@ -136,6 +150,7 @@ public class PoNotice extends BaseEntity {
                 .append("status", status)
                 .append("publisherId", publisherId)
                 .append("userId", userId)
+                .append("readUserId", readUserId)
                 .append("delFlag", delFlag)
                 .toString();
     }

+ 6 - 0
ruoyi-system/src/main/resources/mapper/system/PoNoticeMapper.xml

@@ -17,6 +17,8 @@
         <result property="remark" column="remark"/>
         <result property="publisherId" column="publisher_id"/>
         <result property="userId" column="user_id" typeHandler="com.ruoyi.common.utils.sql.List2VarcharHandler"/>
+        <result property="readUserId" column="read_userid"
+                typeHandler="com.ruoyi.common.utils.sql.List2VarcharHandler"/>
         <result property="delFlag" column="del_flag"/>
     </resultMap>
 
@@ -33,6 +35,7 @@
                remark,
                publisher_id,
                user_id,
+               read_userid,
                del_flag
         from po_notice
     </sql>
@@ -73,6 +76,7 @@
         <if test="createBy != null and createBy != ''">create_by,</if>
         <if test="publisherId != null and publisherId != ''">publisher_id,</if>
         <if test="userId != null and userId != ''">user_id,</if>
+        <if test="readUserId != null and readUserId != ''">read_userid,</if>
         del_flag,
         create_time
         )values(
@@ -84,6 +88,7 @@
         <if test="createBy != null and createBy != ''">#{createBy},</if>
         <if test="publisherId != null and publisherId != ''">#{publisher_id},</if>
         <if test="userId != null and userId != ''">#{user_id},</if>
+        <if test="readUserId != null and readUserId != ''">#{read_userid},</if>
         0,
         sysdate()
         )
@@ -100,6 +105,7 @@
             <if test="remark != null and remark != ''">remark = #{remark},</if>
             <if test="publisherId != null and publisherId != ''">publisher_id = #{publisherId},</if>
             <if test="userId != null and userId != ''">user_id = #{userId},</if>
+            <if test="readUserId != null and readUserId != ''">read_userid = #{readUserId},</if>
             <if test="delFlag != null and delFlag != ''">del_flag = #{del_flag},</if>
             update_time = sysdate()
         </set>