通知公告
parent
738ad0626b
commit
e2c17cf6c5
|
@ -0,0 +1,176 @@
|
|||
package com.muyu.data.source.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.data.source.domain.req.DataSourceQueryReq;
|
||||
import com.muyu.data.source.domain.req.DataSourceSaveReq;
|
||||
import com.muyu.data.source.domain.req.DataSourceEditReq;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 数据源对象 data_source
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("data_source")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "DataSource", description = "数据源")
|
||||
public class DataSource extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 数据管理id */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "数据管理id", value = "数据管理id")
|
||||
private Long id;
|
||||
|
||||
/** 接入源名称 */
|
||||
@Excel(name = "接入源名称")
|
||||
@ApiModelProperty(name = "接入源名称", value = "接入源名称")
|
||||
private String accessSourceName;
|
||||
|
||||
/** 数据来源系统名称 */
|
||||
@Excel(name = "数据来源系统名称")
|
||||
@ApiModelProperty(name = "数据来源系统名称", value = "数据来源系统名称")
|
||||
private String dataSourceSystemName;
|
||||
|
||||
/** 主机地址 */
|
||||
@Excel(name = "主机地址")
|
||||
@ApiModelProperty(name = "主机地址", value = "主机地址")
|
||||
private String hostAddress;
|
||||
|
||||
/** 主机端口 */
|
||||
@Excel(name = "主机端口")
|
||||
@ApiModelProperty(name = "主机端口", value = "主机端口")
|
||||
private String hostPort;
|
||||
|
||||
/** 数据连接类型ID */
|
||||
@Excel(name = "数据连接类型ID")
|
||||
@ApiModelProperty(name = "数据连接类型ID", value = "数据连接类型ID")
|
||||
private Long dataAccessTypeId;
|
||||
|
||||
/** 数据库名称 */
|
||||
@Excel(name = "数据库名称")
|
||||
@ApiModelProperty(name = "数据库名称", value = "数据库名称")
|
||||
private String databaseName;
|
||||
|
||||
/** 数据连接参数 */
|
||||
@Excel(name = "数据连接参数")
|
||||
@ApiModelProperty(name = "数据连接参数", value = "数据连接参数")
|
||||
private String dataConnectionParameter;
|
||||
|
||||
/** 初始连接数量 */
|
||||
@Excel(name = "初始连接数量")
|
||||
@ApiModelProperty(name = "初始连接数量", value = "初始连接数量")
|
||||
private String initialQuantity;
|
||||
|
||||
/** 最大连接数量 */
|
||||
@Excel(name = "最大连接数量")
|
||||
@ApiModelProperty(name = "最大连接数量", value = "最大连接数量")
|
||||
private String maximumQuantity;
|
||||
|
||||
/** 最大等待时间 */
|
||||
@Excel(name = "最大等待时间")
|
||||
@ApiModelProperty(name = "最大等待时间", value = "最大等待时间")
|
||||
private Long maximumTime;
|
||||
|
||||
/** 最大等待次数 */
|
||||
@Excel(name = "最大等待次数")
|
||||
@ApiModelProperty(name = "最大等待次数", value = "最大等待次数")
|
||||
private String maximumFrequency;
|
||||
|
||||
/** 数据库用户名 */
|
||||
@Excel(name = "数据库用户名")
|
||||
@ApiModelProperty(name = "数据库用户名", value = "数据库用户名")
|
||||
private String databaseUserName;
|
||||
|
||||
/** 数据库用户密码 */
|
||||
@Excel(name = "数据库用户密码")
|
||||
@ApiModelProperty(name = "数据库用户密码", value = "数据库用户密码")
|
||||
private String databaseUserPassword;
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
*/
|
||||
public static DataSource queryBuild( DataSourceQueryReq dataSourceQueryReq){
|
||||
return DataSource.builder()
|
||||
.accessSourceName(dataSourceQueryReq.getAccessSourceName())
|
||||
.dataSourceSystemName(dataSourceQueryReq.getDataSourceSystemName())
|
||||
.hostAddress(dataSourceQueryReq.getHostAddress())
|
||||
.hostPort(dataSourceQueryReq.getHostPort())
|
||||
.dataAccessTypeId(dataSourceQueryReq.getDataAccessTypeId())
|
||||
.databaseName(dataSourceQueryReq.getDatabaseName())
|
||||
.dataConnectionParameter(dataSourceQueryReq.getDataConnectionParameter())
|
||||
.initialQuantity(dataSourceQueryReq.getInitialQuantity())
|
||||
.maximumQuantity(dataSourceQueryReq.getMaximumQuantity())
|
||||
.maximumTime(dataSourceQueryReq.getMaximumTime())
|
||||
.maximumFrequency(dataSourceQueryReq.getMaximumFrequency())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static DataSource saveBuild(DataSourceSaveReq dataSourceSaveReq){
|
||||
return DataSource.builder()
|
||||
.accessSourceName(dataSourceSaveReq.getAccessSourceName())
|
||||
.dataSourceSystemName(dataSourceSaveReq.getDataSourceSystemName())
|
||||
.hostAddress(dataSourceSaveReq.getHostAddress())
|
||||
.hostPort(dataSourceSaveReq.getHostPort())
|
||||
.dataAccessTypeId(dataSourceSaveReq.getDataAccessTypeId())
|
||||
.databaseName(dataSourceSaveReq.getDatabaseName())
|
||||
.dataConnectionParameter(dataSourceSaveReq.getDataConnectionParameter())
|
||||
.initialQuantity(dataSourceSaveReq.getInitialQuantity())
|
||||
.maximumQuantity(dataSourceSaveReq.getMaximumQuantity())
|
||||
.maximumTime(dataSourceSaveReq.getMaximumTime())
|
||||
.maximumFrequency(dataSourceSaveReq.getMaximumFrequency())
|
||||
.databaseUserName(dataSourceSaveReq.getDatabaseUserName())
|
||||
.databaseUserPassword(dataSourceSaveReq.getDatabaseUserPassword())
|
||||
.remark(dataSourceSaveReq.getRemark())
|
||||
.createBy(SecurityUtils.getUsername())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static DataSource editBuild(Long id, DataSourceEditReq dataSourceEditReq){
|
||||
return DataSource.builder()
|
||||
.id(id)
|
||||
.accessSourceName(dataSourceEditReq.getAccessSourceName())
|
||||
.dataSourceSystemName(dataSourceEditReq.getDataSourceSystemName())
|
||||
.hostAddress(dataSourceEditReq.getHostAddress())
|
||||
.hostPort(dataSourceEditReq.getHostPort())
|
||||
.dataAccessTypeId(dataSourceEditReq.getDataAccessTypeId())
|
||||
.databaseName(dataSourceEditReq.getDatabaseName())
|
||||
.dataConnectionParameter(dataSourceEditReq.getDataConnectionParameter())
|
||||
.initialQuantity(dataSourceEditReq.getInitialQuantity())
|
||||
.maximumQuantity(dataSourceEditReq.getMaximumQuantity())
|
||||
.maximumTime(dataSourceEditReq.getMaximumTime())
|
||||
.maximumFrequency(dataSourceEditReq.getMaximumFrequency())
|
||||
.databaseUserName(dataSourceEditReq.getDatabaseUserName())
|
||||
.databaseUserPassword(dataSourceEditReq.getDatabaseUserPassword())
|
||||
.updateBy(SecurityUtils.getUsername())
|
||||
.updateTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.muyu.system.domain.resp.AsUserDeptNumResponse;
|
||||
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.system.service.IAsUserDeptService;
|
||||
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 muyu
|
||||
* @date 2024-04-14
|
||||
*/
|
||||
@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.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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据通知公告编号获取详细信息
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 as_user_dept
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-14
|
||||
*/
|
||||
public class AsUserDept extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "用户ID", readConverterExp = "$column.readConverterExp()")
|
||||
private Long userId;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "公告ID", readConverterExp = "$column.readConverterExp()")
|
||||
private Long noticeId;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "是否已读", readConverterExp = "$column.readConverterExp()")
|
||||
private String isRead;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setNoticeId(Long noticeId)
|
||||
{
|
||||
this.noticeId = noticeId;
|
||||
}
|
||||
|
||||
public Long getNoticeId()
|
||||
{
|
||||
return noticeId;
|
||||
}
|
||||
public void setIsRead(String isRead)
|
||||
{
|
||||
this.isRead = isRead;
|
||||
}
|
||||
|
||||
public String getIsRead()
|
||||
{
|
||||
return isRead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("userId", getUserId())
|
||||
.append("noticeId", getNoticeId())
|
||||
.append("isRead", getIsRead())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通知公告表 sys_notice
|
||||
|
@ -51,6 +52,16 @@ public class SysNotice extends BaseEntity {
|
|||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 部门id集合
|
||||
*/
|
||||
private List<List<Long>> sectionList;
|
||||
|
||||
/**
|
||||
* 用户ID集合
|
||||
*/
|
||||
private List<Long> personneList;
|
||||
|
||||
public Long getNoticeId () {
|
||||
return noticeId;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package com.muyu.system.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* SysNoticeRequest
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/14
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
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.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* AsUserDeotNumResponse
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/14
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AsUserDeptNumResponse {
|
||||
private Long num;
|
||||
|
||||
private Long readNum;
|
||||
|
||||
private Long noReadNum;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.system.domain.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* SysNoticeResponse
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/14
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@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 id;
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.system.domain.AsUserDept;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-14
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param asUserDept 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAsUserDept(AsUserDept asUserDept);
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsUserDeptById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsUserDeptByIds(Long[] ids);
|
||||
|
||||
Long selectAsUserDeptReadNum(@Param("noticeId") Long noticeId);
|
||||
|
||||
Long selectAsUserDeptNum(@Param("noticeId") Long noticeId);
|
||||
|
||||
void updateAsUserDeptRead(@Param("id") Long id);
|
||||
|
||||
void insertBachAsUserDept(@Param("asUserDepts") List<AsUserDept> asUserDepts);
|
||||
|
||||
}
|
|
@ -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,9 @@ public interface SysNoticeMapper extends BaseMapper<SysNotice> {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeByIds (Long[] noticeIds);
|
||||
|
||||
List<SysNoticeResponse> getNoticeList(SysNoticeRequest sysNoticeRequest);
|
||||
|
||||
List<Long> selectUser();
|
||||
|
||||
}
|
||||
|
|
|
@ -140,4 +140,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
*/
|
||||
public SysUser checkEmailUnique (String email);
|
||||
|
||||
List<Long> selectDeptUser(@Param("sectionIds") List<Long> sectionIds);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
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 muyu
|
||||
* @date 2024-04-14
|
||||
*/
|
||||
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;
|
||||
|
||||
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,119 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.system.domain.resp.AsUserDeptNumResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.system.mapper.AsUserDeptMapper;
|
||||
import com.muyu.system.domain.AsUserDept;
|
||||
import com.muyu.system.service.IAsUserDeptService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-14
|
||||
*/
|
||||
@Service
|
||||
public class AsUserDeptServiceImpl implements IAsUserDeptService
|
||||
{
|
||||
@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<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());
|
||||
}
|
||||
}
|
|
@ -80,8 +80,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
// 管理员显示所有菜单信息
|
||||
if (SysUser.isAdmin(userId)) {
|
||||
menuList = menuMapper.selectMenuList(menu);
|
||||
// menuList.addAll(selectSysMenuList(menuList));
|
||||
List<SysMenu> sysMenus1 = selectSysMenuList(menuList);
|
||||
List<SysMenu> sysMenus1 = selectSysChdMenuList(menuList);
|
||||
if (sysMenus1!=null&& sysMenus1.size()!=0){
|
||||
menuList.addAll(sysMenus1);
|
||||
|
||||
|
@ -107,7 +106,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
System.out.println(list);
|
||||
List<SysMenu> sysMenus = menuMapper.selectSysChdMenuList(list);
|
||||
if (sysMenus!=null&&sysMenus.size()!=0){
|
||||
List<SysMenu> sysMenus1 = selectSysMenuList(sysMenus);
|
||||
List<SysMenu> sysMenus1 = selectSysChdMenuList(sysMenus);
|
||||
if (sysMenus1!=null){
|
||||
sysMenus.addAll(sysMenus1);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,24 @@
|
|||
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.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 org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 公告 服务层实现
|
||||
|
@ -19,6 +30,12 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
@Autowired
|
||||
private SysNoticeMapper noticeMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Autowired
|
||||
private AsUserDeptMapper asUserDeptMapper;
|
||||
|
||||
/**
|
||||
* 查询公告信息
|
||||
*
|
||||
|
@ -51,8 +68,29 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
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> personneList = notice.getPersonneList();
|
||||
List<List<Long>> sectionList = notice.getSectionList();
|
||||
List<AsUserDept> asUserDepts = handleList(personneList, sectionList, noticeId);
|
||||
asUserDeptMapper.insertBachAsUserDept(asUserDepts);
|
||||
} else {
|
||||
List<Long> userIds = noticeMapper.selectUser();
|
||||
List<AsUserDept> asUserDeptList = userIds.stream()
|
||||
.map(id -> {
|
||||
AsUserDept asUserDept = new AsUserDept();
|
||||
asUserDept.setUserId(id);
|
||||
asUserDept.setNoticeId(notice.getNoticeId());
|
||||
asUserDept.setCreateTime(new Date());
|
||||
asUserDept.setCreateBy(SecurityUtils.getUsername());
|
||||
return asUserDept;
|
||||
}).toList();
|
||||
asUserDeptMapper.insertBachAsUserDept(asUserDeptList);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,4 +128,44 @@ 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);
|
||||
}
|
||||
|
||||
public List<AsUserDept> handleList(List<Long> personneList,List<List<Long>> sectionList,Long noticeId){
|
||||
List<Long> list = new ArrayList<>();
|
||||
if (sectionList!=null&§ionList.size()!=0){
|
||||
sectionList.stream()
|
||||
.map(
|
||||
section->{
|
||||
for (Long aLong : section) {
|
||||
list.add(aLong);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
).collect(Collectors.toList());
|
||||
List<Long> sectionIds = list.stream().distinct().toList();
|
||||
List<Long> userIds = sysUserMapper.selectDeptUser(sectionIds);
|
||||
if (userIds!=null){
|
||||
personneList.addAll(userIds);
|
||||
}
|
||||
}
|
||||
personneList=personneList.stream().distinct().toList();
|
||||
List<AsUserDept> asUserDeptList = personneList.stream()
|
||||
.map(personne -> {
|
||||
AsUserDept asUserDept = new AsUserDept();
|
||||
asUserDept.setUserId(personne);
|
||||
asUserDept.setNoticeId(noticeId);
|
||||
asUserDept.setCreateTime(new Date());
|
||||
asUserDept.setCreateBy(SecurityUtils.getUsername());
|
||||
return asUserDept;
|
||||
}).toList();
|
||||
return asUserDeptList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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="selectAsUserDeptReadNum" resultType="java.lang.Long">
|
||||
select count(*) from as_user_dept where notice_id=#{noticeId} and is_read = '0'
|
||||
</select>
|
||||
<select id="selectAsUserDeptNum" resultType="java.lang.Long">
|
||||
select count(*) from as_user_dept where notice_id=#{noticeId}
|
||||
</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,22 @@
|
|||
</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>
|
||||
<select id="selectUser" resultType="java.lang.Long">
|
||||
select user_id from sys_user
|
||||
</select>
|
||||
|
||||
<insert id="insertNotice" parameterType="com.muyu.system.domain.SysNotice">
|
||||
<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>
|
||||
|
|
|
@ -183,6 +183,13 @@
|
|||
and del_flag = '0'
|
||||
limit 1
|
||||
</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">
|
||||
|
|
Loading…
Reference in New Issue