通知公告更改
parent
774e7cec19
commit
de2aa07f45
|
@ -0,0 +1,113 @@
|
||||||
|
package com.muyu.system.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.system.domain.AsUserDept;
|
||||||
|
import com.muyu.system.domain.resp.AsUserDeptNumResponse;
|
||||||
|
import com.muyu.system.service.IAsUserDeptService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @User:86152
|
||||||
|
* @Author:Mr.Huang
|
||||||
|
* @Description:
|
||||||
|
* @Date:2024-04-14 09:59
|
||||||
|
* @Package:com.muyu.system.controller
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/userDept")
|
||||||
|
public class AsUserDeptController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAsUserDeptService asUserDeptService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dept:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<AsUserDept>> list(AsUserDept asUserDept)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<AsUserDept> list = asUserDeptService.selectAsUserDeptList(asUserDept);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/UpdateAsUserDept")
|
||||||
|
public Result list(@RequestParam("id") Long id)
|
||||||
|
{
|
||||||
|
return asUserDeptService.updateAsUserDeptRead(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/GetNum")
|
||||||
|
public Result<AsUserDeptNumResponse> getNum(@RequestParam("noticeId") Long noticeId)
|
||||||
|
{
|
||||||
|
return asUserDeptService.getNum(noticeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出【请填写功能名称】列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dept:export")
|
||||||
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, AsUserDept asUserDept)
|
||||||
|
{
|
||||||
|
List<AsUserDept> list = asUserDeptService.selectAsUserDeptList(asUserDept);
|
||||||
|
ExcelUtil<AsUserDept> util = new ExcelUtil<AsUserDept>(AsUserDept.class);
|
||||||
|
util.exportExcel(response, list, "【请填写功能名称】数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取【请填写功能名称】详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dept:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(asUserDeptService.selectAsUserDeptById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dept:add")
|
||||||
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public Result add(@RequestBody AsUserDept asUserDept)
|
||||||
|
{
|
||||||
|
return toAjax(asUserDeptService.insertAsUserDept(asUserDept));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dept:edit")
|
||||||
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@RequestBody AsUserDept asUserDept)
|
||||||
|
{
|
||||||
|
return toAjax(asUserDeptService.updateAsUserDept(asUserDept));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dept:remove")
|
||||||
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(asUserDeptService.deleteAsUserDeptByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,8 @@ import com.muyu.common.log.enums.BusinessType;
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
|
import com.muyu.system.domain.req.SysNoticeRequest;
|
||||||
|
import com.muyu.system.domain.resp.SysNoticeResponse;
|
||||||
import com.muyu.system.service.SysNoticeService;
|
import com.muyu.system.service.SysNoticeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
@ -37,6 +39,11 @@ public class SysNoticeController extends BaseController {
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/GetNoticeList")
|
||||||
|
public Result<List<SysNoticeResponse>> getNoticeList (@RequestBody SysNoticeRequest sysNoticeRequest) {
|
||||||
|
return noticeService.getNoticeList(sysNoticeRequest);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据通知公告编号获取详细信息
|
* 根据通知公告编号获取详细信息
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.system.domain;
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName AsUserDept
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Mr.Huang
|
||||||
|
* @Date 2024/4/14 09:23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class AsUserDept extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "用户ID")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "公告ID")
|
||||||
|
private Long noticeId;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "是否已读")
|
||||||
|
private String isRead;
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告表 sys_notice
|
* 通知公告表 sys_notice
|
||||||
|
@ -51,6 +52,16 @@ public class SysNotice extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门ID集合
|
||||||
|
*/
|
||||||
|
private List<List<Long>> sectionList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID集合
|
||||||
|
*/
|
||||||
|
private List<Long> personnelList;
|
||||||
|
|
||||||
public Long getNoticeId () {
|
public Long getNoticeId () {
|
||||||
return noticeId;
|
return noticeId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.system.domain.req;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告请求体
|
||||||
|
*
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @User:86152
|
||||||
|
* @Author:Mr.Huang
|
||||||
|
* @Description: 公告请求体
|
||||||
|
* @Date:2024-04-14 09:27
|
||||||
|
* @Package:com.muyu.system.domain.req
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SysNoticeRequest {
|
||||||
|
private Long noticeId;
|
||||||
|
private Long userId;
|
||||||
|
private String noticeType;
|
||||||
|
private String isRead;
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.muyu.system.domain.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告模型
|
||||||
|
*
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @User:86152
|
||||||
|
* @Author:Mr.Huang
|
||||||
|
* @Description: 公告模型
|
||||||
|
* @Date:2024-04-14 09:25
|
||||||
|
* @Package:com.muyu.system.domain.resp
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class AsUserDeptNumResponse {
|
||||||
|
private Long num;
|
||||||
|
private Long readNum;
|
||||||
|
private Long noReadNum;
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.muyu.system.domain.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告模型
|
||||||
|
*
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @User:86152
|
||||||
|
* @Author:Mr.Huang
|
||||||
|
* @Description: 公告模型
|
||||||
|
* @Date:2024-04-14 09:26
|
||||||
|
* @Package:com.muyu.system.domain.resp
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SysNoticeResponse {
|
||||||
|
private Date createTime;
|
||||||
|
private String createBy;
|
||||||
|
private String noticeType;
|
||||||
|
private String isRead;
|
||||||
|
private String noticeTitle;
|
||||||
|
private String noticeContent;
|
||||||
|
private Long noticeId;
|
||||||
|
private Long id;
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.muyu.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.system.domain.AsUserDept;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-04-13
|
||||||
|
*/
|
||||||
|
public interface AsUserDeptMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 【请填写功能名称】
|
||||||
|
*/
|
||||||
|
public AsUserDept selectAsUserDeptById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*
|
||||||
|
* @param asUserDept 【请填写功能名称】
|
||||||
|
* @return 【请填写功能名称】集合
|
||||||
|
*/
|
||||||
|
public List<AsUserDept> selectAsUserDeptList(AsUserDept asUserDept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param asUserDept 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertAsUserDept(AsUserDept asUserDept);
|
||||||
|
public int insertBachAsUserDept(@Param("asUserDepts") List<AsUserDept> asUserDepts);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param asUserDept 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateAsUserDept(AsUserDept asUserDept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAsUserDeptById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAsUserDeptByIds(Long[] ids);
|
||||||
|
|
||||||
|
void updateAsUserDeptRead(@Param("id") Long id);
|
||||||
|
Long selectAsUserDeptNum(@Param("noticeId") Long noticeId);
|
||||||
|
Long selectAsUserDeptReadNum(@Param("noticeId") Long noticeId);
|
||||||
|
}
|
|
@ -2,6 +2,8 @@ package com.muyu.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
|
import com.muyu.system.domain.req.SysNoticeRequest;
|
||||||
|
import com.muyu.system.domain.resp.SysNoticeResponse;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -64,4 +66,8 @@ public interface SysNoticeMapper extends BaseMapper<SysNotice> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteNoticeByIds (Long[] noticeIds);
|
public int deleteNoticeByIds (Long[] noticeIds);
|
||||||
|
|
||||||
|
List<SysNoticeResponse> getNoticeList(SysNoticeRequest sysNoticeRequest);
|
||||||
|
|
||||||
|
List<Long> selectUser();
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,4 +139,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public SysUser checkEmailUnique (String email);
|
public SysUser checkEmailUnique (String email);
|
||||||
|
|
||||||
|
List<Long> selectDeptUser(@Param("sectionIds") List<Long> sectionIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.muyu.system.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.system.domain.AsUserDept;
|
||||||
|
import com.muyu.system.domain.resp.AsUserDeptNumResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-04-13
|
||||||
|
*/
|
||||||
|
public interface IAsUserDeptService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 【请填写功能名称】
|
||||||
|
*/
|
||||||
|
public AsUserDept selectAsUserDeptById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*
|
||||||
|
* @param asUserDept 【请填写功能名称】
|
||||||
|
* @return 【请填写功能名称】集合
|
||||||
|
*/
|
||||||
|
public List<AsUserDept> selectAsUserDeptList(AsUserDept asUserDept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param asUserDept 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertAsUserDept(AsUserDept asUserDept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param asUserDept 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateAsUserDept(AsUserDept asUserDept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的【请填写功能名称】主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAsUserDeptByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除【请填写功能名称】信息
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAsUserDeptById(Long id);
|
||||||
|
|
||||||
|
Result updateAsUserDeptRead(Long id);
|
||||||
|
|
||||||
|
Result<AsUserDeptNumResponse> getNum(Long noticeId);
|
||||||
|
}
|
|
@ -1,7 +1,10 @@
|
||||||
package com.muyu.system.service;
|
package com.muyu.system.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
|
import com.muyu.system.domain.req.SysNoticeRequest;
|
||||||
|
import com.muyu.system.domain.resp.SysNoticeResponse;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -64,4 +67,6 @@ public interface SysNoticeService extends IService<SysNotice> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteNoticeByIds (Long[] noticeIds);
|
public int deleteNoticeByIds (Long[] noticeIds);
|
||||||
|
|
||||||
|
Result<List<SysNoticeResponse>> getNoticeList(SysNoticeRequest sysNoticeRequest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.muyu.system.service.impl;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
|
import com.muyu.system.domain.AsUserDept;
|
||||||
|
import com.muyu.system.domain.resp.AsUserDeptNumResponse;
|
||||||
|
import com.muyu.system.mapper.AsUserDeptMapper;
|
||||||
|
import com.muyu.system.service.IAsUserDeptService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @User:86152
|
||||||
|
* @Author:Mr.Huang
|
||||||
|
* @Description:
|
||||||
|
* @Date:2024-04-14 09:38
|
||||||
|
* @Package:com.muyu.system.service.impl
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AsUserDeptServiceImpl implements IAsUserDeptService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AsUserDeptMapper asUserDeptMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AsUserDept selectAsUserDeptById(Long id) {
|
||||||
|
return asUserDeptMapper.selectAsUserDeptById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AsUserDept> selectAsUserDeptList(AsUserDept asUserDept) {
|
||||||
|
return asUserDeptMapper.selectAsUserDeptList(asUserDept);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertAsUserDept(AsUserDept asUserDept) {
|
||||||
|
asUserDept.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return asUserDeptMapper.insertAsUserDept(asUserDept);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateAsUserDept(AsUserDept asUserDept) {
|
||||||
|
asUserDept.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return asUserDeptMapper.updateAsUserDept(asUserDept);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteAsUserDeptByIds(Long[] ids) {
|
||||||
|
return asUserDeptMapper.deleteAsUserDeptByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteAsUserDeptById(Long id) {
|
||||||
|
return asUserDeptMapper.deleteAsUserDeptById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result updateAsUserDeptRead(Long id) {
|
||||||
|
asUserDeptMapper.updateAsUserDeptRead(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<AsUserDeptNumResponse> getNum(Long noticeId) {
|
||||||
|
Long num = asUserDeptMapper.selectAsUserDeptNum(noticeId);
|
||||||
|
Long readNum = asUserDeptMapper.selectAsUserDeptReadNum(noticeId);
|
||||||
|
long noReadNum = num - readNum;
|
||||||
|
return Result.success(AsUserDeptNumResponse.builder()
|
||||||
|
.num(num)
|
||||||
|
.readNum(readNum)
|
||||||
|
.noReadNum(noReadNum)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +1,24 @@
|
||||||
package com.muyu.system.service.impl;
|
package com.muyu.system.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.system.domain.AsUserDept;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
|
import com.muyu.system.domain.req.SysNoticeRequest;
|
||||||
|
import com.muyu.system.domain.resp.SysNoticeResponse;
|
||||||
|
import com.muyu.system.mapper.AsUserDeptMapper;
|
||||||
import com.muyu.system.mapper.SysNoticeMapper;
|
import com.muyu.system.mapper.SysNoticeMapper;
|
||||||
|
import com.muyu.system.mapper.SysUserMapper;
|
||||||
import com.muyu.system.service.SysNoticeService;
|
import com.muyu.system.service.SysNoticeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 服务层实现
|
* 公告 服务层实现
|
||||||
|
@ -18,16 +29,19 @@ import java.util.List;
|
||||||
public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice> implements SysNoticeService {
|
public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice> implements SysNoticeService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysNoticeMapper noticeMapper;
|
private SysNoticeMapper noticeMapper;
|
||||||
|
@Autowired
|
||||||
|
private SysUserMapper sysUserMapper;
|
||||||
|
@Autowired
|
||||||
|
private AsUserDeptMapper asUserDeptMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询公告信息
|
* 查询公告信息
|
||||||
*
|
*
|
||||||
* @param noticeId 公告ID
|
* @param noticeId 公告ID
|
||||||
*
|
|
||||||
* @return 公告信息
|
* @return 公告信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysNotice selectNoticeById (Long noticeId) {
|
public SysNotice selectNoticeById(Long noticeId) {
|
||||||
return noticeMapper.selectNoticeById(noticeId);
|
return noticeMapper.selectNoticeById(noticeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,35 +49,83 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
* 查询公告列表
|
* 查询公告列表
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param notice 公告信息
|
||||||
*
|
|
||||||
* @return 公告集合
|
* @return 公告集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysNotice> selectNoticeList (SysNotice notice) {
|
public List<SysNotice> selectNoticeList(SysNotice notice) {
|
||||||
return noticeMapper.selectNoticeList(notice);
|
return noticeMapper.selectNoticeList(notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<AsUserDept> handleList(List<Long> personnleList, List<List<Long>> sectionList, Long noticeId) {
|
||||||
|
ArrayList<Long> longs = new ArrayList<>();
|
||||||
|
if (sectionList != null && sectionList.size() != 0) {
|
||||||
|
sectionList.stream()
|
||||||
|
.map(section -> {
|
||||||
|
for (Long aLong : section) {
|
||||||
|
longs.add(aLong);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
List<Long> sectionIds = longs.stream().distinct().toList();
|
||||||
|
List<Long> userIds = sysUserMapper.selectDeptUser(sectionIds);
|
||||||
|
if (userIds != null) {
|
||||||
|
personnleList.addAll(userIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
personnleList = personnleList.stream().distinct().toList();
|
||||||
|
System.out.println(personnleList);
|
||||||
|
List<AsUserDept> asUserDepts = personnleList.stream()
|
||||||
|
.map(personnel -> {
|
||||||
|
AsUserDept asUserDept = new AsUserDept();
|
||||||
|
asUserDept.setUserId(personnel);
|
||||||
|
asUserDept.setNoticeId(noticeId);
|
||||||
|
asUserDept.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
asUserDept.setCreateTime(new Date());
|
||||||
|
return asUserDept;
|
||||||
|
}).toList();
|
||||||
|
return asUserDepts;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增公告
|
* 新增公告
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param notice 公告信息
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertNotice (SysNotice notice) {
|
@Transactional
|
||||||
return noticeMapper.insertNotice(notice);
|
public int insertNotice(SysNotice notice) {
|
||||||
|
int i = noticeMapper.insertNotice(notice);
|
||||||
|
if (notice.getNoticeType().equals("1")) {
|
||||||
|
Long noticeId = notice.getNoticeId();
|
||||||
|
List<Long> personnelList = notice.getPersonnelList();
|
||||||
|
List<List<Long>> sectionList = notice.getSectionList();
|
||||||
|
List<AsUserDept> asUserDepts = handleList(personnelList, sectionList, noticeId);
|
||||||
|
asUserDeptMapper.insertBachAsUserDept(asUserDepts);
|
||||||
|
}else{
|
||||||
|
List<Long> userIds = noticeMapper.selectUser();
|
||||||
|
List<AsUserDept> asUserDepts = userIds.stream()
|
||||||
|
.map(id -> {
|
||||||
|
AsUserDept asUserDept = new AsUserDept();
|
||||||
|
asUserDept.setUserId(id);
|
||||||
|
asUserDept.setNoticeId(notice.getNoticeId());
|
||||||
|
asUserDept.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
asUserDept.setCreateTime(new Date());
|
||||||
|
return asUserDept;
|
||||||
|
}).toList();
|
||||||
|
asUserDeptMapper.insertBachAsUserDept(asUserDepts);
|
||||||
|
}
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改公告
|
* 修改公告
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param notice 公告信息
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateNotice (SysNotice notice) {
|
public int updateNotice(SysNotice notice) {
|
||||||
return noticeMapper.updateNotice(notice);
|
return noticeMapper.updateNotice(notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,11 +133,10 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
* 删除公告对象
|
* 删除公告对象
|
||||||
*
|
*
|
||||||
* @param noticeId 公告ID
|
* @param noticeId 公告ID
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteNoticeById (Long noticeId) {
|
public int deleteNoticeById(Long noticeId) {
|
||||||
return noticeMapper.deleteNoticeById(noticeId);
|
return noticeMapper.deleteNoticeById(noticeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,11 +144,17 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
* 批量删除公告信息
|
* 批量删除公告信息
|
||||||
*
|
*
|
||||||
* @param noticeIds 需要删除的公告ID
|
* @param noticeIds 需要删除的公告ID
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteNoticeByIds (Long[] noticeIds) {
|
public int deleteNoticeByIds(Long[] noticeIds) {
|
||||||
return noticeMapper.deleteNoticeByIds(noticeIds);
|
return noticeMapper.deleteNoticeByIds(noticeIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<SysNoticeResponse>> getNoticeList(SysNoticeRequest sysNoticeRequest) {
|
||||||
|
sysNoticeRequest.setUserId(SecurityUtils.getUserId());
|
||||||
|
List<SysNoticeResponse> noticeList = noticeMapper.getNoticeList(sysNoticeRequest);
|
||||||
|
return Result.success(noticeList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,104 @@
|
||||||
|
<?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="com.muyu.system.mapper.AsUserDeptMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.muyu.system.domain.AsUserDept" id="AsUserDeptResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="noticeId" column="notice_id" />
|
||||||
|
<result property="isRead" column="is_read" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectAsUserDeptVo">
|
||||||
|
select id, user_id, notice_id, is_read, create_by, create_time, update_by, update_time, remark from as_user_dept
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectAsUserDeptList" parameterType="com.muyu.system.domain.AsUserDept" resultMap="AsUserDeptResult">
|
||||||
|
<include refid="selectAsUserDeptVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
|
<if test="noticeId != null "> and notice_id = #{noticeId}</if>
|
||||||
|
<if test="isRead != null and isRead != ''"> and is_read = #{isRead}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAsUserDeptById" parameterType="Long" resultMap="AsUserDeptResult">
|
||||||
|
<include refid="selectAsUserDeptVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
<select id="selectAsUserDeptNum" resultType="java.lang.Long">
|
||||||
|
select count(*) from as_user_dept where notice_id=#{noticeId}
|
||||||
|
</select>
|
||||||
|
<select id="selectAsUserDeptReadNum" resultType="java.lang.Long">
|
||||||
|
select count(*) from as_user_dept where notice_id=#{noticeId} and is_read = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertAsUserDept" parameterType="com.muyu.system.domain.AsUserDept" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into as_user_dept
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="noticeId != null">notice_id,</if>
|
||||||
|
<if test="isRead != null">is_read,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="noticeId != null">#{noticeId},</if>
|
||||||
|
<if test="isRead != null">#{isRead},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<insert id="insertBachAsUserDept">
|
||||||
|
INSERT INTO `as_user_dept` (`user_id`, `notice_id`, `create_by`, `create_time`)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="asUserDepts" separator="," item="asUserDept">
|
||||||
|
(#{asUserDept.userId}, #{asUserDept.noticeId}, #{asUserDept.createBy}, #{asUserDept.createTime})
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateAsUserDept" parameterType="com.muyu.system.domain.AsUserDept">
|
||||||
|
update as_user_dept
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
|
<if test="noticeId != null">notice_id = #{noticeId},</if>
|
||||||
|
<if test="isRead != null">is_read = #{isRead},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
<update id="updateAsUserDeptRead">
|
||||||
|
update as_user_dept set is_read = 0 where id=#{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteAsUserDeptById" parameterType="Long">
|
||||||
|
delete from as_user_dept where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteAsUserDeptByIds" parameterType="String">
|
||||||
|
delete from as_user_dept where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -50,8 +50,23 @@
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getNoticeList" resultType="com.muyu.system.domain.resp.SysNoticeResponse">
|
||||||
|
select id,a.notice_id,is_read,a.create_by,a.create_time,notice_title,notice_content,notice_type
|
||||||
|
from as_user_dept a join sys_notice n on a.notice_id=n.notice_id
|
||||||
|
where a.user_id=#{userId}
|
||||||
|
<if test="isRead !=null and isRead!=''">
|
||||||
|
and is_read = #{isRead}
|
||||||
|
</if>
|
||||||
|
<if test="noticeType !=null and noticeType!=''">
|
||||||
|
and n.notice_type = #{noticeType}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertNotice" parameterType="com.muyu.system.domain.SysNotice">
|
<select id="selectUser" resultType="java.lang.Long">
|
||||||
|
select user_id from sys_user
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertNotice" parameterType="com.muyu.system.domain.SysNotice" useGeneratedKeys="true" keyProperty="noticeId">
|
||||||
insert into sys_notice (
|
insert into sys_notice (
|
||||||
<if test="noticeTitle != null and noticeTitle != '' ">notice_title,</if>
|
<if test="noticeTitle != null and noticeTitle != '' ">notice_title,</if>
|
||||||
<if test="noticeType != null and noticeType != '' ">notice_type,</if>
|
<if test="noticeType != null and noticeType != '' ">notice_type,</if>
|
||||||
|
|
|
@ -184,6 +184,14 @@
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDeptUser" resultType="java.lang.Long">
|
||||||
|
select user_id from sys_user where dept_id in (
|
||||||
|
<foreach collection="sectionIds" separator="," item="id">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertUser" parameterType="com.muyu.common.system.domain.SysUser" useGeneratedKeys="true" keyProperty="userId">
|
<insert id="insertUser" parameterType="com.muyu.common.system.domain.SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||||
insert into sys_user(
|
insert into sys_user(
|
||||||
<if test="userId != null and userId != 0">user_id,</if>
|
<if test="userId != null and userId != 0">user_id,</if>
|
||||||
|
|
Loading…
Reference in New Issue