分享
This commit is contained in:
+120
@@ -0,0 +1,120 @@
|
||||
package com.jero.modules.personal.controller;
|
||||
|
||||
import java.util.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.personal.entity.LawsStandardSharing;
|
||||
import com.jero.modules.personal.service.ILawsStandardSharingService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 标准分享
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-09-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="标准分享")
|
||||
@RestController
|
||||
@RequestMapping("/personal/lawsStandardSharing")
|
||||
@Slf4j
|
||||
public class LawsStandardSharingController extends JeroController<LawsStandardSharing, ILawsStandardSharingService> {
|
||||
@Autowired
|
||||
private ILawsStandardSharingService lawsStandardSharingService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*/
|
||||
@AutoLog(value = "标准分享-分页已发分享列表查询")
|
||||
@ApiOperation(value="标准分享-分页已发分享列表查询", notes="标准分享-分页已发分享列表查询")
|
||||
@GetMapping(value = "/issued/page")
|
||||
public Result<IPage<LawsStandardSharing>> issued(LawsStandardSharing lawsStandardSharing,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
lawsStandardSharing.setSharerId(sysUser.getId());
|
||||
lawsStandardSharing.setDelFlag("0");
|
||||
IPage<LawsStandardSharing> pageList = lawsStandardSharingService.queryPage(lawsStandardSharing, pageNo, pageSize, req);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*/
|
||||
@AutoLog(value = "标准分享-分页已收分享列表查询")
|
||||
@ApiOperation(value="标准分享-分页已收分享列表查询", notes="标准分享-分页已收分享列表查询")
|
||||
@GetMapping(value = "/received/page")
|
||||
public Result<IPage<LawsStandardSharing>> received(LawsStandardSharing lawsStandardSharing,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
lawsStandardSharing.setRecipientId(sysUser.getId());
|
||||
lawsStandardSharing.setDelFlag("0");
|
||||
IPage<LawsStandardSharing> pageList = lawsStandardSharingService.queryPage(lawsStandardSharing, pageNo, pageSize, req);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@AutoLog(value = "标准分享-分享")
|
||||
@ApiOperation(value="标准分享-分享", notes="标准分享-分享")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@Validated @RequestBody LawsStandardSharing lawsStandardSharing) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String recipientId = lawsStandardSharing.getRecipientId();
|
||||
String recipientName = lawsStandardSharing.getRecipientName();
|
||||
Date date = new Date();
|
||||
List<LawsStandardSharing> sharings = new ArrayList<>();
|
||||
List<String> recipientIdList = Arrays.asList(recipientId.split(","));
|
||||
List<String> recipientNameList = Arrays.asList(recipientName.split(","));
|
||||
for (int i = 0; i < recipientIdList.size(); i++) {
|
||||
LawsStandardSharing sharing = new LawsStandardSharing();
|
||||
sharing.setSource(lawsStandardSharing.getSource());
|
||||
sharing.setStandardId(lawsStandardSharing.getStandardId());
|
||||
sharing.setStandardName(lawsStandardSharing.getStandardName());
|
||||
sharing.setStandardNum(lawsStandardSharing.getStandardNum());
|
||||
sharing.setSharerId(sysUser.getId());
|
||||
sharing.setSharerName(lawsStandardSharing.getSharerName());
|
||||
sharing.setRecipientId(recipientIdList.get(i));
|
||||
sharing.setRecipientName(recipientNameList.get(i));
|
||||
sharing.setSharingTime(date);
|
||||
sharing.setShareDescription(lawsStandardSharing.getShareDescription());
|
||||
sharing.setReadingStatus("1");
|
||||
sharing.setDelFlag("0");
|
||||
sharings.add(sharing);
|
||||
}
|
||||
lawsStandardSharingService.saveBatch(sharings);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@AutoLog(value = "标准分享-批量删除")
|
||||
@ApiOperation(value="标准分享-批量删除", notes="标准分享-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){
|
||||
return Result.error("请选择数据!");
|
||||
}
|
||||
this.lawsStandardSharingService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.jero.modules.personal.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 标准分享
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-09-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("laws_standard_sharing")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="laws_standard_sharing对象", description="标准分享")
|
||||
public class LawsStandardSharing implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**分享标准来源、所属板块(1国内、2海外、3企标)*/
|
||||
@ApiModelProperty(value = "分享标准来源、所属板块(1国内、2海外、3企标)")
|
||||
@NotBlank(message = "source所属板块(1国内、2海外、3企标)不能为空")
|
||||
private String source;
|
||||
|
||||
/**标准ID*/
|
||||
@ApiModelProperty(value = "标准ID")
|
||||
@NotBlank(message = "standardId标准ID不能为空")
|
||||
private String standardId;
|
||||
|
||||
/**标准编号*/
|
||||
@ApiModelProperty(value = "标准编号")
|
||||
@NotBlank(message = "standardNum标准编号不能为空")
|
||||
private String standardNum;
|
||||
|
||||
/**标准名称*/
|
||||
@ApiModelProperty(value = "标准名称")
|
||||
@NotBlank(message = "standardName标准名称不能为空")
|
||||
private String standardName;
|
||||
|
||||
/**分享人ID*/
|
||||
@ApiModelProperty(value = "分享人ID")
|
||||
private String sharerId;
|
||||
|
||||
/**分享人姓名*/
|
||||
@ApiModelProperty(value = "分享人姓名")
|
||||
private String sharerName;
|
||||
|
||||
/**接收人ID*/
|
||||
@ApiModelProperty(value = "接收人ID(分享多人时id逗号分隔)")
|
||||
@NotBlank(message = "recipientId接收人ID不能为空")
|
||||
private String recipientId;
|
||||
|
||||
/**接收人姓名*/
|
||||
@ApiModelProperty(value = "接收人姓名")
|
||||
@NotBlank(message = "recipientName接收人姓名不能为空")
|
||||
private String recipientName;
|
||||
|
||||
/**分享时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "分享时间")
|
||||
private Date sharingTime;
|
||||
|
||||
/**分享说明*/
|
||||
@ApiModelProperty(value = "分享说明")
|
||||
private String shareDescription;
|
||||
|
||||
/**阅读状态(1未读、2已读)*/
|
||||
@ApiModelProperty(value = "阅读状态(1未读、2已读)")
|
||||
private String readingStatus;
|
||||
|
||||
/**已读时间*/
|
||||
@ApiModelProperty(value = "已读时间")
|
||||
private String readTime;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String orgCode;
|
||||
|
||||
|
||||
/**删除状态(0-正常,1-删除)*/
|
||||
@ApiModelProperty(value = "删除状态(0-正常,1-删除)")
|
||||
private String delFlag;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.personal.mapper;
|
||||
|
||||
import com.jero.modules.personal.entity.LawsStandardSharing;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 标准分享
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-09-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface LawsStandardSharingMapper extends BaseMapper<LawsStandardSharing> {
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<?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.jero.modules.personal.mapper.LawsStandardSharingMapper">
|
||||
<resultMap id="LawsStandardSharingResultMap" type="com.jero.modules.personal.entity.LawsStandardSharing">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="org_code" property="orgCode" />
|
||||
<result column="source" property="source" />
|
||||
<result column="standard_id" property="standardId" />
|
||||
<result column="standard_num" property="standardNum" />
|
||||
<result column="standard_name" property="standardName" />
|
||||
<result column="sharer_id" property="sharerId" />
|
||||
<result column="sharer_name" property="sharerName" />
|
||||
<result column="recipient_id" property="recipientId" />
|
||||
<result column="recipient_name" property="recipientName" />
|
||||
<result column="sharing_time" property="sharingTime" />
|
||||
<result column="share_description" property="shareDescription" />
|
||||
<result column="reading_status" property="readingStatus" />
|
||||
<result column="read_time" property="readTime" />
|
||||
<result column="del_flag" property="delFlag" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.jero.modules.personal.service;
|
||||
|
||||
import com.jero.modules.personal.entity.LawsStandardSharing;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 标准分享
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-09-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ILawsStandardSharingService extends IService<LawsStandardSharing> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param lawsStandardSharing
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
IPage<LawsStandardSharing> queryPage(LawsStandardSharing lawsStandardSharing, Integer pageNo, Integer pageSize, HttpServletRequest req);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @param lawsStandardSharing
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
List<LawsStandardSharing> queryList(LawsStandardSharing lawsStandardSharing, HttpServletRequest req);
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param lawsStandardSharing
|
||||
* @return
|
||||
*/
|
||||
void add(LawsStandardSharing lawsStandardSharing);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param lawsStandardSharing
|
||||
* @return
|
||||
*/
|
||||
void editById(LawsStandardSharing lawsStandardSharing);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
LawsStandardSharing queryById(String id);
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
package com.jero.modules.personal.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.jero.modules.personal.entity.LawsStandardSharing;
|
||||
import com.jero.modules.personal.mapper.LawsStandardSharingMapper;
|
||||
import com.jero.modules.personal.service.ILawsStandardSharingService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 标准分享
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-09-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = JeroBootException.class)
|
||||
public class LawsStandardSharingServiceImpl extends ServiceImpl<LawsStandardSharingMapper, LawsStandardSharing> implements ILawsStandardSharingService {
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param lawsStandardSharing
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<LawsStandardSharing> queryPage(LawsStandardSharing lawsStandardSharing, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<LawsStandardSharing> queryWrapper = QueryGenerator.initQueryWrapper(lawsStandardSharing, req.getParameterMap());
|
||||
Page<LawsStandardSharing> page = new Page<>(pageNo, pageSize);
|
||||
return page(page, queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @param lawsStandardSharing
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<LawsStandardSharing> queryList(LawsStandardSharing lawsStandardSharing, HttpServletRequest req) {
|
||||
return list(QueryGenerator.initQueryWrapper(lawsStandardSharing, req.getParameterMap()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param lawsStandardSharing
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(LawsStandardSharing lawsStandardSharing) {
|
||||
Date now = new Date();
|
||||
lawsStandardSharing.setCreateTime(now);
|
||||
lawsStandardSharing.setUpdateTime(now);
|
||||
save(lawsStandardSharing);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param lawsStandardSharing
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(LawsStandardSharing lawsStandardSharing) {
|
||||
Date now = new Date();
|
||||
lawsStandardSharing.setUpdateTime(now);
|
||||
saveOrUpdate(lawsStandardSharing);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public LawsStandardSharing queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user