立档单位-库房-档案柜
parent
67ef100fe2
commit
cdf5209581
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<modules>
|
||||
<module>yudao-module-setting-api</module>
|
||||
<module>yudao-module-setting-biz</module>
|
||||
</modules>
|
||||
<artifactId>yudao-module-setting</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
档案设置业务模块
|
||||
</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.baidu.aip</groupId>
|
||||
<artifactId>java-sdk</artifactId>
|
||||
<version>4.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.80</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.setting.enums;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
public interface ErrorCodeConstants {
|
||||
ErrorCode ORGANIZATION_NOT_EXISTS = new ErrorCode(200100, "立档单位不存在");
|
||||
ErrorCode DEPOT_CABINET_NOT_EXISTS = new ErrorCode(300100, "档案柜管理不存在");
|
||||
ErrorCode DEPOT_NOT_EXISTS = new ErrorCode(400100, "库房管理不存在");
|
||||
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depot;
|
||||
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo.DepotCabinetExportReqVO;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depot.vo.*;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO;
|
||||
import cn.iocoder.yudao.module.setting.convert.depot.DepotConvert;
|
||||
import cn.iocoder.yudao.module.setting.service.depot.DepotService;
|
||||
|
||||
@Tag(name = "管理后台 - 库房管理")
|
||||
@RestController
|
||||
@RequestMapping("/setting/depot")
|
||||
@Validated
|
||||
public class DepotController {
|
||||
|
||||
@Resource
|
||||
private DepotService depotService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建库房管理")
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot:create')")
|
||||
public CommonResult<Long> createDepot(@Valid @RequestBody DepotCreateReqVO createReqVO) {
|
||||
DepotExportReqVO depotExportReqVO = new DepotExportReqVO();
|
||||
//不能重复
|
||||
depotExportReqVO.setCode(createReqVO.getCode());
|
||||
List<DepotDO> depotList = depotService.getDepotList(depotExportReqVO);
|
||||
if (depotList.size()>0){
|
||||
return error("库房编码不能重复!");
|
||||
}
|
||||
//不能重复
|
||||
depotExportReqVO.setCode(null);
|
||||
depotExportReqVO.setName(createReqVO.getName());
|
||||
List<DepotDO> organizationList2 = depotService.getDepotList(depotExportReqVO);
|
||||
if (organizationList2.size()>0){
|
||||
return error("库房名称不能重复!");
|
||||
}
|
||||
return success(depotService.createDepot(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新库房管理")
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot:update')")
|
||||
public CommonResult<Boolean> updateDepot(@Valid @RequestBody DepotUpdateReqVO updateReqVO) {
|
||||
DepotExportReqVO depotExportReqVO = new DepotExportReqVO();
|
||||
//不能重复
|
||||
depotExportReqVO.setCode(updateReqVO.getCode());
|
||||
List<DepotDO> depotList = depotService.getDepotList(depotExportReqVO);
|
||||
if (depotList.size()>0){
|
||||
return error("库房编码不能重复!");
|
||||
}
|
||||
//不能重复
|
||||
depotExportReqVO.setCode(null);
|
||||
depotExportReqVO.setName(updateReqVO.getName());
|
||||
List<DepotDO> organizationList2 = depotService.getDepotList(depotExportReqVO);
|
||||
if (organizationList2.size()>0){
|
||||
return error("库房名称不能重复!");
|
||||
}
|
||||
depotService.updateDepot(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除库房管理")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot:delete')")
|
||||
public CommonResult<Boolean> deleteDepot(@RequestParam("id") Long id) {
|
||||
depotService.deleteDepot(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得库房管理")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot:query')")
|
||||
public CommonResult<DepotRespVO> getDepot(@RequestParam("id") Long id) {
|
||||
DepotDO depot = depotService.getDepot(id);
|
||||
return success(DepotConvert.INSTANCE.convert(depot));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得库房管理列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot:query')")
|
||||
public CommonResult<List<DepotRespVO>> getDepotList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<DepotDO> list = depotService.getDepotList(ids);
|
||||
return success(DepotConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得库房管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot:query')")
|
||||
@DataPermission
|
||||
public CommonResult<PageResult<DepotRespVO>> getDepotPage(@Valid DepotPageReqVO pageVO) {
|
||||
PageResult<DepotDO> pageResult = depotService.getDepotPage(pageVO);
|
||||
return success(DepotConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出库房管理 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDepotExcel(@Valid DepotExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<DepotDO> list = depotService.getDepotList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<DepotExcelVO> datas = DepotConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "库房管理.xls", "数据", DepotExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depot.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 库房管理创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DepotCreateReqVO extends DepotBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depot.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 库房管理 Excel VO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class DepotExcelVO {
|
||||
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("库房名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("库房编号")
|
||||
private String code;
|
||||
|
||||
@ExcelProperty("库房地址")
|
||||
private String address;
|
||||
|
||||
@ExcelProperty("立党单位id")
|
||||
private Long organizationId;
|
||||
|
||||
@ExcelProperty("管理者ID")
|
||||
private Long manegerId;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ExcelProperty("管理者姓名")
|
||||
private String manegerName;
|
||||
|
||||
@ExcelProperty("所属部门ID")
|
||||
private Long deptId;
|
||||
|
||||
@ExcelProperty("所属部门")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty("业务实体ID")
|
||||
private Long companyId;
|
||||
|
||||
@ExcelProperty("业务实体")
|
||||
private String company;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ExcelProperty("立档单位名称")
|
||||
private String organizationName;
|
||||
|
||||
@ExcelProperty("立档单位编码")
|
||||
private String organizationCode;
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depot.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 库房管理分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DepotPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "库房名称", example = "芋艿")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "库房编号")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "库房地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "立党单位id", example = "16975")
|
||||
private Long organizationId;
|
||||
|
||||
@Schema(description = "管理者ID", example = "4209")
|
||||
private Long manegerId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "管理者姓名", example = "赵六")
|
||||
private String manegerName;
|
||||
|
||||
@Schema(description = "所属部门ID", example = "4488")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "所属部门", example = "张三")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "业务实体ID", example = "14016")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "业务实体")
|
||||
private String company;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "用户ID", example = "2430")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "立档单位名称", example = "赵六")
|
||||
private String organizationName;
|
||||
|
||||
@Schema(description = "立档单位编码")
|
||||
private String organizationCode;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depot.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 库房管理 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DepotRespVO extends DepotBaseVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19063")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depot.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 库房管理更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DepotUpdateReqVO extends DepotBaseVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19063")
|
||||
@NotNull(message = "主键ID不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depot.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo.DepotCabinetVo;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class DepotVo {
|
||||
private Long depotId;
|
||||
private String depotName;
|
||||
private String depotCode;
|
||||
private List<DepotCabinetVo> children;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depot.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo.DepotCabinetVo;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class OrganizationDepotVO {
|
||||
private Long organizationId;
|
||||
private String organizationName;
|
||||
private String organizationCode;
|
||||
private List<DepotVo> children;
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depotcabinet;
|
||||
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.organization.vo.OrganizationExportReqVO;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo.*;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO;
|
||||
import cn.iocoder.yudao.module.setting.convert.depotcabinet.DepotCabinetConvert;
|
||||
import cn.iocoder.yudao.module.setting.service.depotcabinet.DepotCabinetService;
|
||||
|
||||
@Tag(name = "管理后台 - 档案柜管理")
|
||||
@RestController
|
||||
@RequestMapping("/setting/depot-cabinet")
|
||||
@Validated
|
||||
public class DepotCabinetController {
|
||||
|
||||
@Resource
|
||||
private DepotCabinetService depotCabinetService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建档案柜管理")
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot-cabinet:create')")
|
||||
public CommonResult<Long> createDepotCabinet(@Valid @RequestBody DepotCabinetCreateReqVO createReqVO) {
|
||||
DepotCabinetExportReqVO depotCabinetExportReqVO = new DepotCabinetExportReqVO();
|
||||
//不能重复
|
||||
depotCabinetExportReqVO.setCode(createReqVO.getCode());
|
||||
List<DepotCabinetDO> depotCabinetList = depotCabinetService.getDepotCabinetList(depotCabinetExportReqVO);
|
||||
if (depotCabinetList.size()>0){
|
||||
return error("档案柜编码不能重复!");
|
||||
}
|
||||
//不能重复
|
||||
depotCabinetExportReqVO.setCode(null);
|
||||
depotCabinetExportReqVO.setName(createReqVO.getName());
|
||||
List<DepotCabinetDO> organizationList2 = depotCabinetService.getDepotCabinetList(depotCabinetExportReqVO);
|
||||
if (organizationList2.size()>0){
|
||||
return error("档案柜名称不能重复!");
|
||||
}
|
||||
return success(depotCabinetService.createDepotCabinet(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新档案柜管理")
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot-cabinet:update')")
|
||||
public CommonResult<Boolean> updateDepotCabinet(@Valid @RequestBody DepotCabinetUpdateReqVO updateReqVO) {
|
||||
DepotCabinetExportReqVO depotCabinetExportReqVO = new DepotCabinetExportReqVO();
|
||||
//不能重复
|
||||
depotCabinetExportReqVO.setCode(updateReqVO.getCode());
|
||||
List<DepotCabinetDO> depotCabinetList = depotCabinetService.getDepotCabinetList(depotCabinetExportReqVO);
|
||||
if (depotCabinetList.size()>0){
|
||||
return error("档案柜编码不能重复!");
|
||||
}
|
||||
//不能重复
|
||||
depotCabinetExportReqVO.setCode(null);
|
||||
depotCabinetExportReqVO.setName(updateReqVO.getName());
|
||||
List<DepotCabinetDO> organizationList2 = depotCabinetService.getDepotCabinetList(depotCabinetExportReqVO);
|
||||
if (organizationList2.size()>0){
|
||||
return error("档案柜名称不能重复!");
|
||||
}
|
||||
depotCabinetService.updateDepotCabinet(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除档案柜管理")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot-cabinet:delete')")
|
||||
public CommonResult<Boolean> deleteDepotCabinet(@RequestParam("id") Long id) {
|
||||
depotCabinetService.deleteDepotCabinet(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得档案柜管理")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot-cabinet:query')")
|
||||
public CommonResult<DepotCabinetRespVO> getDepotCabinet(@RequestParam("id") Long id) {
|
||||
DepotCabinetDO depotCabinet = depotCabinetService.getDepotCabinet(id);
|
||||
return success(DepotCabinetConvert.INSTANCE.convert(depotCabinet));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得档案柜管理列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot-cabinet:query')")
|
||||
public CommonResult<List<DepotCabinetRespVO>> getDepotCabinetList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<DepotCabinetDO> list = depotCabinetService.getDepotCabinetList(ids);
|
||||
return success(DepotCabinetConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得档案柜管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot-cabinet:query')")
|
||||
@DataPermission
|
||||
public CommonResult<PageResult<DepotCabinetRespVO>> getDepotCabinetPage(@Valid DepotCabinetPageReqVO pageVO) {
|
||||
PageResult<DepotCabinetDO> pageResult = depotCabinetService.getDepotCabinetPage(pageVO);
|
||||
return success(DepotCabinetConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出档案柜管理 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('setting:depot-cabinet:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDepotCabinetExcel(@Valid DepotCabinetExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<DepotCabinetDO> list = depotCabinetService.getDepotCabinetList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<DepotCabinetExcelVO> datas = DepotCabinetConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "档案柜管理.xls", "数据", DepotCabinetExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 档案柜管理创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DepotCabinetCreateReqVO extends DepotCabinetBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 档案柜管理 Excel VO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class DepotCabinetExcelVO {
|
||||
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("所属库房ID")
|
||||
private Long depotId;
|
||||
|
||||
@ExcelProperty("柜子名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("柜子编号")
|
||||
private String code;
|
||||
|
||||
@ExcelProperty("库房地址")
|
||||
private String address;
|
||||
|
||||
@ExcelProperty("管理者ID")
|
||||
private Long manegerId;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ExcelProperty("管理者姓名")
|
||||
private String manegerName;
|
||||
|
||||
@ExcelProperty("所属部门ID")
|
||||
private Long deptId;
|
||||
|
||||
@ExcelProperty("所属部门")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty("业务实体ID")
|
||||
private Long companyId;
|
||||
|
||||
@ExcelProperty("业务实体")
|
||||
private String company;
|
||||
|
||||
@ExcelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 档案柜管理分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DepotCabinetPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "所属库房ID", example = "19347")
|
||||
private Long depotId;
|
||||
|
||||
@Schema(description = "柜子名称", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "柜子编号")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "库房地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "管理者ID", example = "9598")
|
||||
private Long manegerId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "管理者姓名", example = "张三")
|
||||
private String manegerName;
|
||||
|
||||
@Schema(description = "所属部门ID", example = "16027")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "所属部门", example = "张三")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "业务实体ID", example = "30420")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "业务实体")
|
||||
private String company;
|
||||
|
||||
@Schema(description = "用户ID", example = "22208")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 档案柜管理 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DepotCabinetRespVO extends DepotCabinetBaseVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26621")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 档案柜管理更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DepotCabinetUpdateReqVO extends DepotCabinetBaseVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26621")
|
||||
@NotNull(message = "主键ID不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class DepotCabinetVo {
|
||||
private Long cabinetId;
|
||||
private String cabinetName;
|
||||
private String cabinetCode;
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.organization;
|
||||
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depot.vo.OrganizationDepotVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.organization.vo.*;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO;
|
||||
import cn.iocoder.yudao.module.setting.convert.organization.OrganizationConvert;
|
||||
import cn.iocoder.yudao.module.setting.service.organization.OrganizationService;
|
||||
|
||||
@Tag(name = "管理后台 - 立档单位")
|
||||
@RestController
|
||||
@RequestMapping("/setting/organization")
|
||||
@Validated
|
||||
public class OrganizationController {
|
||||
|
||||
@Resource
|
||||
private OrganizationService organizationService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建立档单位")
|
||||
@PreAuthorize("@ss.hasPermission('setting:organization:create')")
|
||||
public CommonResult<Long> createOrganization(@Valid @RequestBody OrganizationCreateReqVO createReqVO) {
|
||||
OrganizationExportReqVO organizationExportReqVO = new OrganizationExportReqVO();
|
||||
//立档单位编码不能重复
|
||||
organizationExportReqVO.setOrganizationCode(createReqVO.getOrganizationCode());
|
||||
List<OrganizationDO> organizationList = organizationService.getOrganizationList(organizationExportReqVO);
|
||||
if (organizationList.size()>0){
|
||||
return error("立档单位编码不能重复!");
|
||||
}
|
||||
//立档单位名称不能重复
|
||||
organizationExportReqVO.setOrganizationCode(null);
|
||||
organizationExportReqVO.setOrganizationName(createReqVO.getOrganizationName());
|
||||
List<OrganizationDO> organizationList2 = organizationService.getOrganizationList(organizationExportReqVO);
|
||||
if (organizationList2.size()>0){
|
||||
return error("立档单位名称不能重复!");
|
||||
}
|
||||
return success(organizationService.createOrganization(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新立档单位")
|
||||
@PreAuthorize("@ss.hasPermission('setting:organization:update')")
|
||||
public CommonResult<Boolean> updateOrganization(@Valid @RequestBody OrganizationUpdateReqVO updateReqVO) {
|
||||
OrganizationExportReqVO organizationExportReqVO = new OrganizationExportReqVO();
|
||||
//立档单位编码不能重复
|
||||
organizationExportReqVO.setOrganizationCode(updateReqVO.getOrganizationCode());
|
||||
List<OrganizationDO> organizationList = organizationService.getOrganizationList(organizationExportReqVO);
|
||||
if (organizationList.size()>0){
|
||||
return error("立档单位编码不能重复!");
|
||||
}
|
||||
//立档单位名称不能重复
|
||||
organizationExportReqVO.setOrganizationCode(null);
|
||||
organizationExportReqVO.setOrganizationName(updateReqVO.getOrganizationName());
|
||||
List<OrganizationDO> organizationList2 = organizationService.getOrganizationList(organizationExportReqVO);
|
||||
if (organizationList2.size()>0){
|
||||
return error("立档单位名称不能重复!");
|
||||
}
|
||||
organizationService.updateOrganization(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除立档单位")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('setting:organization:delete')")
|
||||
public CommonResult<Boolean> deleteOrganization(@RequestParam("id") Long id) {
|
||||
organizationService.deleteOrganization(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得立档单位")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('setting:organization:query')")
|
||||
public CommonResult<OrganizationRespVO> getOrganization(@RequestParam("id") Long id) {
|
||||
OrganizationDO organization = organizationService.getOrganization(id);
|
||||
return success(OrganizationConvert.INSTANCE.convert(organization));
|
||||
}
|
||||
|
||||
@GetMapping("/getTree")
|
||||
@Operation(summary = "获得立档单位树")
|
||||
@PreAuthorize("@ss.hasPermission('setting:organization:query')")
|
||||
public CommonResult<List<OrganizationDepotVO>> getTree() {
|
||||
return success(organizationService.getOrganizationTree());
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得立档单位列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('setting:organization:query')")
|
||||
public CommonResult<List<OrganizationRespVO>> getOrganizationList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<OrganizationDO> list = organizationService.getOrganizationList(ids);
|
||||
return success(OrganizationConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得立档单位分页")
|
||||
@PreAuthorize("@ss.hasPermission('setting:organization:query')")
|
||||
@DataPermission
|
||||
public CommonResult<PageResult<OrganizationRespVO>> getOrganizationPage(@Valid OrganizationPageReqVO pageVO) {
|
||||
PageResult<OrganizationDO> pageResult = organizationService.getOrganizationPage(pageVO);
|
||||
return success(OrganizationConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出立档单位 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('setting:organization:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportOrganizationExcel(@Valid OrganizationExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<OrganizationDO> list = organizationService.getOrganizationList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<OrganizationExcelVO> datas = OrganizationConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "立档单位.xls", "数据", OrganizationExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.organization.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 立档单位创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class OrganizationCreateReqVO extends OrganizationBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.organization.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 立档单位 Excel VO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class OrganizationExcelVO {
|
||||
|
||||
@ExcelProperty("单位id")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("单位名称")
|
||||
private String organizationName;
|
||||
|
||||
@ExcelProperty("单位编码")
|
||||
private String organizationCode;
|
||||
|
||||
@ExcelProperty("全宗号")
|
||||
private String caseNum;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ExcelProperty("所属部门id")
|
||||
private Long deptId;
|
||||
|
||||
@ExcelProperty("所属部门")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty("用户id")
|
||||
private Long userId;
|
||||
|
||||
@ExcelProperty("业务实体id")
|
||||
private Long companyId;
|
||||
|
||||
@ExcelProperty("业务实体")
|
||||
private String company;
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.organization.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 立档单位分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class OrganizationPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "单位名称", example = "李四")
|
||||
private String organizationName;
|
||||
|
||||
@Schema(description = "单位编码")
|
||||
private String organizationCode;
|
||||
|
||||
@Schema(description = "全宗号")
|
||||
private String caseNum;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "所属部门id", example = "13232")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "所属部门", example = "张三")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "用户id", example = "22926")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "业务实体id", example = "13170")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "业务实体")
|
||||
private String company;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.organization.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 立档单位 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class OrganizationRespVO extends OrganizationBaseVO {
|
||||
|
||||
@Schema(description = "单位id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28076")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.setting.controller.admin.organization.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 立档单位更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class OrganizationUpdateReqVO extends OrganizationBaseVO {
|
||||
|
||||
@Schema(description = "单位id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28076")
|
||||
@NotNull(message = "单位id不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.setting.convert.depot;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depot.vo.*;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO;
|
||||
|
||||
/**
|
||||
* 库房管理 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface DepotConvert {
|
||||
|
||||
DepotConvert INSTANCE = Mappers.getMapper(DepotConvert.class);
|
||||
|
||||
DepotDO convert(DepotCreateReqVO bean);
|
||||
|
||||
DepotDO convert(DepotUpdateReqVO bean);
|
||||
|
||||
DepotRespVO convert(DepotDO bean);
|
||||
|
||||
List<DepotRespVO> convertList(List<DepotDO> list);
|
||||
|
||||
PageResult<DepotRespVO> convertPage(PageResult<DepotDO> page);
|
||||
|
||||
List<DepotExcelVO> convertList02(List<DepotDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.setting.convert.depotcabinet;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo.*;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO;
|
||||
|
||||
/**
|
||||
* 档案柜管理 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface DepotCabinetConvert {
|
||||
|
||||
DepotCabinetConvert INSTANCE = Mappers.getMapper(DepotCabinetConvert.class);
|
||||
|
||||
DepotCabinetDO convert(DepotCabinetCreateReqVO bean);
|
||||
|
||||
DepotCabinetDO convert(DepotCabinetUpdateReqVO bean);
|
||||
|
||||
DepotCabinetRespVO convert(DepotCabinetDO bean);
|
||||
|
||||
List<DepotCabinetRespVO> convertList(List<DepotCabinetDO> list);
|
||||
|
||||
PageResult<DepotCabinetRespVO> convertPage(PageResult<DepotCabinetDO> page);
|
||||
|
||||
List<DepotCabinetExcelVO> convertList02(List<DepotCabinetDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.setting.convert.organization;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.organization.vo.*;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO;
|
||||
|
||||
/**
|
||||
* 立档单位 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrganizationConvert {
|
||||
|
||||
OrganizationConvert INSTANCE = Mappers.getMapper(OrganizationConvert.class);
|
||||
|
||||
OrganizationDO convert(OrganizationCreateReqVO bean);
|
||||
|
||||
OrganizationDO convert(OrganizationUpdateReqVO bean);
|
||||
|
||||
OrganizationRespVO convert(OrganizationDO bean);
|
||||
|
||||
List<OrganizationRespVO> convertList(List<OrganizationDO> list);
|
||||
|
||||
PageResult<OrganizationRespVO> convertPage(PageResult<OrganizationDO> page);
|
||||
|
||||
List<OrganizationExcelVO> convertList02(List<OrganizationDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package cn.iocoder.yudao.module.setting.dal.dataobject.depot;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 库房管理 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("setting_depot")
|
||||
@KeySequence("setting_depot_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DepotDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 库房名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 库房编号
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 库房地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 立党单位id
|
||||
*/
|
||||
private Long organizationId;
|
||||
/**
|
||||
* 管理者ID
|
||||
*/
|
||||
private Long manegerId;
|
||||
/**
|
||||
* 管理者姓名
|
||||
*/
|
||||
private String manegerName;
|
||||
/**
|
||||
* 所属部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private String deptName;
|
||||
/**
|
||||
* 业务实体ID
|
||||
*/
|
||||
private Long companyId;
|
||||
/**
|
||||
* 业务实体
|
||||
*/
|
||||
private String company;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 预留字段1
|
||||
*/
|
||||
private String attr1;
|
||||
/**
|
||||
* 预留字段2
|
||||
*/
|
||||
private String attr2;
|
||||
/**
|
||||
* 预留字段3
|
||||
*/
|
||||
private Integer attr3;
|
||||
/**
|
||||
* 预留字段4
|
||||
*/
|
||||
private Integer attr4;
|
||||
/**
|
||||
* 立档单位名称
|
||||
*/
|
||||
private String organizationName;
|
||||
/**
|
||||
* 立档单位编码
|
||||
*/
|
||||
private String organizationCode;
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 档案柜管理 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("setting_depot_cabinet")
|
||||
@KeySequence("setting_depot_cabinet_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DepotCabinetDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 所属库房ID
|
||||
*/
|
||||
private Long depotId;
|
||||
/**
|
||||
* 柜子名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 柜子编号
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 库房地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 管理者ID
|
||||
*/
|
||||
private Long manegerId;
|
||||
/**
|
||||
* 管理者姓名
|
||||
*/
|
||||
private String manegerName;
|
||||
/**
|
||||
* 所属部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private String deptName;
|
||||
/**
|
||||
* 业务实体ID
|
||||
*/
|
||||
private Long companyId;
|
||||
/**
|
||||
* 业务实体
|
||||
*/
|
||||
private String company;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 预留字段1
|
||||
*/
|
||||
private String attr1;
|
||||
/**
|
||||
* 预留字段2
|
||||
*/
|
||||
private String attr2;
|
||||
/**
|
||||
* 预留字段3
|
||||
*/
|
||||
private Integer attr3;
|
||||
/**
|
||||
* 预留字段4
|
||||
*/
|
||||
private Integer attr4;
|
||||
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package cn.iocoder.yudao.module.setting.dal.dataobject.organization;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 立档单位 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("setting_organization")
|
||||
@KeySequence("setting_organization_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrganizationDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 单位id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
private String organizationName;
|
||||
/**
|
||||
* 单位编码
|
||||
*/
|
||||
private String organizationCode;
|
||||
/**
|
||||
* 全宗号
|
||||
*/
|
||||
private String caseNum;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 预留字段1
|
||||
*/
|
||||
private String attr1;
|
||||
/**
|
||||
* 预留字段2
|
||||
*/
|
||||
private String attr2;
|
||||
/**
|
||||
* 预留字段3
|
||||
*/
|
||||
private Integer attr3;
|
||||
/**
|
||||
* 预留字段4
|
||||
*/
|
||||
private Integer attr4;
|
||||
/**
|
||||
* 所属部门id
|
||||
*/
|
||||
private Long deptId;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private String deptName;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 业务实体id
|
||||
*/
|
||||
private Long companyId;
|
||||
/**
|
||||
* 业务实体
|
||||
*/
|
||||
private String company;
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package cn.iocoder.yudao.module.setting.dal.mysql.depot;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo.DepotCabinetVo;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depot.vo.*;
|
||||
|
||||
/**
|
||||
* 库房管理 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface DepotMapper extends BaseMapperX<DepotDO> {
|
||||
|
||||
default PageResult<DepotDO> selectPage(DepotPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DepotDO>()
|
||||
.likeIfPresent(DepotDO::getName, reqVO.getName())
|
||||
.eqIfPresent(DepotDO::getCode, reqVO.getCode())
|
||||
.eqIfPresent(DepotDO::getAddress, reqVO.getAddress())
|
||||
.eqIfPresent(DepotDO::getOrganizationId, reqVO.getOrganizationId())
|
||||
.eqIfPresent(DepotDO::getManegerId, reqVO.getManegerId())
|
||||
.betweenIfPresent(DepotDO::getCreateTime, reqVO.getCreateTime())
|
||||
.likeIfPresent(DepotDO::getManegerName, reqVO.getManegerName())
|
||||
.eqIfPresent(DepotDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(DepotDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(DepotDO::getCompanyId, reqVO.getCompanyId())
|
||||
.eqIfPresent(DepotDO::getCompany, reqVO.getCompany())
|
||||
.eqIfPresent(DepotDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(DepotDO::getUserId, reqVO.getUserId())
|
||||
.likeIfPresent(DepotDO::getOrganizationName, reqVO.getOrganizationName())
|
||||
.eqIfPresent(DepotDO::getOrganizationCode, reqVO.getOrganizationCode())
|
||||
.orderByDesc(DepotDO::getId));
|
||||
}
|
||||
|
||||
default List<DepotDO> selectList(DepotExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<DepotDO>()
|
||||
.likeIfPresent(DepotDO::getName, reqVO.getName())
|
||||
.eqIfPresent(DepotDO::getCode, reqVO.getCode())
|
||||
.eqIfPresent(DepotDO::getAddress, reqVO.getAddress())
|
||||
.eqIfPresent(DepotDO::getOrganizationId, reqVO.getOrganizationId())
|
||||
.eqIfPresent(DepotDO::getManegerId, reqVO.getManegerId())
|
||||
.betweenIfPresent(DepotDO::getCreateTime, reqVO.getCreateTime())
|
||||
.likeIfPresent(DepotDO::getManegerName, reqVO.getManegerName())
|
||||
.eqIfPresent(DepotDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(DepotDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(DepotDO::getCompanyId, reqVO.getCompanyId())
|
||||
.eqIfPresent(DepotDO::getCompany, reqVO.getCompany())
|
||||
.eqIfPresent(DepotDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(DepotDO::getUserId, reqVO.getUserId())
|
||||
.likeIfPresent(DepotDO::getOrganizationName, reqVO.getOrganizationName())
|
||||
.eqIfPresent(DepotDO::getOrganizationCode, reqVO.getOrganizationCode())
|
||||
.orderByDesc(DepotDO::getId));
|
||||
}
|
||||
@Select("SELECT d.id AS depotId, d.name AS depotName, d.code AS depotCode, " +
|
||||
"c.id AS cabinetId, c.name AS cabinetName, c.code AS cabinetCode " +
|
||||
"FROM setting_depot d " +
|
||||
"JOIN setting_depot_cabinet c ON d.id = c.depot_id " +
|
||||
"WHERE d.organization_id = #{organizationId}")
|
||||
@Results({
|
||||
@Result(property = "depotId", column = "depotId"),
|
||||
@Result(property = "depotName", column = "depotName"),
|
||||
@Result(property = "depotCode", column = "depotCode"),
|
||||
@Result(property = "children", column = "depotId",javaType = List.class,
|
||||
many=@Many(select="cn.iocoder.yudao.module.setting.dal.mysql.depotcabinet.DepotCabinetMapper.getCabinetByDepot"))
|
||||
})
|
||||
List<DepotVo> getDepotCabinetByOrganization(Long organizationId);
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.module.setting.dal.mysql.depotcabinet;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo.*;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 档案柜管理 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface DepotCabinetMapper extends BaseMapperX<DepotCabinetDO> {
|
||||
|
||||
default PageResult<DepotCabinetDO> selectPage(DepotCabinetPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DepotCabinetDO>()
|
||||
.eqIfPresent(DepotCabinetDO::getDepotId, reqVO.getDepotId())
|
||||
.likeIfPresent(DepotCabinetDO::getName, reqVO.getName())
|
||||
.eqIfPresent(DepotCabinetDO::getCode, reqVO.getCode())
|
||||
.eqIfPresent(DepotCabinetDO::getAddress, reqVO.getAddress())
|
||||
.eqIfPresent(DepotCabinetDO::getManegerId, reqVO.getManegerId())
|
||||
.betweenIfPresent(DepotCabinetDO::getCreateTime, reqVO.getCreateTime())
|
||||
.likeIfPresent(DepotCabinetDO::getManegerName, reqVO.getManegerName())
|
||||
.eqIfPresent(DepotCabinetDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(DepotCabinetDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(DepotCabinetDO::getCompanyId, reqVO.getCompanyId())
|
||||
.eqIfPresent(DepotCabinetDO::getCompany, reqVO.getCompany())
|
||||
.eqIfPresent(DepotCabinetDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(DepotCabinetDO::getRemark, reqVO.getRemark())
|
||||
.orderByDesc(DepotCabinetDO::getId));
|
||||
}
|
||||
|
||||
default List<DepotCabinetDO> selectList(DepotCabinetExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<DepotCabinetDO>()
|
||||
.eqIfPresent(DepotCabinetDO::getDepotId, reqVO.getDepotId())
|
||||
.likeIfPresent(DepotCabinetDO::getName, reqVO.getName())
|
||||
.eqIfPresent(DepotCabinetDO::getCode, reqVO.getCode())
|
||||
.eqIfPresent(DepotCabinetDO::getAddress, reqVO.getAddress())
|
||||
.eqIfPresent(DepotCabinetDO::getManegerId, reqVO.getManegerId())
|
||||
.betweenIfPresent(DepotCabinetDO::getCreateTime, reqVO.getCreateTime())
|
||||
.likeIfPresent(DepotCabinetDO::getManegerName, reqVO.getManegerName())
|
||||
.eqIfPresent(DepotCabinetDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(DepotCabinetDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(DepotCabinetDO::getCompanyId, reqVO.getCompanyId())
|
||||
.eqIfPresent(DepotCabinetDO::getCompany, reqVO.getCompany())
|
||||
.eqIfPresent(DepotCabinetDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(DepotCabinetDO::getRemark, reqVO.getRemark())
|
||||
.orderByDesc(DepotCabinetDO::getId));
|
||||
}
|
||||
@Select("SELECT id AS cabinetId, name AS cabinetName, code AS cabinetCode " +
|
||||
"FROM setting_depot_cabinet " +
|
||||
"WHERE depot_id = #{depotId}")
|
||||
List<DepotCabinetVo> getCabinetByDepot(Long depotId);
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package cn.iocoder.yudao.module.setting.dal.mysql.organization;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depot.vo.OrganizationDepotVO;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.organization.vo.*;
|
||||
|
||||
/**
|
||||
* 立档单位 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrganizationMapper extends BaseMapperX<OrganizationDO> {
|
||||
|
||||
default PageResult<OrganizationDO> selectPage(OrganizationPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<OrganizationDO>()
|
||||
.likeIfPresent(OrganizationDO::getOrganizationName, reqVO.getOrganizationName())
|
||||
.eqIfPresent(OrganizationDO::getOrganizationCode, reqVO.getOrganizationCode())
|
||||
.eqIfPresent(OrganizationDO::getCaseNum, reqVO.getCaseNum())
|
||||
.eqIfPresent(OrganizationDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(OrganizationDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(OrganizationDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(OrganizationDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(OrganizationDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(OrganizationDO::getCompanyId, reqVO.getCompanyId())
|
||||
.eqIfPresent(OrganizationDO::getCompany, reqVO.getCompany())
|
||||
.orderByDesc(OrganizationDO::getId));
|
||||
}
|
||||
|
||||
default List<OrganizationDO> selectList(OrganizationExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<OrganizationDO>()
|
||||
.likeIfPresent(OrganizationDO::getOrganizationName, reqVO.getOrganizationName())
|
||||
.eqIfPresent(OrganizationDO::getOrganizationCode, reqVO.getOrganizationCode())
|
||||
.eqIfPresent(OrganizationDO::getCaseNum, reqVO.getCaseNum())
|
||||
.eqIfPresent(OrganizationDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(OrganizationDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(OrganizationDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(OrganizationDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(OrganizationDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(OrganizationDO::getCompanyId, reqVO.getCompanyId())
|
||||
.eqIfPresent(OrganizationDO::getCompany, reqVO.getCompany())
|
||||
.orderByDesc(OrganizationDO::getId));
|
||||
}
|
||||
|
||||
@Select("SELECT o.id AS organizationId, o.organization_name AS organizationName, o.organization_code AS organizationCode, " +
|
||||
"d.id AS depotId, d.name AS depotName, d.code AS depotCode, " +
|
||||
"c.id AS cabinetId, c.name AS cabinetName, c.code AS cabinetCode " +
|
||||
"FROM setting_organization o " +
|
||||
"LEFT JOIN setting_depot d ON o.id = d.organization_id " +
|
||||
"LEFT JOIN setting_depot_cabinet c ON d.id = c.depot_id ")
|
||||
@Results({
|
||||
@Result(property = "organizationId", column = "organizationId"),
|
||||
@Result(property = "organizationName", column = "organizationName"),
|
||||
@Result(property = "organizationCode", column = "organizationCode"),
|
||||
@Result(property = "children", column = "organizationId",javaType = List.class,
|
||||
many=@Many(select="cn.iocoder.yudao.module.setting.dal.mysql.depot.DepotMapper.getDepotCabinetByOrganization"))
|
||||
})
|
||||
List<OrganizationDepotVO> getOrganizationDepotCabinets();
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.setting.framework.datapermission.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* archives 模块的数据权限 Configuration
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class DataPermissionConfigurationSetting {
|
||||
|
||||
@Bean
|
||||
public DeptDataPermissionRuleCustomizer sysDeptDataPermissionRuleCustomizerSetting() {
|
||||
return rule -> {
|
||||
// dept
|
||||
rule.addDeptColumn(OrganizationDO.class);
|
||||
rule.addDeptColumn(DeptDO.class, "id");
|
||||
|
||||
// user
|
||||
rule.addUserColumn(OrganizationDO.class);
|
||||
rule.addUserColumn(AdminUserDO.class,"id");
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package cn.iocoder.yudao.module.setting.service.depot;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depot.vo.*;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 库房管理 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface DepotService {
|
||||
|
||||
/**
|
||||
* 创建库房管理
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDepot(@Valid DepotCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新库房管理
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDepot(@Valid DepotUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除库房管理
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDepot(Long id);
|
||||
|
||||
/**
|
||||
* 获得库房管理
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 库房管理
|
||||
*/
|
||||
DepotDO getDepot(Long id);
|
||||
|
||||
/**
|
||||
* 获得库房管理列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 库房管理列表
|
||||
*/
|
||||
List<DepotDO> getDepotList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得库房管理分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 库房管理分页
|
||||
*/
|
||||
PageResult<DepotDO> getDepotPage(DepotPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得库房管理列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 库房管理列表
|
||||
*/
|
||||
List<DepotDO> getDepotList(DepotExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package cn.iocoder.yudao.module.setting.service.depotcabinet;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo.*;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 档案柜管理 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface DepotCabinetService {
|
||||
|
||||
/**
|
||||
* 创建档案柜管理
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDepotCabinet(@Valid DepotCabinetCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新档案柜管理
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDepotCabinet(@Valid DepotCabinetUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除档案柜管理
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDepotCabinet(Long id);
|
||||
|
||||
/**
|
||||
* 获得档案柜管理
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 档案柜管理
|
||||
*/
|
||||
DepotCabinetDO getDepotCabinet(Long id);
|
||||
|
||||
/**
|
||||
* 获得档案柜管理列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 档案柜管理列表
|
||||
*/
|
||||
List<DepotCabinetDO> getDepotCabinetList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得档案柜管理分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 档案柜管理分页
|
||||
*/
|
||||
PageResult<DepotCabinetDO> getDepotCabinetPage(DepotCabinetPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得档案柜管理列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 档案柜管理列表
|
||||
*/
|
||||
List<DepotCabinetDO> getDepotCabinetList(DepotCabinetExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.setting.service.organization;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depot.vo.OrganizationDepotVO;
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.organization.vo.*;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 立档单位 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface OrganizationService {
|
||||
|
||||
List<OrganizationDepotVO> getOrganizationTree();
|
||||
|
||||
/**
|
||||
* 创建立档单位
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createOrganization(@Valid OrganizationCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新立档单位
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateOrganization(@Valid OrganizationUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除立档单位
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteOrganization(Long id);
|
||||
|
||||
/**
|
||||
* 获得立档单位
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 立档单位
|
||||
*/
|
||||
OrganizationDO getOrganization(Long id);
|
||||
|
||||
/**
|
||||
* 获得立档单位列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 立档单位列表
|
||||
*/
|
||||
List<OrganizationDO> getOrganizationList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得立档单位分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 立档单位分页
|
||||
*/
|
||||
PageResult<OrganizationDO> getOrganizationPage(OrganizationPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得立档单位列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 立档单位列表
|
||||
*/
|
||||
List<OrganizationDO> getOrganizationList(OrganizationExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,263 @@
|
||||
package cn.iocoder.yudao.module.setting.service.depot;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depot.vo.*;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO;
|
||||
import cn.iocoder.yudao.module.setting.dal.mysql.depot.DepotMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.iocoder.yudao.module.setting.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link DepotServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(DepotServiceImpl.class)
|
||||
public class DepotServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private DepotServiceImpl depotService;
|
||||
|
||||
@Resource
|
||||
private DepotMapper depotMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateDepot_success() {
|
||||
// 准备参数
|
||||
DepotCreateReqVO reqVO = randomPojo(DepotCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Long depotId = depotService.createDepot(reqVO);
|
||||
// 断言
|
||||
assertNotNull(depotId);
|
||||
// 校验记录的属性是否正确
|
||||
DepotDO depot = depotMapper.selectById(depotId);
|
||||
assertPojoEquals(reqVO, depot);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateDepot_success() {
|
||||
// mock 数据
|
||||
DepotDO dbDepot = randomPojo(DepotDO.class);
|
||||
depotMapper.insert(dbDepot);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
DepotUpdateReqVO reqVO = randomPojo(DepotUpdateReqVO.class, o -> {
|
||||
o.setId(dbDepot.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
depotService.updateDepot(reqVO);
|
||||
// 校验是否更新正确
|
||||
DepotDO depot = depotMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, depot);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateDepot_notExists() {
|
||||
// 准备参数
|
||||
DepotUpdateReqVO reqVO = randomPojo(DepotUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> depotService.updateDepot(reqVO), DEPOT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteDepot_success() {
|
||||
// mock 数据
|
||||
DepotDO dbDepot = randomPojo(DepotDO.class);
|
||||
depotMapper.insert(dbDepot);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbDepot.getId();
|
||||
|
||||
// 调用
|
||||
depotService.deleteDepot(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(depotMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteDepot_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> depotService.deleteDepot(id), DEPOT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetDepotPage() {
|
||||
// mock 数据
|
||||
DepotDO dbDepot = randomPojo(DepotDO.class, o -> { // 等会查询到
|
||||
o.setName(null);
|
||||
o.setCode(null);
|
||||
o.setAddress(null);
|
||||
o.setOrganizationId(null);
|
||||
o.setManegerId(null);
|
||||
o.setCreateTime(null);
|
||||
o.setManegerName(null);
|
||||
o.setDeptId(null);
|
||||
o.setDeptName(null);
|
||||
o.setCompanyId(null);
|
||||
o.setCompany(null);
|
||||
o.setRemark(null);
|
||||
o.setUserId(null);
|
||||
o.setOrganizationName(null);
|
||||
o.setOrganizationCode(null);
|
||||
});
|
||||
depotMapper.insert(dbDepot);
|
||||
// 测试 name 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setName(null)));
|
||||
// 测试 code 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setCode(null)));
|
||||
// 测试 address 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setAddress(null)));
|
||||
// 测试 organizationId 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setOrganizationId(null)));
|
||||
// 测试 manegerId 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setManegerId(null)));
|
||||
// 测试 createTime 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setCreateTime(null)));
|
||||
// 测试 manegerName 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setManegerName(null)));
|
||||
// 测试 deptId 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setDeptId(null)));
|
||||
// 测试 deptName 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setDeptName(null)));
|
||||
// 测试 companyId 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setCompanyId(null)));
|
||||
// 测试 company 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setCompany(null)));
|
||||
// 测试 remark 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setRemark(null)));
|
||||
// 测试 userId 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setUserId(null)));
|
||||
// 测试 organizationName 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setOrganizationName(null)));
|
||||
// 测试 organizationCode 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setOrganizationCode(null)));
|
||||
// 准备参数
|
||||
DepotPageReqVO reqVO = new DepotPageReqVO();
|
||||
reqVO.setName(null);
|
||||
reqVO.setCode(null);
|
||||
reqVO.setAddress(null);
|
||||
reqVO.setOrganizationId(null);
|
||||
reqVO.setManegerId(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setManegerName(null);
|
||||
reqVO.setDeptId(null);
|
||||
reqVO.setDeptName(null);
|
||||
reqVO.setCompanyId(null);
|
||||
reqVO.setCompany(null);
|
||||
reqVO.setRemark(null);
|
||||
reqVO.setUserId(null);
|
||||
reqVO.setOrganizationName(null);
|
||||
reqVO.setOrganizationCode(null);
|
||||
|
||||
// 调用
|
||||
PageResult<DepotDO> pageResult = depotService.getDepotPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbDepot, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetDepotList() {
|
||||
// mock 数据
|
||||
DepotDO dbDepot = randomPojo(DepotDO.class, o -> { // 等会查询到
|
||||
o.setName(null);
|
||||
o.setCode(null);
|
||||
o.setAddress(null);
|
||||
o.setOrganizationId(null);
|
||||
o.setManegerId(null);
|
||||
o.setCreateTime(null);
|
||||
o.setManegerName(null);
|
||||
o.setDeptId(null);
|
||||
o.setDeptName(null);
|
||||
o.setCompanyId(null);
|
||||
o.setCompany(null);
|
||||
o.setRemark(null);
|
||||
o.setUserId(null);
|
||||
o.setOrganizationName(null);
|
||||
o.setOrganizationCode(null);
|
||||
});
|
||||
depotMapper.insert(dbDepot);
|
||||
// 测试 name 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setName(null)));
|
||||
// 测试 code 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setCode(null)));
|
||||
// 测试 address 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setAddress(null)));
|
||||
// 测试 organizationId 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setOrganizationId(null)));
|
||||
// 测试 manegerId 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setManegerId(null)));
|
||||
// 测试 createTime 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setCreateTime(null)));
|
||||
// 测试 manegerName 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setManegerName(null)));
|
||||
// 测试 deptId 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setDeptId(null)));
|
||||
// 测试 deptName 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setDeptName(null)));
|
||||
// 测试 companyId 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setCompanyId(null)));
|
||||
// 测试 company 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setCompany(null)));
|
||||
// 测试 remark 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setRemark(null)));
|
||||
// 测试 userId 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setUserId(null)));
|
||||
// 测试 organizationName 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setOrganizationName(null)));
|
||||
// 测试 organizationCode 不匹配
|
||||
depotMapper.insert(cloneIgnoreId(dbDepot, o -> o.setOrganizationCode(null)));
|
||||
// 准备参数
|
||||
DepotExportReqVO reqVO = new DepotExportReqVO();
|
||||
reqVO.setName(null);
|
||||
reqVO.setCode(null);
|
||||
reqVO.setAddress(null);
|
||||
reqVO.setOrganizationId(null);
|
||||
reqVO.setManegerId(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setManegerName(null);
|
||||
reqVO.setDeptId(null);
|
||||
reqVO.setDeptName(null);
|
||||
reqVO.setCompanyId(null);
|
||||
reqVO.setCompany(null);
|
||||
reqVO.setRemark(null);
|
||||
reqVO.setUserId(null);
|
||||
reqVO.setOrganizationName(null);
|
||||
reqVO.setOrganizationCode(null);
|
||||
|
||||
// 调用
|
||||
List<DepotDO> list = depotService.getDepotList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbDepot, list.get(0));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,247 @@
|
||||
package cn.iocoder.yudao.module.setting.service.depotcabinet;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.depotcabinet.vo.*;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO;
|
||||
import cn.iocoder.yudao.module.setting.dal.mysql.depotcabinet.DepotCabinetMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.iocoder.yudao.module.setting.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link DepotCabinetServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(DepotCabinetServiceImpl.class)
|
||||
public class DepotCabinetServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private DepotCabinetServiceImpl depotCabinetService;
|
||||
|
||||
@Resource
|
||||
private DepotCabinetMapper depotCabinetMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateDepotCabinet_success() {
|
||||
// 准备参数
|
||||
DepotCabinetCreateReqVO reqVO = randomPojo(DepotCabinetCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Long depotCabinetId = depotCabinetService.createDepotCabinet(reqVO);
|
||||
// 断言
|
||||
assertNotNull(depotCabinetId);
|
||||
// 校验记录的属性是否正确
|
||||
DepotCabinetDO depotCabinet = depotCabinetMapper.selectById(depotCabinetId);
|
||||
assertPojoEquals(reqVO, depotCabinet);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateDepotCabinet_success() {
|
||||
// mock 数据
|
||||
DepotCabinetDO dbDepotCabinet = randomPojo(DepotCabinetDO.class);
|
||||
depotCabinetMapper.insert(dbDepotCabinet);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
DepotCabinetUpdateReqVO reqVO = randomPojo(DepotCabinetUpdateReqVO.class, o -> {
|
||||
o.setId(dbDepotCabinet.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
depotCabinetService.updateDepotCabinet(reqVO);
|
||||
// 校验是否更新正确
|
||||
DepotCabinetDO depotCabinet = depotCabinetMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, depotCabinet);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateDepotCabinet_notExists() {
|
||||
// 准备参数
|
||||
DepotCabinetUpdateReqVO reqVO = randomPojo(DepotCabinetUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> depotCabinetService.updateDepotCabinet(reqVO), DEPOT_CABINET_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteDepotCabinet_success() {
|
||||
// mock 数据
|
||||
DepotCabinetDO dbDepotCabinet = randomPojo(DepotCabinetDO.class);
|
||||
depotCabinetMapper.insert(dbDepotCabinet);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbDepotCabinet.getId();
|
||||
|
||||
// 调用
|
||||
depotCabinetService.deleteDepotCabinet(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(depotCabinetMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteDepotCabinet_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> depotCabinetService.deleteDepotCabinet(id), DEPOT_CABINET_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetDepotCabinetPage() {
|
||||
// mock 数据
|
||||
DepotCabinetDO dbDepotCabinet = randomPojo(DepotCabinetDO.class, o -> { // 等会查询到
|
||||
o.setDepotId(null);
|
||||
o.setName(null);
|
||||
o.setCode(null);
|
||||
o.setAddress(null);
|
||||
o.setManegerId(null);
|
||||
o.setCreateTime(null);
|
||||
o.setManegerName(null);
|
||||
o.setDeptId(null);
|
||||
o.setDeptName(null);
|
||||
o.setCompanyId(null);
|
||||
o.setCompany(null);
|
||||
o.setUserId(null);
|
||||
o.setRemark(null);
|
||||
});
|
||||
depotCabinetMapper.insert(dbDepotCabinet);
|
||||
// 测试 depotId 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setDepotId(null)));
|
||||
// 测试 name 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setName(null)));
|
||||
// 测试 code 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setCode(null)));
|
||||
// 测试 address 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setAddress(null)));
|
||||
// 测试 manegerId 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setManegerId(null)));
|
||||
// 测试 createTime 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setCreateTime(null)));
|
||||
// 测试 manegerName 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setManegerName(null)));
|
||||
// 测试 deptId 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setDeptId(null)));
|
||||
// 测试 deptName 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setDeptName(null)));
|
||||
// 测试 companyId 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setCompanyId(null)));
|
||||
// 测试 company 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setCompany(null)));
|
||||
// 测试 userId 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setUserId(null)));
|
||||
// 测试 remark 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setRemark(null)));
|
||||
// 准备参数
|
||||
DepotCabinetPageReqVO reqVO = new DepotCabinetPageReqVO();
|
||||
reqVO.setDepotId(null);
|
||||
reqVO.setName(null);
|
||||
reqVO.setCode(null);
|
||||
reqVO.setAddress(null);
|
||||
reqVO.setManegerId(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setManegerName(null);
|
||||
reqVO.setDeptId(null);
|
||||
reqVO.setDeptName(null);
|
||||
reqVO.setCompanyId(null);
|
||||
reqVO.setCompany(null);
|
||||
reqVO.setUserId(null);
|
||||
reqVO.setRemark(null);
|
||||
|
||||
// 调用
|
||||
PageResult<DepotCabinetDO> pageResult = depotCabinetService.getDepotCabinetPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbDepotCabinet, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetDepotCabinetList() {
|
||||
// mock 数据
|
||||
DepotCabinetDO dbDepotCabinet = randomPojo(DepotCabinetDO.class, o -> { // 等会查询到
|
||||
o.setDepotId(null);
|
||||
o.setName(null);
|
||||
o.setCode(null);
|
||||
o.setAddress(null);
|
||||
o.setManegerId(null);
|
||||
o.setCreateTime(null);
|
||||
o.setManegerName(null);
|
||||
o.setDeptId(null);
|
||||
o.setDeptName(null);
|
||||
o.setCompanyId(null);
|
||||
o.setCompany(null);
|
||||
o.setUserId(null);
|
||||
o.setRemark(null);
|
||||
});
|
||||
depotCabinetMapper.insert(dbDepotCabinet);
|
||||
// 测试 depotId 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setDepotId(null)));
|
||||
// 测试 name 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setName(null)));
|
||||
// 测试 code 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setCode(null)));
|
||||
// 测试 address 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setAddress(null)));
|
||||
// 测试 manegerId 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setManegerId(null)));
|
||||
// 测试 createTime 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setCreateTime(null)));
|
||||
// 测试 manegerName 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setManegerName(null)));
|
||||
// 测试 deptId 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setDeptId(null)));
|
||||
// 测试 deptName 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setDeptName(null)));
|
||||
// 测试 companyId 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setCompanyId(null)));
|
||||
// 测试 company 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setCompany(null)));
|
||||
// 测试 userId 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setUserId(null)));
|
||||
// 测试 remark 不匹配
|
||||
depotCabinetMapper.insert(cloneIgnoreId(dbDepotCabinet, o -> o.setRemark(null)));
|
||||
// 准备参数
|
||||
DepotCabinetExportReqVO reqVO = new DepotCabinetExportReqVO();
|
||||
reqVO.setDepotId(null);
|
||||
reqVO.setName(null);
|
||||
reqVO.setCode(null);
|
||||
reqVO.setAddress(null);
|
||||
reqVO.setManegerId(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setManegerName(null);
|
||||
reqVO.setDeptId(null);
|
||||
reqVO.setDeptName(null);
|
||||
reqVO.setCompanyId(null);
|
||||
reqVO.setCompany(null);
|
||||
reqVO.setUserId(null);
|
||||
reqVO.setRemark(null);
|
||||
|
||||
// 调用
|
||||
List<DepotCabinetDO> list = depotCabinetService.getDepotCabinetList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbDepotCabinet, list.get(0));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,223 @@
|
||||
package cn.iocoder.yudao.module.setting.service.organization;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.setting.controller.admin.organization.vo.*;
|
||||
import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO;
|
||||
import cn.iocoder.yudao.module.setting.dal.mysql.organization.OrganizationMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.iocoder.yudao.module.setting.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link OrganizationServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(OrganizationServiceImpl.class)
|
||||
public class OrganizationServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private OrganizationServiceImpl organizationService;
|
||||
|
||||
@Resource
|
||||
private OrganizationMapper organizationMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateOrganization_success() {
|
||||
// 准备参数
|
||||
OrganizationCreateReqVO reqVO = randomPojo(OrganizationCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Long organizationId = organizationService.createOrganization(reqVO);
|
||||
// 断言
|
||||
assertNotNull(organizationId);
|
||||
// 校验记录的属性是否正确
|
||||
OrganizationDO organization = organizationMapper.selectById(organizationId);
|
||||
assertPojoEquals(reqVO, organization);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateOrganization_success() {
|
||||
// mock 数据
|
||||
OrganizationDO dbOrganization = randomPojo(OrganizationDO.class);
|
||||
organizationMapper.insert(dbOrganization);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
OrganizationUpdateReqVO reqVO = randomPojo(OrganizationUpdateReqVO.class, o -> {
|
||||
o.setId(dbOrganization.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
organizationService.updateOrganization(reqVO);
|
||||
// 校验是否更新正确
|
||||
OrganizationDO organization = organizationMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, organization);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateOrganization_notExists() {
|
||||
// 准备参数
|
||||
OrganizationUpdateReqVO reqVO = randomPojo(OrganizationUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> organizationService.updateOrganization(reqVO), ORGANIZATION_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteOrganization_success() {
|
||||
// mock 数据
|
||||
OrganizationDO dbOrganization = randomPojo(OrganizationDO.class);
|
||||
organizationMapper.insert(dbOrganization);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbOrganization.getId();
|
||||
|
||||
// 调用
|
||||
organizationService.deleteOrganization(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(organizationMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteOrganization_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> organizationService.deleteOrganization(id), ORGANIZATION_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetOrganizationPage() {
|
||||
// mock 数据
|
||||
OrganizationDO dbOrganization = randomPojo(OrganizationDO.class, o -> { // 等会查询到
|
||||
o.setOrganizationName(null);
|
||||
o.setOrganizationCode(null);
|
||||
o.setCaseNum(null);
|
||||
o.setRemark(null);
|
||||
o.setCreateTime(null);
|
||||
o.setDeptId(null);
|
||||
o.setDeptName(null);
|
||||
o.setUserId(null);
|
||||
o.setCompanyId(null);
|
||||
o.setCompany(null);
|
||||
});
|
||||
organizationMapper.insert(dbOrganization);
|
||||
// 测试 organizationName 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setOrganizationName(null)));
|
||||
// 测试 organizationCode 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setOrganizationCode(null)));
|
||||
// 测试 caseNum 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setCaseNum(null)));
|
||||
// 测试 remark 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setRemark(null)));
|
||||
// 测试 createTime 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setCreateTime(null)));
|
||||
// 测试 deptId 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setDeptId(null)));
|
||||
// 测试 deptName 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setDeptName(null)));
|
||||
// 测试 userId 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setUserId(null)));
|
||||
// 测试 companyId 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setCompanyId(null)));
|
||||
// 测试 company 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setCompany(null)));
|
||||
// 准备参数
|
||||
OrganizationPageReqVO reqVO = new OrganizationPageReqVO();
|
||||
reqVO.setOrganizationName(null);
|
||||
reqVO.setOrganizationCode(null);
|
||||
reqVO.setCaseNum(null);
|
||||
reqVO.setRemark(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setDeptId(null);
|
||||
reqVO.setDeptName(null);
|
||||
reqVO.setUserId(null);
|
||||
reqVO.setCompanyId(null);
|
||||
reqVO.setCompany(null);
|
||||
|
||||
// 调用
|
||||
PageResult<OrganizationDO> pageResult = organizationService.getOrganizationPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbOrganization, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetOrganizationList() {
|
||||
// mock 数据
|
||||
OrganizationDO dbOrganization = randomPojo(OrganizationDO.class, o -> { // 等会查询到
|
||||
o.setOrganizationName(null);
|
||||
o.setOrganizationCode(null);
|
||||
o.setCaseNum(null);
|
||||
o.setRemark(null);
|
||||
o.setCreateTime(null);
|
||||
o.setDeptId(null);
|
||||
o.setDeptName(null);
|
||||
o.setUserId(null);
|
||||
o.setCompanyId(null);
|
||||
o.setCompany(null);
|
||||
});
|
||||
organizationMapper.insert(dbOrganization);
|
||||
// 测试 organizationName 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setOrganizationName(null)));
|
||||
// 测试 organizationCode 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setOrganizationCode(null)));
|
||||
// 测试 caseNum 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setCaseNum(null)));
|
||||
// 测试 remark 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setRemark(null)));
|
||||
// 测试 createTime 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setCreateTime(null)));
|
||||
// 测试 deptId 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setDeptId(null)));
|
||||
// 测试 deptName 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setDeptName(null)));
|
||||
// 测试 userId 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setUserId(null)));
|
||||
// 测试 companyId 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setCompanyId(null)));
|
||||
// 测试 company 不匹配
|
||||
organizationMapper.insert(cloneIgnoreId(dbOrganization, o -> o.setCompany(null)));
|
||||
// 准备参数
|
||||
OrganizationExportReqVO reqVO = new OrganizationExportReqVO();
|
||||
reqVO.setOrganizationName(null);
|
||||
reqVO.setOrganizationCode(null);
|
||||
reqVO.setCaseNum(null);
|
||||
reqVO.setRemark(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setDeptId(null);
|
||||
reqVO.setDeptName(null);
|
||||
reqVO.setUserId(null);
|
||||
reqVO.setCompanyId(null);
|
||||
reqVO.setCompany(null);
|
||||
|
||||
// 调用
|
||||
List<OrganizationDO> list = organizationService.getOrganizationList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbOrganization, list.get(0));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue