add 功能安全中心和项目组的查询、修改、导出接口增加项目类型区分
This commit is contained in:
+9
-1
@@ -5,8 +5,16 @@ package com.jero.functionalsafetycenter.common;
|
||||
* @date 2024-06-25 10:10
|
||||
*/
|
||||
public class SafetyCenterCommon {
|
||||
|
||||
/**
|
||||
* 安全中心
|
||||
*/
|
||||
public static final int PROJECT_TYPE_1 = 1;
|
||||
/**
|
||||
* 研究组
|
||||
*/
|
||||
public static final int PROJECT_TYPE_2 = 2;
|
||||
/**
|
||||
* 项目组
|
||||
*/
|
||||
public static final int PROJECT_TYPE_3 = 3;
|
||||
}
|
||||
|
||||
+109
-8
@@ -1,5 +1,7 @@
|
||||
package com.jero.functionalsafetycenter.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -9,8 +11,12 @@ import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.functionalsafetycenter.common.SafetyCenterCommon;
|
||||
import com.jero.functionalsafetycenter.entity.SafetyCenter;
|
||||
import com.jero.functionalsafetycenter.service.SafetyCenterService;
|
||||
import com.jero.functionalsafetycenter.vo.SafetyCenterEditVO;
|
||||
import com.jero.member.entity.TbMemberProjectFile;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -21,8 +27,10 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 功能安全中心(pay_functional_safety_center)表控制层
|
||||
@@ -50,6 +58,28 @@ public class SafetyCenterController extends JeroController<SafetyCenter, SafetyC
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SafetyCenter> queryWrapper = QueryGenerator.initQueryWrapper(safetyCenter, req.getParameterMap());
|
||||
//只查询安全中心和研究组
|
||||
ArrayList<Object> objects = new ArrayList<>();
|
||||
objects.add(SafetyCenterCommon.PROJECT_TYPE_1);
|
||||
objects.add(SafetyCenterCommon.PROJECT_TYPE_2);
|
||||
queryWrapper.lambda().in(SafetyCenter::getProjectType,objects);
|
||||
Page<SafetyCenter> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SafetyCenter> pageList = safetyCenterService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*/
|
||||
@ApiOperation(value = "功能安全中心-项目组分页列表查询", notes = "功能安全中心-分页列表查询")
|
||||
@GetMapping(value = "/projectGroupPage")
|
||||
public Result<IPage<SafetyCenter>> queryProjectGroupPageList(SafetyCenter safetyCenter,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SafetyCenter> queryWrapper = QueryGenerator.initQueryWrapper(safetyCenter, req.getParameterMap());
|
||||
//只查询项目组
|
||||
queryWrapper.lambda().eq(SafetyCenter::getProjectType,SafetyCenterCommon.PROJECT_TYPE_3);
|
||||
Page<SafetyCenter> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SafetyCenter> pageList = safetyCenterService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
@@ -70,10 +100,23 @@ public class SafetyCenterController extends JeroController<SafetyCenter, SafetyC
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@AutoLog(value = "功能安全中心-添加")
|
||||
@ApiOperation(value = "功能安全中心-添加", notes = "功能安全中心-添加")
|
||||
@AutoLog(value = "功能安全中心-添加研究组")
|
||||
@ApiOperation(value = "功能安全中心-添加研究组", notes = "功能安全中心-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@Validated @RequestBody SafetyCenter safetyCenter) {
|
||||
safetyCenter.setProjectType(SafetyCenterCommon.PROJECT_TYPE_2);
|
||||
safetyCenterService.add(safetyCenter);
|
||||
return Result.OK(Result.ADD_SUCCESS);
|
||||
}
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@AutoLog(value = "功能安全中心-添加项目组")
|
||||
@ApiOperation(value = "功能安全中心-添加项目组", notes = "功能安全中心-添加项目组")
|
||||
@PostMapping(value = "/addProjectGroup")
|
||||
public Result<String> addProjectGroup(@Validated @RequestBody SafetyCenter safetyCenter) {
|
||||
safetyCenter.setProjectType(SafetyCenterCommon.PROJECT_TYPE_3);
|
||||
|
||||
safetyCenterService.add(safetyCenter);
|
||||
return Result.OK(Result.ADD_SUCCESS);
|
||||
}
|
||||
@@ -81,10 +124,20 @@ public class SafetyCenterController extends JeroController<SafetyCenter, SafetyC
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
@AutoLog(value = "功能安全中心-编辑")
|
||||
@ApiOperation(value = "功能安全中心-编辑", notes = "功能安全中心-编辑")
|
||||
@AutoLog(value = "功能安全中心-编辑研究组")
|
||||
@ApiOperation(value = "功能安全中心-编辑研究组", notes = "功能安全中心-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<String> edit(@Validated @RequestBody SafetyCenter safetyCenter) {
|
||||
public Result<String> edit(@Validated @RequestBody SafetyCenterEditVO safetyCenter) {
|
||||
safetyCenterService.editById(safetyCenter);
|
||||
return Result.OK(Result.EDIT_SUCCESS);
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
@AutoLog(value = "功能安全中心-编辑项目组")
|
||||
@ApiOperation(value = "功能安全中心-编辑项目组", notes = "功能安全中心-编辑")
|
||||
@PostMapping(value = "/editProjectGroup")
|
||||
public Result<String> editProjectGroup(@Validated @RequestBody SafetyCenterEditVO safetyCenter) {
|
||||
safetyCenterService.editById(safetyCenter);
|
||||
return Result.OK(Result.EDIT_SUCCESS);
|
||||
}
|
||||
@@ -140,10 +193,58 @@ public class SafetyCenterController extends JeroController<SafetyCenter, SafetyC
|
||||
@ApiOperation(value = "功能安全中心-导出excel")
|
||||
@GetMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SafetyCenter safetyCenter) {
|
||||
return super.exportXls(request, safetyCenter, SafetyCenter.class, "功能安全中心");
|
||||
QueryWrapper<SafetyCenter> queryWrapper = QueryGenerator.initQueryWrapper(safetyCenter, request.getParameterMap());
|
||||
//只查询安全中心和研究组
|
||||
ArrayList<Object> objects = new ArrayList<>();
|
||||
objects.add(SafetyCenterCommon.PROJECT_TYPE_1);
|
||||
objects.add(SafetyCenterCommon.PROJECT_TYPE_2);
|
||||
queryWrapper.lambda().in(SafetyCenter::getProjectType,objects);
|
||||
Page<SafetyCenter> page = new Page<>(-1, -1);
|
||||
IPage<SafetyCenter> pageList = safetyCenterService.page(page, queryWrapper);
|
||||
List<SafetyCenter> records = pageList.getRecords();
|
||||
List<SafetyCenter> exportList;
|
||||
// 过滤选中数据
|
||||
String selections = request.getParameter("selections");
|
||||
if (oConvertUtils.isNotEmpty(selections)) {
|
||||
List<String> selectionList = Arrays.asList(selections.split(","));
|
||||
exportList = records.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
|
||||
}else {
|
||||
exportList = records;
|
||||
}
|
||||
if (exportList.isEmpty()) {
|
||||
throw new JeroBootException("没有数据");
|
||||
}
|
||||
|
||||
return super.exportListXls(exportList, SafetyCenter.class, "功能安全中心");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*/
|
||||
@ApiOperation(value = "功能安全中心-导出项目组excel")
|
||||
@GetMapping(value = "/exportProjectGroupXls")
|
||||
public ModelAndView exportProjectGroupXls(HttpServletRequest request, SafetyCenter safetyCenter) {
|
||||
QueryWrapper<SafetyCenter> queryWrapper = QueryGenerator.initQueryWrapper(safetyCenter, request.getParameterMap());
|
||||
//只查询项目组
|
||||
queryWrapper.lambda().eq(SafetyCenter::getProjectType,SafetyCenterCommon.PROJECT_TYPE_3);
|
||||
Page<SafetyCenter> page = new Page<>(-1, -1);
|
||||
IPage<SafetyCenter> pageList = safetyCenterService.page(page, queryWrapper);
|
||||
List<SafetyCenter> records = pageList.getRecords();
|
||||
List<SafetyCenter> exportList;
|
||||
// 过滤选中数据
|
||||
String selections = request.getParameter("selections");
|
||||
if (oConvertUtils.isNotEmpty(selections)) {
|
||||
List<String> selectionList = Arrays.asList(selections.split(","));
|
||||
exportList = records.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
|
||||
}else {
|
||||
exportList = records;
|
||||
}
|
||||
if (exportList.isEmpty()) {
|
||||
throw new JeroBootException("没有数据");
|
||||
}
|
||||
|
||||
return super.exportListXls(exportList, SafetyCenter.class, "功能安全中心");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-4
@@ -10,13 +10,10 @@ import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
*功能安全中心
|
||||
*@author liJiaRao
|
||||
*@date 2024-06-12 15:13
|
||||
*/
|
||||
/**
|
||||
* 功能安全中心
|
||||
*/
|
||||
@ApiModel(description="功能安全中心")
|
||||
@Data
|
||||
@TableName(value = "pay_functional_safety_center")
|
||||
|
||||
+1
-5
@@ -10,14 +10,10 @@ import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
*功能安全中心成员
|
||||
*@author liJiaRao
|
||||
*@date 2024-06-12 16:40
|
||||
*/
|
||||
|
||||
/**
|
||||
* 功能安全中心成员
|
||||
*/
|
||||
@ApiModel(description = "功能安全中心成员")
|
||||
@Data
|
||||
@TableName(value = "pay_functional_safety_center_subitem")
|
||||
|
||||
+1
-4
@@ -10,13 +10,10 @@ import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
*功能安全中心成员-联系人
|
||||
*@author liJiaRao
|
||||
*@date 2024-06-12 15:13
|
||||
*/
|
||||
/**
|
||||
* 功能安全中心成员-联系人
|
||||
*/
|
||||
@ApiModel(description="功能安全中心成员-联系人")
|
||||
@Data
|
||||
@TableName(value = "pay_functional_safety_center_subitem_contacts")
|
||||
|
||||
+9
-1
@@ -2,6 +2,8 @@ package com.jero.functionalsafetycenter.service;
|
||||
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.functionalsafetycenter.common.SafetyCenterCommon;
|
||||
import com.jero.functionalsafetycenter.vo.SafetyCenterEditVO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -23,7 +25,13 @@ public class SafetyCenterService extends ServiceImpl<SafetyCenterMapper, SafetyC
|
||||
this.save(safetyCenter);
|
||||
}
|
||||
|
||||
public void editById(SafetyCenter safetyCenter) {
|
||||
public void editById(SafetyCenterEditVO safetyCenterEditVO) {
|
||||
SafetyCenter safetyCenter = new SafetyCenter();
|
||||
safetyCenter.setId(safetyCenterEditVO.getId());
|
||||
safetyCenter.setProjectName(safetyCenterEditVO.getProjectName());
|
||||
safetyCenter.setPrincipalId(safetyCenterEditVO.getPrincipalId());
|
||||
safetyCenter.setMissionAndObjectives(safetyCenterEditVO.getMissionAndObjectives());
|
||||
safetyCenter.setRemarks(safetyCenterEditVO.getRemarks());
|
||||
this.updateById(safetyCenter);
|
||||
}
|
||||
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.jero.functionalsafetycenter.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*功能安全中心
|
||||
*@author liJiaRao
|
||||
*@date 2024-06-12 15:13
|
||||
*/
|
||||
@ApiModel(description="功能安全中心编辑vo")
|
||||
@Data
|
||||
public class SafetyCenterEditVO {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ApiModelProperty(value="id")
|
||||
private String id;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@TableField(value = "project_name")
|
||||
@ApiModelProperty(value="项目名称")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 负责人id
|
||||
*/
|
||||
@TableField(value = "principal_id")
|
||||
@ApiModelProperty(value="负责人id")
|
||||
private String principalId;
|
||||
|
||||
/**
|
||||
* 任务及目标
|
||||
*/
|
||||
@TableField(value = "mission_and_objectives")
|
||||
@ApiModelProperty(value="任务及目标")
|
||||
private String missionAndObjectives;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField(value = "remarks")
|
||||
@ApiModelProperty(value="备注")
|
||||
private String remarks;
|
||||
}
|
||||
Reference in New Issue
Block a user