通知公告更改
parent
10341472e9
commit
9a34a9cf54
|
@ -14,10 +14,14 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,14 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,14 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,14 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,14 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.muyu.system.domain.resp.AsUserDeotNumResponse;
|
||||
import com.muyu.system.service.AsUserDeptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
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.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/userDept")
|
||||
public class AsUserDeptController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private AsUserDeptService 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<AsUserDeotNumResponse> 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.utils.SecurityUtils;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -37,6 +39,11 @@ public class SysNoticeController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/GetNoticeList")
|
||||
public Result<List< SysNoticeResponse >> getNoticeList (@RequestBody SysNoticeRequest sysNoticeRequest) {
|
||||
return noticeService.getNoticeList(sysNoticeRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据通知公告编号获取详细信息
|
||||
*/
|
||||
|
|
|
@ -100,8 +100,11 @@ public class SysUserController extends BaseController {
|
|||
@GetMapping("/info/{username}")
|
||||
public Result<LoginUser> info (@PathVariable("username") String username) {
|
||||
SysUser sysUser = userService.selectUserByUserName(username);
|
||||
if (StringUtils.isNull(sysUser)) {
|
||||
return Result.error("用户名或密码错误");
|
||||
|
||||
if (StringUtils.isNull(sysUser)&& username.contains ( "@" )) {
|
||||
return Result.error("邮箱或密码错误");
|
||||
}else if (StringUtils.isNull(sysUser)){
|
||||
return Result.error ( "用户名密码错误" );
|
||||
}
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(sysUser);
|
||||
|
|
|
@ -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 Xin.Yao
|
||||
* @Date 2024/4/13 12:20
|
||||
*/
|
||||
@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;
|
||||
}
|
|
@ -2,16 +2,14 @@ package com.muyu.system.domain;
|
|||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.core.xss.Xss;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通知公告表 sys_notice
|
||||
|
@ -46,11 +44,31 @@ public class SysNotice extends BaseEntity {
|
|||
*/
|
||||
private String noticeContent;
|
||||
|
||||
/**
|
||||
* 特点人员集合
|
||||
*/
|
||||
@Getter
|
||||
private List<Long> ids;
|
||||
|
||||
/**
|
||||
* 部门集合
|
||||
*/
|
||||
@Getter
|
||||
private List<Long> checkedDept;
|
||||
|
||||
/**
|
||||
* 公告状态(0正常 1关闭)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
public void setIds(List< Long > ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
|
||||
public void setCheckedDept(List< Long > checkedDept) {
|
||||
this.checkedDept = checkedDept;
|
||||
}
|
||||
|
||||
public Long getNoticeId () {
|
||||
return noticeId;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.system.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
* @author YunFei.Du
|
||||
* @date 23:13 2024/4/13
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SysNoticeRequest {
|
||||
private Long noticeId;
|
||||
private Long userId;
|
||||
private String noticeType;
|
||||
private String isRead;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.system.domain.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @ClassName AsUserDeotNumResponse
|
||||
* @Description 描述
|
||||
* @Author YunFei.Du
|
||||
* @Date 2024/4/13 23:14
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class AsUserDeotNumResponse {
|
||||
private Long num;
|
||||
private Long readNum;
|
||||
private Long noReadNum;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.muyu.system.domain.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName SysNoticeResponse
|
||||
* @Description 描述
|
||||
* @Author YunFei.Du
|
||||
* @Date 2024/4/13 23:14
|
||||
*/
|
||||
@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,69 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.system.domain.AsUserDept;
|
||||
import com.muyu.system.domain.SysMenu;
|
||||
import feign.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName AsUserDeptMapper
|
||||
* @Description 描述
|
||||
* @Author YunFei.Du
|
||||
* @Date 2024/4/13 23:15
|
||||
*/
|
||||
public interface AsUserDeptMapper extends BaseMapper< AsUserDept > {
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @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> list);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @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.muyu.system.domain.SysNotice;
|
||||
import com.muyu.system.domain.req.SysNoticeRequest;
|
||||
import com.muyu.system.domain.resp.SysNoticeResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -64,4 +66,10 @@ public interface SysNoticeMapper extends BaseMapper<SysNotice> {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeByIds (Long[] noticeIds);
|
||||
|
||||
|
||||
List< SysNoticeResponse > getNoticeList(SysNoticeRequest sysNoticeRequest);
|
||||
|
||||
List<Long> selectUser();
|
||||
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
*/
|
||||
public List<SysUser> selectUnallocatedList (SysUser user);
|
||||
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
|
@ -139,4 +140,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
* @return 结果
|
||||
*/
|
||||
public SysUser checkEmailUnique (String email);
|
||||
|
||||
List< Long> selectBatchUserIdByDeptIds(@Param("checkedDept") List< Long> checkedDept);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.system.domain.AsUserDept;
|
||||
import com.muyu.system.domain.resp.AsUserDeotNumResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName AsUserDeptService
|
||||
* @Description 描述
|
||||
* @Author YunFei.Du
|
||||
* @Date 2024/4/13 23:16
|
||||
*/
|
||||
public interface AsUserDeptService {
|
||||
/**
|
||||
* @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< AsUserDeotNumResponse > getNum(Long noticeId);
|
||||
|
||||
AsUserDept selectAsUserDeptById(Long id);
|
||||
|
||||
List< AsUserDept> selectAsUserDeptList(AsUserDept asUserDept);
|
||||
|
||||
}
|
|
@ -1,7 +1,10 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
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.req.SysNoticeRequest;
|
||||
import com.muyu.system.domain.resp.SysNoticeResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -64,4 +67,6 @@ public interface SysNoticeService extends IService<SysNotice> {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeByIds (Long[] noticeIds);
|
||||
|
||||
Result< List< SysNoticeResponse>> getNoticeList(SysNoticeRequest sysNoticeRequest);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
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.AsUserDeotNumResponse;
|
||||
import com.muyu.system.mapper.AsUserDeptMapper;
|
||||
import com.muyu.system.service.AsUserDeptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName AsUserDeptServiceImpl
|
||||
* @Description 描述
|
||||
* @Author YunFei.Du
|
||||
* @Date 2024/4/13 23:17
|
||||
*/
|
||||
@Service
|
||||
public class AsUserDeptServiceImpl implements AsUserDeptService {
|
||||
@Autowired
|
||||
private AsUserDeptMapper asUserDeptMapper;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public AsUserDept selectAsUserDeptById(Long id)
|
||||
{
|
||||
return asUserDeptMapper.selectAsUserDeptById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param asUserDept 【请填写功能名称】
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public List<AsUserDept> selectAsUserDeptList(AsUserDept asUserDept)
|
||||
{
|
||||
return asUserDeptMapper.selectAsUserDeptList(asUserDept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param asUserDept 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAsUserDept(AsUserDept asUserDept)
|
||||
{
|
||||
asUserDept.setCreateTime(DateUtils.getNowDate());
|
||||
return asUserDeptMapper.insertAsUserDept(asUserDept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param asUserDept 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAsUserDept(AsUserDept asUserDept)
|
||||
{
|
||||
asUserDept.setUpdateTime( DateUtils.getNowDate());
|
||||
return asUserDeptMapper.updateAsUserDept(asUserDept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAsUserDeptByIds(Long[] ids)
|
||||
{
|
||||
return asUserDeptMapper.deleteAsUserDeptByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】信息
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAsUserDeptById(Long id)
|
||||
{
|
||||
return asUserDeptMapper.deleteAsUserDeptById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Result updateAsUserDeptRead(Long id) {
|
||||
asUserDeptMapper.updateAsUserDeptRead(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result< AsUserDeotNumResponse > getNum(Long noticeId) {
|
||||
Long num = asUserDeptMapper.selectAsUserDeptNum(noticeId);
|
||||
Long readNum = asUserDeptMapper.selectAsUserDeptReadNum(noticeId);
|
||||
long noReadNum = num-readNum;
|
||||
return Result.success(AsUserDeotNumResponse.builder()
|
||||
.num(num)
|
||||
.readNum(readNum)
|
||||
.noReadNum(noReadNum)
|
||||
.build());
|
||||
}
|
||||
}
|
|
@ -60,16 +60,49 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
*/
|
||||
@Override
|
||||
public List<SysMenu> selectMenuList (SysMenu menu, Long userId) {
|
||||
List<SysMenu> allMenuList = null;
|
||||
List<SysMenu> menuList = null;
|
||||
// 管理员显示所有菜单信息
|
||||
if (SysUser.isAdmin(userId)) {
|
||||
boolean isAdmin = SysUser.isAdmin(userId);
|
||||
if (isAdmin) {
|
||||
menuList = menuMapper.selectMenuList(menu);
|
||||
} else {
|
||||
menu.getParams().put("userId", userId);
|
||||
menuList = menuMapper.selectMenuListByUserId(menu);
|
||||
}
|
||||
// 若菜单列表只有一个元素,则尝试获取其子菜单并添加到菜单列表中
|
||||
if (menuList.size ()==1) {
|
||||
SysMenu sysMenu = menuList.get ( 0 );
|
||||
|
||||
this.getMeentList ( menuList, sysMenu );
|
||||
// 获取当前菜单的子菜单列表
|
||||
SysMenu newMenu = new SysMenu();
|
||||
newMenu.setParams(menu.getParams());
|
||||
allMenuList=isAdmin?menuMapper.selectMenuList(null):menuMapper.selectMenuListByUserId(newMenu);
|
||||
List<SysMenu> childList = this.getChildList(allMenuList, sysMenu);
|
||||
// // 将子菜单添加到菜单列表中
|
||||
menuList.addAll ( childList );
|
||||
}
|
||||
return menuList;
|
||||
}
|
||||
/**
|
||||
* 获取祖节点
|
||||
* 递归遍历菜单列表,找到指定菜单的所有祖先菜单,并将它们添加到菜单列表中。
|
||||
* @param menuList 菜单列表,用于存储找到的祖先菜单。
|
||||
* @param menu 指定的菜单项,寻找它的祖先菜单。
|
||||
*/
|
||||
private void getMeentList(List< SysMenu> menuList, SysMenu menu) {
|
||||
// 如果当前菜单的父菜单ID不等于0(表示根菜单),则查找并添加其父菜单到菜单列表中,然后递归查找父菜单的祖先菜单
|
||||
if (!menu.getParentId ().equals ( 0L )){
|
||||
// 通过父菜单ID选择父菜单
|
||||
SysMenu sysMenu = this.selectMenuById ( menu.getParentId ( ) );
|
||||
// 将父菜单添加到菜单列表中
|
||||
menuList.add ( sysMenu );
|
||||
// 递归查找父菜单的祖先菜单
|
||||
getMeentList ( menuList,sysMenu );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户ID查询权限
|
||||
|
|
|
@ -1,12 +1,22 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
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.req.SysNoticeRequest;
|
||||
import com.muyu.system.domain.resp.AsUserDeotNumResponse;
|
||||
import com.muyu.system.domain.resp.SysNoticeResponse;
|
||||
import com.muyu.system.mapper.AsUserDeptMapper;
|
||||
import com.muyu.system.mapper.SysNoticeMapper;
|
||||
import com.muyu.system.mapper.SysUserMapper;
|
||||
import com.muyu.system.service.SysNoticeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -19,6 +29,12 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
@Autowired
|
||||
private SysNoticeMapper noticeMapper;
|
||||
|
||||
@Autowired
|
||||
private AsUserDeptMapper asUserDeptMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
/**
|
||||
* 查询公告信息
|
||||
*
|
||||
|
@ -43,6 +59,35 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
return noticeMapper.selectNoticeList(notice);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<AsUserDept> handleList(List<Long> ids,List<Long> checkedDept,Long noticeId){
|
||||
|
||||
|
||||
// 根据用户部门查找对于的用户
|
||||
List<Long> userIds=sysUserMapper.selectBatchUserIdByDeptIds(checkedDept);
|
||||
if (ids!=null){
|
||||
userIds.addAll ( ids );
|
||||
}
|
||||
List< Long > allUserIds = userIds.stream ( ).distinct ( ).toList ( );
|
||||
System.out.println ("allUserIds"+allUserIds );
|
||||
|
||||
List< AsUserDept > userDepts = allUserIds.stream ( )
|
||||
.map ( userId -> {
|
||||
AsUserDept asUserDept = new AsUserDept ( );
|
||||
asUserDept.setUserId ( userId );
|
||||
asUserDept.setNoticeId ( noticeId );
|
||||
asUserDept.setCreateBy ( SecurityUtils.getUsername ( ) );
|
||||
asUserDept.setCreateTime ( new Date ( ) );
|
||||
return asUserDept;
|
||||
} ).toList ( );
|
||||
|
||||
|
||||
return userDepts;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
|
@ -52,7 +97,29 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
*/
|
||||
@Override
|
||||
public int insertNotice (SysNotice notice) {
|
||||
return noticeMapper.insertNotice(notice);
|
||||
int i = noticeMapper.insertNotice(notice);
|
||||
|
||||
if (notice.getNoticeType().equals("1")){
|
||||
Long noticeId = notice.getNoticeId();
|
||||
List<Long> personnelList = notice.getIds ();
|
||||
List<Long> checkedDept = notice.getCheckedDept ();
|
||||
List< AsUserDept > asUserDepts = handleList(personnelList, checkedDept, noticeId);
|
||||
asUserDeptMapper.insertBachAsUserDept(asUserDepts);
|
||||
}else{
|
||||
List<Long> userIds=noticeMapper.selectUser();
|
||||
List<AsUserDept> asUserDepts = userIds.stream()
|
||||
.map(id -> {
|
||||
AsUserDept asUserDept = new AsUserDept();
|
||||
asUserDept.setNoticeId(notice.getNoticeId());
|
||||
asUserDept.setCreateTime(new Date ());
|
||||
asUserDept.setUserId(id);
|
||||
asUserDept.setCreateBy( SecurityUtils.getUsername());
|
||||
return asUserDept;
|
||||
}).toList();
|
||||
asUserDeptMapper.insertBachAsUserDept(asUserDepts);
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,4 +157,11 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
public int deleteNoticeByIds (Long[] 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,14 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -50,8 +50,23 @@
|
|||
</if>
|
||||
</where>
|
||||
</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 (
|
||||
<if test="noticeTitle != null and noticeTitle != '' ">notice_title,</if>
|
||||
<if test="noticeType != null and noticeType != '' ">notice_type,</if>
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
<?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" parameterType="java.util.List">
|
||||
INSERT INTO `as_user_dept` (`user_id`, `notice_id`, `create_by`, `create_time`)
|
||||
VALUES
|
||||
<foreach collection="list" separator="," item="item">
|
||||
(#{item.userId}, #{item.noticeId}, #{item.createBy}, #{item.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>
|
|
@ -152,7 +152,7 @@
|
|||
|
||||
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_name = #{userName} and u.del_flag = '0'
|
||||
where u.user_name = #{userName} or u.email=#{userName} and u.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||
|
@ -183,6 +183,14 @@
|
|||
and del_flag = '0'
|
||||
limit 1
|
||||
</select>
|
||||
<select id="selectBatchUserIdByDeptIds" resultType="java.lang.Long">
|
||||
select user_id from sys_user where dept_id in
|
||||
(
|
||||
<foreach collection="checkedDept" item="id" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="com.muyu.common.system.domain.SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
|
|
|
@ -14,10 +14,14 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 111.229.102.61:8848
|
||||
# 命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
Loading…
Reference in New Issue