update
This commit is contained in:
@@ -1,41 +1,30 @@
|
|||||||
package org.jeecg.modules.database.controller;
|
package org.jeecg.modules.database.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
|
||||||
import org.jeecg.modules.database.entity.Experiment;
|
|
||||||
import org.jeecg.modules.database.service.IExperimentService;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
||||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
|
import org.jeecg.modules.database.entity.Experiment;
|
||||||
|
import org.jeecg.modules.database.entity.ExperimentLog;
|
||||||
|
import org.jeecg.modules.database.service.IExperimentLogService;
|
||||||
|
import org.jeecg.modules.database.service.IExperimentService;
|
||||||
|
import org.jeecg.modules.system.entity.SysUser;
|
||||||
|
import org.jeecg.modules.system.service.ISysUserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 试验管理
|
* @Description: 试验管理
|
||||||
@@ -50,6 +39,10 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||||||
public class ExperimentController extends JeecgController<Experiment, IExperimentService> {
|
public class ExperimentController extends JeecgController<Experiment, IExperimentService> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExperimentService experimentService;
|
private IExperimentService experimentService;
|
||||||
|
@Autowired
|
||||||
|
private IExperimentLogService experimentLogService;
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
@@ -83,8 +76,15 @@ public class ExperimentController extends JeecgController<Experiment, IExperimen
|
|||||||
@Operation(summary = "试验管理-添加")
|
@Operation(summary = "试验管理-添加")
|
||||||
@RequiresPermissions("database:experiment:add")
|
@RequiresPermissions("database:experiment:add")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<String> add(@RequestBody Experiment experiment) {
|
public Result<String> add(@RequestBody Experiment experiment, HttpServletRequest request) {
|
||||||
experimentService.save(experiment);
|
experimentService.save(experiment);
|
||||||
|
ExperimentLog experimentLog = new ExperimentLog();
|
||||||
|
experimentLog.setExperimentId(experiment.getId());
|
||||||
|
experimentLog.setLogContent("新建实验");
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
SysUser userByName = userService.getUserByName(username);
|
||||||
|
experimentLog.setCreateBy(userByName.getRealname());
|
||||||
|
experimentLogService.save(experimentLog);
|
||||||
return Result.OK("添加成功!");
|
return Result.OK("添加成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,8 +98,15 @@ public class ExperimentController extends JeecgController<Experiment, IExperimen
|
|||||||
@Operation(summary = "试验管理-编辑")
|
@Operation(summary = "试验管理-编辑")
|
||||||
@RequiresPermissions("database:experiment:edit")
|
@RequiresPermissions("database:experiment:edit")
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
public Result<String> edit(@RequestBody Experiment experiment) {
|
public Result<String> edit(@RequestBody Experiment experiment, HttpServletRequest request) {
|
||||||
experimentService.updateById(experiment);
|
experimentService.updateById(experiment);
|
||||||
|
ExperimentLog experimentLog = new ExperimentLog();
|
||||||
|
experimentLog.setExperimentId(experiment.getId());
|
||||||
|
experimentLog.setLogContent("修改实验信息");
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
SysUser userByName = userService.getUserByName(username);
|
||||||
|
experimentLog.setCreateBy(userByName.getRealname());
|
||||||
|
experimentLogService.save(experimentLog);
|
||||||
return Result.OK("编辑成功!");
|
return Result.OK("编辑成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +1,30 @@
|
|||||||
package org.jeecg.modules.database.controller;
|
package org.jeecg.modules.database.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
|
||||||
import org.jeecg.modules.database.entity.ExperimentRadiationProcess;
|
|
||||||
import org.jeecg.modules.database.service.IExperimentRadiationProcessService;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
||||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
|
import org.jeecg.modules.database.entity.ExperimentLog;
|
||||||
|
import org.jeecg.modules.database.entity.ExperimentRadiationProcess;
|
||||||
|
import org.jeecg.modules.database.service.IExperimentLogService;
|
||||||
|
import org.jeecg.modules.database.service.IExperimentRadiationProcessService;
|
||||||
|
import org.jeecg.modules.system.entity.SysUser;
|
||||||
|
import org.jeecg.modules.system.service.ISysUserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 辐照过程
|
* @Description: 辐照过程
|
||||||
@@ -51,6 +40,11 @@ public class ExperimentRadiationProcessController extends JeecgController<Experi
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IExperimentRadiationProcessService experimentRadiationProcessService;
|
private IExperimentRadiationProcessService experimentRadiationProcessService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExperimentLogService experimentLogService;
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
*
|
*
|
||||||
@@ -83,8 +77,16 @@ public class ExperimentRadiationProcessController extends JeecgController<Experi
|
|||||||
@Operation(summary = "辐照过程-添加")
|
@Operation(summary = "辐照过程-添加")
|
||||||
@RequiresPermissions("database:experiment_radiation_process:add")
|
@RequiresPermissions("database:experiment_radiation_process:add")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<String> add(@RequestBody ExperimentRadiationProcess experimentRadiationProcess) {
|
public Result<String> add(@RequestBody ExperimentRadiationProcess experimentRadiationProcess, HttpServletRequest request) {
|
||||||
experimentRadiationProcessService.save(experimentRadiationProcess);
|
experimentRadiationProcessService.save(experimentRadiationProcess);
|
||||||
|
|
||||||
|
ExperimentLog experimentLog = new ExperimentLog();
|
||||||
|
experimentLog.setExperimentId(experimentRadiationProcess.getExperimentId());
|
||||||
|
experimentLog.setLogContent("添加辐照过程");
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
SysUser userByName = userService.getUserByName(username);
|
||||||
|
experimentLog.setCreateBy(userByName.getRealname());
|
||||||
|
experimentLogService.save(experimentLog);
|
||||||
return Result.OK("添加成功!");
|
return Result.OK("添加成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,8 +100,18 @@ public class ExperimentRadiationProcessController extends JeecgController<Experi
|
|||||||
@Operation(summary = "辐照过程-编辑")
|
@Operation(summary = "辐照过程-编辑")
|
||||||
@RequiresPermissions("database:experiment_radiation_process:edit")
|
@RequiresPermissions("database:experiment_radiation_process:edit")
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
public Result<String> edit(@RequestBody ExperimentRadiationProcess experimentRadiationProcess) {
|
public Result<String> edit(@RequestBody ExperimentRadiationProcess experimentRadiationProcess, HttpServletRequest request) {
|
||||||
experimentRadiationProcessService.updateById(experimentRadiationProcess);
|
experimentRadiationProcessService.updateById(experimentRadiationProcess);
|
||||||
|
ExperimentRadiationProcess byId = experimentRadiationProcessService.getById(experimentRadiationProcess.getId());
|
||||||
|
|
||||||
|
ExperimentLog experimentLog = new ExperimentLog();
|
||||||
|
experimentLog.setExperimentId(byId.getExperimentId());
|
||||||
|
experimentLog.setLogContent("添加辐照过程");
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
SysUser userByName = userService.getUserByName(username);
|
||||||
|
experimentLog.setCreateBy(userByName.getRealname());
|
||||||
|
experimentLogService.save(experimentLog);
|
||||||
|
|
||||||
return Result.OK("编辑成功!");
|
return Result.OK("编辑成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,8 +125,17 @@ public class ExperimentRadiationProcessController extends JeecgController<Experi
|
|||||||
@Operation(summary = "辐照过程-通过id删除")
|
@Operation(summary = "辐照过程-通过id删除")
|
||||||
@RequiresPermissions("database:experiment_radiation_process:delete")
|
@RequiresPermissions("database:experiment_radiation_process:delete")
|
||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id, HttpServletRequest request) {
|
||||||
experimentRadiationProcessService.removeById(id);
|
experimentRadiationProcessService.removeById(id);
|
||||||
|
ExperimentRadiationProcess byId = experimentRadiationProcessService.getById(id);
|
||||||
|
|
||||||
|
ExperimentLog experimentLog = new ExperimentLog();
|
||||||
|
experimentLog.setExperimentId(byId.getExperimentId());
|
||||||
|
experimentLog.setLogContent("删除辐照过程");
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
SysUser userByName = userService.getUserByName(username);
|
||||||
|
experimentLog.setCreateBy(userByName.getRealname());
|
||||||
|
experimentLogService.save(experimentLog);
|
||||||
return Result.OK("删除成功!");
|
return Result.OK("删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +1,30 @@
|
|||||||
package org.jeecg.modules.database.controller;
|
package org.jeecg.modules.database.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
|
||||||
import org.jeecg.modules.database.entity.ExperimentTestProcess;
|
|
||||||
import org.jeecg.modules.database.service.IExperimentTestProcessService;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
||||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
|
import org.jeecg.modules.database.entity.ExperimentLog;
|
||||||
|
import org.jeecg.modules.database.entity.ExperimentTestProcess;
|
||||||
|
import org.jeecg.modules.database.service.IExperimentLogService;
|
||||||
|
import org.jeecg.modules.database.service.IExperimentTestProcessService;
|
||||||
|
import org.jeecg.modules.system.entity.SysUser;
|
||||||
|
import org.jeecg.modules.system.service.ISysUserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 测试过程
|
* @Description: 测试过程
|
||||||
@@ -51,6 +40,11 @@ public class ExperimentTestProcessController extends JeecgController<ExperimentT
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IExperimentTestProcessService experimentTestProcessService;
|
private IExperimentTestProcessService experimentTestProcessService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExperimentLogService experimentLogService;
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
*
|
*
|
||||||
@@ -83,8 +77,16 @@ public class ExperimentTestProcessController extends JeecgController<ExperimentT
|
|||||||
@Operation(summary = "测试过程-添加")
|
@Operation(summary = "测试过程-添加")
|
||||||
@RequiresPermissions("database:experiment_test_process:add")
|
@RequiresPermissions("database:experiment_test_process:add")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<String> add(@RequestBody ExperimentTestProcess experimentTestProcess) {
|
public Result<String> add(@RequestBody ExperimentTestProcess experimentTestProcess, HttpServletRequest request) {
|
||||||
experimentTestProcessService.save(experimentTestProcess);
|
experimentTestProcessService.save(experimentTestProcess);
|
||||||
|
|
||||||
|
ExperimentLog experimentLog = new ExperimentLog();
|
||||||
|
experimentLog.setExperimentId(experimentTestProcess.getExperimentId());
|
||||||
|
experimentLog.setLogContent("添加测试过程");
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
SysUser userByName = userService.getUserByName(username);
|
||||||
|
experimentLog.setCreateBy(userByName.getRealname());
|
||||||
|
experimentLogService.save(experimentLog);
|
||||||
return Result.OK("添加成功!");
|
return Result.OK("添加成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,8 +100,17 @@ public class ExperimentTestProcessController extends JeecgController<ExperimentT
|
|||||||
@Operation(summary = "测试过程-编辑")
|
@Operation(summary = "测试过程-编辑")
|
||||||
@RequiresPermissions("database:experiment_test_process:edit")
|
@RequiresPermissions("database:experiment_test_process:edit")
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
public Result<String> edit(@RequestBody ExperimentTestProcess experimentTestProcess) {
|
public Result<String> edit(@RequestBody ExperimentTestProcess experimentTestProcess, HttpServletRequest request) {
|
||||||
experimentTestProcessService.updateById(experimentTestProcess);
|
experimentTestProcessService.updateById(experimentTestProcess);
|
||||||
|
ExperimentTestProcess byId = experimentTestProcessService.getById(experimentTestProcess.getId());
|
||||||
|
|
||||||
|
ExperimentLog experimentLog = new ExperimentLog();
|
||||||
|
experimentLog.setExperimentId(byId.getExperimentId());
|
||||||
|
experimentLog.setLogContent("编辑测试过程");
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
SysUser userByName = userService.getUserByName(username);
|
||||||
|
experimentLog.setCreateBy(userByName.getRealname());
|
||||||
|
experimentLogService.save(experimentLog);
|
||||||
return Result.OK("编辑成功!");
|
return Result.OK("编辑成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,8 +124,15 @@ public class ExperimentTestProcessController extends JeecgController<ExperimentT
|
|||||||
@Operation(summary = "测试过程-通过id删除")
|
@Operation(summary = "测试过程-通过id删除")
|
||||||
@RequiresPermissions("database:experiment_test_process:delete")
|
@RequiresPermissions("database:experiment_test_process:delete")
|
||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id, HttpServletRequest request) {
|
||||||
experimentTestProcessService.removeById(id);
|
experimentTestProcessService.removeById(id);
|
||||||
|
ExperimentLog experimentLog = new ExperimentLog();
|
||||||
|
experimentLog.setExperimentId(id);
|
||||||
|
experimentLog.setLogContent("删除测试过程");
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
SysUser userByName = userService.getUserByName(username);
|
||||||
|
experimentLog.setCreateBy(userByName.getRealname());
|
||||||
|
experimentLogService.save(experimentLog);
|
||||||
return Result.OK("删除成功!");
|
return Result.OK("删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +1,30 @@
|
|||||||
package org.jeecg.modules.database.controller;
|
package org.jeecg.modules.database.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
|
||||||
import org.jeecg.modules.database.entity.ExperimentUser;
|
|
||||||
import org.jeecg.modules.database.service.IExperimentUserService;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
||||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
|
import org.jeecg.modules.database.entity.ExperimentLog;
|
||||||
|
import org.jeecg.modules.database.entity.ExperimentUser;
|
||||||
|
import org.jeecg.modules.database.service.IExperimentLogService;
|
||||||
|
import org.jeecg.modules.database.service.IExperimentUserService;
|
||||||
|
import org.jeecg.modules.system.entity.SysUser;
|
||||||
|
import org.jeecg.modules.system.service.ISysUserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 试验人员
|
* @Description: 试验人员
|
||||||
@@ -51,6 +40,11 @@ public class ExperimentUserController extends JeecgController<ExperimentUser, IE
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IExperimentUserService experimentUserService;
|
private IExperimentUserService experimentUserService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExperimentLogService experimentLogService;
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
*
|
*
|
||||||
@@ -83,8 +77,15 @@ public class ExperimentUserController extends JeecgController<ExperimentUser, IE
|
|||||||
@Operation(summary = "试验人员-添加")
|
@Operation(summary = "试验人员-添加")
|
||||||
@RequiresPermissions("database:experiment_user:add")
|
@RequiresPermissions("database:experiment_user:add")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<String> add(@RequestBody ExperimentUser experimentUser) {
|
public Result<String> add(@RequestBody ExperimentUser experimentUser, HttpServletRequest request) {
|
||||||
experimentUserService.save(experimentUser);
|
experimentUserService.save(experimentUser);
|
||||||
|
ExperimentLog experimentLog = new ExperimentLog();
|
||||||
|
experimentLog.setExperimentId(experimentUser.getExperimentId());
|
||||||
|
experimentLog.setLogContent("添加试验人员");
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
SysUser userByName = userService.getUserByName(username);
|
||||||
|
experimentLog.setCreateBy(userByName.getRealname());
|
||||||
|
experimentLogService.save(experimentLog);
|
||||||
return Result.OK("添加成功!");
|
return Result.OK("添加成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,8 +99,17 @@ public class ExperimentUserController extends JeecgController<ExperimentUser, IE
|
|||||||
@Operation(summary = "试验人员-编辑")
|
@Operation(summary = "试验人员-编辑")
|
||||||
@RequiresPermissions("database:experiment_user:edit")
|
@RequiresPermissions("database:experiment_user:edit")
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
public Result<String> edit(@RequestBody ExperimentUser experimentUser) {
|
public Result<String> edit(@RequestBody ExperimentUser experimentUser, HttpServletRequest request) {
|
||||||
experimentUserService.updateById(experimentUser);
|
experimentUserService.updateById(experimentUser);
|
||||||
|
ExperimentUser byId = experimentUserService.getById(experimentUser.getId());
|
||||||
|
|
||||||
|
ExperimentLog experimentLog = new ExperimentLog();
|
||||||
|
experimentLog.setExperimentId(byId.getExperimentId());
|
||||||
|
experimentLog.setLogContent("编辑试验人员");
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
SysUser userByName = userService.getUserByName(username);
|
||||||
|
experimentLog.setCreateBy(userByName.getRealname());
|
||||||
|
experimentLogService.save(experimentLog);
|
||||||
return Result.OK("编辑成功!");
|
return Result.OK("编辑成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,8 +123,16 @@ public class ExperimentUserController extends JeecgController<ExperimentUser, IE
|
|||||||
@Operation(summary = "试验人员-通过id删除")
|
@Operation(summary = "试验人员-通过id删除")
|
||||||
@RequiresPermissions("database:experiment_user:delete")
|
@RequiresPermissions("database:experiment_user:delete")
|
||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id, HttpServletRequest request) {
|
||||||
experimentUserService.removeById(id);
|
experimentUserService.removeById(id);
|
||||||
|
|
||||||
|
ExperimentLog experimentLog = new ExperimentLog();
|
||||||
|
experimentLog.setExperimentId(id);
|
||||||
|
experimentLog.setLogContent("删除试验人员");
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
SysUser userByName = userService.getUserByName(username);
|
||||||
|
experimentLog.setCreateBy(userByName.getRealname());
|
||||||
|
experimentLogService.save(experimentLog);
|
||||||
return Result.OK("删除成功!");
|
return Result.OK("删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user