update
This commit is contained in:
@@ -0,0 +1,178 @@
|
||||
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.metadata.IPage;
|
||||
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.tags.Tag;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: 试验人员
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-08-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="试验人员")
|
||||
@RestController
|
||||
@RequestMapping("/database/experimentUser")
|
||||
@Slf4j
|
||||
public class ExperimentUserController extends JeecgController<ExperimentUser, IExperimentUserService> {
|
||||
@Autowired
|
||||
private IExperimentUserService experimentUserService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param experimentUser
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "试验人员-分页列表查询")
|
||||
@Operation(summary="试验人员-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<ExperimentUser>> queryPageList(ExperimentUser experimentUser,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<ExperimentUser> queryWrapper = QueryGenerator.initQueryWrapper(experimentUser, req.getParameterMap());
|
||||
Page<ExperimentUser> page = new Page<ExperimentUser>(pageNo, pageSize);
|
||||
IPage<ExperimentUser> pageList = experimentUserService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param experimentUser
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "试验人员-添加")
|
||||
@Operation(summary="试验人员-添加")
|
||||
@RequiresPermissions("database:experiment_user:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody ExperimentUser experimentUser) {
|
||||
experimentUserService.save(experimentUser);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param experimentUser
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "试验人员-编辑")
|
||||
@Operation(summary="试验人员-编辑")
|
||||
@RequiresPermissions("database:experiment_user:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody ExperimentUser experimentUser) {
|
||||
experimentUserService.updateById(experimentUser);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "试验人员-通过id删除")
|
||||
@Operation(summary="试验人员-通过id删除")
|
||||
@RequiresPermissions("database:experiment_user:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
experimentUserService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "试验人员-批量删除")
|
||||
@Operation(summary="试验人员-批量删除")
|
||||
@RequiresPermissions("database:experiment_user:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.experimentUserService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "试验人员-通过id查询")
|
||||
@Operation(summary="试验人员-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<ExperimentUser> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
ExperimentUser experimentUser = experimentUserService.getById(id);
|
||||
if(experimentUser==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(experimentUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param experimentUser
|
||||
*/
|
||||
@RequiresPermissions("database:experiment_user:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ExperimentUser experimentUser) {
|
||||
return super.exportXls(request, experimentUser, ExperimentUser.class, "试验人员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("database:experiment_user:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ExperimentUser.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.jeecg.modules.database.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 试验人员
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-08-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("experiment_user")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description="试验人员")
|
||||
public class ExperimentUser implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private Date updateTime;
|
||||
/**所属部门*/
|
||||
@Schema(description = "所属部门")
|
||||
private String sysOrgCode;
|
||||
/**试验ID*/
|
||||
@Excel(name = "试验ID", width = 15)
|
||||
@Schema(description = "试验ID")
|
||||
private String experimentId;
|
||||
/**人员*/
|
||||
@Excel(name = "人员", width = 15)
|
||||
@Schema(description = "人员")
|
||||
private String userId;
|
||||
/**类型*/
|
||||
@Excel(name = "类型", width = 15)
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.database.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.database.entity.ExperimentUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 试验人员
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-08-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ExperimentUserMapper extends BaseMapper<ExperimentUser> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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="org.jeecg.modules.database.mapper.ExperimentUserMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.database.service;
|
||||
|
||||
import org.jeecg.modules.database.entity.ExperimentUser;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 试验人员
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-08-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IExperimentUserService extends IService<ExperimentUser> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.database.service.impl;
|
||||
|
||||
import org.jeecg.modules.database.entity.ExperimentUser;
|
||||
import org.jeecg.modules.database.mapper.ExperimentUserMapper;
|
||||
import org.jeecg.modules.database.service.IExperimentUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 试验人员
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-08-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ExperimentUserServiceImpl extends ServiceImpl<ExperimentUserMapper, ExperimentUser> implements IExperimentUserService {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user