forked from sfms3.0/sfms3.0
16 changed files with 1017 additions and 0 deletions
@ -0,0 +1,101 @@ |
|||||
|
package com.win.module.wms.controller.enterprise; |
||||
|
|
||||
|
import com.win.module.wms.controller.enterprise.vo.*; |
||||
|
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.*; |
||||
|
import javax.servlet.http.*; |
||||
|
import java.util.*; |
||||
|
import java.io.IOException; |
||||
|
|
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
import com.win.framework.common.pojo.CommonResult; |
||||
|
import static com.win.framework.common.pojo.CommonResult.success; |
||||
|
|
||||
|
import com.win.framework.excel.core.util.ExcelUtils; |
||||
|
|
||||
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
||||
|
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.*; |
||||
|
|
||||
|
import com.win.module.wms.dal.dataobject.enterprise.EnterpriseDO; |
||||
|
import com.win.module.wms.convert.enterprise.EnterpriseConvert; |
||||
|
import com.win.module.wms.service.enterprise.EnterpriseService; |
||||
|
|
||||
|
@Tag(name = "管理后台 - 企业") |
||||
|
@RestController |
||||
|
@RequestMapping("/wms/enterprise") |
||||
|
@Validated |
||||
|
public class EnterpriseController { |
||||
|
|
||||
|
@Resource |
||||
|
private EnterpriseService enterpriseService; |
||||
|
|
||||
|
@PostMapping("/create") |
||||
|
@Operation(summary = "创建企业") |
||||
|
@PreAuthorize("@ss.hasPermission('wms:enterprise:create')") |
||||
|
public CommonResult<Long> createEnterprise(@Valid @RequestBody EnterpriseCreateReqVO createReqVO) { |
||||
|
return success(enterpriseService.createEnterprise(createReqVO)); |
||||
|
} |
||||
|
|
||||
|
@PutMapping("/update") |
||||
|
@Operation(summary = "更新企业") |
||||
|
@PreAuthorize("@ss.hasPermission('wms:enterprise:update')") |
||||
|
public CommonResult<Boolean> updateEnterprise(@Valid @RequestBody EnterpriseUpdateReqVO updateReqVO) { |
||||
|
enterpriseService.updateEnterprise(updateReqVO); |
||||
|
return success(true); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping("/delete") |
||||
|
@Operation(summary = "删除企业") |
||||
|
@Parameter(name = "id", description = "编号", required = true) |
||||
|
@PreAuthorize("@ss.hasPermission('wms:enterprise:delete')") |
||||
|
public CommonResult<Boolean> deleteEnterprise(@RequestParam("id") Long id) { |
||||
|
enterpriseService.deleteEnterprise(id); |
||||
|
return success(true); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/get") |
||||
|
@Operation(summary = "获得企业") |
||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
||||
|
@PreAuthorize("@ss.hasPermission('wms:enterprise:query')") |
||||
|
public CommonResult<EnterpriseRespVO> getEnterprise(@RequestParam("id") Long id) { |
||||
|
EnterpriseDO enterprise = enterpriseService.getEnterprise(id); |
||||
|
return success(EnterpriseConvert.INSTANCE.convert(enterprise)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/list") |
||||
|
@Operation(summary = "获得企业列表") |
||||
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") |
||||
|
@PreAuthorize("@ss.hasPermission('wms:enterprise:query')") |
||||
|
public CommonResult<List<EnterpriseRespVO>> getEnterpriseList(@RequestParam("ids") Collection<Long> ids) { |
||||
|
List<EnterpriseDO> list = enterpriseService.getEnterpriseList(ids); |
||||
|
return success(EnterpriseConvert.INSTANCE.convertList(list)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/page") |
||||
|
@Operation(summary = "获得企业分页") |
||||
|
@PreAuthorize("@ss.hasPermission('wms:enterprise:query')") |
||||
|
public CommonResult<PageResult<EnterpriseRespVO>> getEnterprisePage(@Valid EnterprisePageReqVO pageVO) { |
||||
|
PageResult<EnterpriseDO> pageResult = enterpriseService.getEnterprisePage(pageVO); |
||||
|
return success(EnterpriseConvert.INSTANCE.convertPage(pageResult)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/export-excel") |
||||
|
@Operation(summary = "导出企业 Excel") |
||||
|
@PreAuthorize("@ss.hasPermission('wms:enterprise:export')") |
||||
|
@OperateLog(type = EXPORT) |
||||
|
public void exportEnterpriseExcel(@Valid EnterpriseExportReqVO exportReqVO, |
||||
|
HttpServletResponse response) throws IOException { |
||||
|
List<EnterpriseDO> list = enterpriseService.getEnterpriseList(exportReqVO); |
||||
|
// 导出 Excel
|
||||
|
List<EnterpriseExcelVO> datas = EnterpriseConvert.INSTANCE.convertList02(list); |
||||
|
ExcelUtils.write(response, "企业.xls", "数据", EnterpriseExcelVO.class, datas); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
package com.win.module.wms.controller.enterprise.vo; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import javax.validation.constraints.*; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
||||
|
|
||||
|
/** |
||||
|
* 企业 Base VO,提供给添加、修改、详细的子 VO 使用 |
||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EnterpriseBaseVO { |
||||
|
|
||||
|
@Schema(description = "代码", requiredMode = Schema.RequiredMode.REQUIRED) |
||||
|
@NotNull(message = "代码不能为空") |
||||
|
private String code; |
||||
|
|
||||
|
@Schema(description = "名称", example = "芋艿") |
||||
|
private String name; |
||||
|
|
||||
|
@Schema(description = "简称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") |
||||
|
@NotNull(message = "简称不能为空") |
||||
|
private String shortName; |
||||
|
|
||||
|
@Schema(description = "地址") |
||||
|
private String address; |
||||
|
|
||||
|
@Schema(description = "是否可用", requiredMode = Schema.RequiredMode.REQUIRED) |
||||
|
@NotNull(message = "是否可用不能为空") |
||||
|
private String available; |
||||
|
|
||||
|
@Schema(description = "生效时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime activeTime; |
||||
|
|
||||
|
@Schema(description = "失效时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime expireTime; |
||||
|
|
||||
|
@Schema(description = "备注", example = "你说的对") |
||||
|
private String remark; |
||||
|
|
||||
|
@Schema(description = "删除时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime deletionTime; |
||||
|
|
||||
|
@Schema(description = "删除者ID", example = "18756") |
||||
|
private String deleterId; |
||||
|
|
||||
|
@Schema(description = "扩展属性") |
||||
|
private String extraProperties; |
||||
|
|
||||
|
@Schema(description = "并发乐观锁") |
||||
|
private String concurrencyStamp; |
||||
|
|
||||
|
@Schema(description = "地点ID", example = "14716") |
||||
|
private String siteId; |
||||
|
|
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.win.module.wms.controller.enterprise.vo; |
||||
|
|
||||
|
import lombok.*; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 企业创建 Request VO") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
public class EnterpriseCreateReqVO extends EnterpriseBaseVO { |
||||
|
|
||||
|
} |
@ -0,0 +1,67 @@ |
|||||
|
package com.win.module.wms.controller.enterprise.vo; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||
|
|
||||
|
/** |
||||
|
* 企业 Excel VO |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EnterpriseExcelVO { |
||||
|
|
||||
|
@ExcelProperty("id") |
||||
|
private Long id; |
||||
|
|
||||
|
@ExcelProperty("代码") |
||||
|
private String code; |
||||
|
|
||||
|
@ExcelProperty("名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ExcelProperty("简称") |
||||
|
private String shortName; |
||||
|
|
||||
|
@ExcelProperty("地址") |
||||
|
private String address; |
||||
|
|
||||
|
@ExcelProperty("是否可用") |
||||
|
private String available; |
||||
|
|
||||
|
@ExcelProperty("生效时间") |
||||
|
private LocalDateTime activeTime; |
||||
|
|
||||
|
@ExcelProperty("失效时间") |
||||
|
private LocalDateTime expireTime; |
||||
|
|
||||
|
@ExcelProperty("备注") |
||||
|
private String remark; |
||||
|
|
||||
|
@ExcelProperty("创建时间") |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
@ExcelProperty("删除时间") |
||||
|
private LocalDateTime deletionTime; |
||||
|
|
||||
|
@ExcelProperty("删除者ID") |
||||
|
private String deleterId; |
||||
|
|
||||
|
@ExcelProperty("扩展属性") |
||||
|
private String extraProperties; |
||||
|
|
||||
|
@ExcelProperty("并发乐观锁") |
||||
|
private String concurrencyStamp; |
||||
|
|
||||
|
@ExcelProperty("地点ID") |
||||
|
private String siteId; |
||||
|
|
||||
|
} |
@ -0,0 +1,62 @@ |
|||||
|
package com.win.module.wms.controller.enterprise.vo; |
||||
|
|
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import com.win.framework.common.pojo.PageParam; |
||||
|
import java.time.LocalDateTime; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 企业 Excel 导出 Request VO,参数和 EnterprisePageReqVO 是一致的") |
||||
|
@Data |
||||
|
public class EnterpriseExportReqVO { |
||||
|
|
||||
|
@Schema(description = "代码") |
||||
|
private String code; |
||||
|
|
||||
|
@Schema(description = "名称", example = "芋艿") |
||||
|
private String name; |
||||
|
|
||||
|
@Schema(description = "简称", example = "李四") |
||||
|
private String shortName; |
||||
|
|
||||
|
@Schema(description = "地址") |
||||
|
private String address; |
||||
|
|
||||
|
@Schema(description = "是否可用") |
||||
|
private String available; |
||||
|
|
||||
|
@Schema(description = "生效时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime[] activeTime; |
||||
|
|
||||
|
@Schema(description = "失效时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime[] expireTime; |
||||
|
|
||||
|
@Schema(description = "备注", example = "你说的对") |
||||
|
private String remark; |
||||
|
|
||||
|
@Schema(description = "创建时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime[] createTime; |
||||
|
|
||||
|
@Schema(description = "删除时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime[] deletionTime; |
||||
|
|
||||
|
@Schema(description = "删除者ID", example = "18756") |
||||
|
private String deleterId; |
||||
|
|
||||
|
@Schema(description = "扩展属性") |
||||
|
private String extraProperties; |
||||
|
|
||||
|
@Schema(description = "并发乐观锁") |
||||
|
private String concurrencyStamp; |
||||
|
|
||||
|
@Schema(description = "地点ID", example = "14716") |
||||
|
private String siteId; |
||||
|
|
||||
|
} |
@ -0,0 +1,64 @@ |
|||||
|
package com.win.module.wms.controller.enterprise.vo; |
||||
|
|
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import com.win.framework.common.pojo.PageParam; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
import static com.win.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 EnterprisePageReqVO extends PageParam { |
||||
|
|
||||
|
@Schema(description = "代码") |
||||
|
private String code; |
||||
|
|
||||
|
@Schema(description = "名称", example = "芋艿") |
||||
|
private String name; |
||||
|
|
||||
|
@Schema(description = "简称", example = "李四") |
||||
|
private String shortName; |
||||
|
|
||||
|
@Schema(description = "地址") |
||||
|
private String address; |
||||
|
|
||||
|
@Schema(description = "是否可用") |
||||
|
private String available; |
||||
|
|
||||
|
@Schema(description = "生效时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime[] activeTime; |
||||
|
|
||||
|
@Schema(description = "失效时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime[] expireTime; |
||||
|
|
||||
|
@Schema(description = "备注", example = "你说的对") |
||||
|
private String remark; |
||||
|
|
||||
|
@Schema(description = "创建时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime[] createTime; |
||||
|
|
||||
|
@Schema(description = "删除时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime[] deletionTime; |
||||
|
|
||||
|
@Schema(description = "删除者ID", example = "18756") |
||||
|
private String deleterId; |
||||
|
|
||||
|
@Schema(description = "扩展属性") |
||||
|
private String extraProperties; |
||||
|
|
||||
|
@Schema(description = "并发乐观锁") |
||||
|
private String concurrencyStamp; |
||||
|
|
||||
|
@Schema(description = "地点ID", example = "14716") |
||||
|
private String siteId; |
||||
|
|
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
package com.win.module.wms.controller.enterprise.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 EnterpriseRespVO extends EnterpriseBaseVO { |
||||
|
|
||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "29956") |
||||
|
private Long id; |
||||
|
|
||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package com.win.module.wms.controller.enterprise.vo; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.*; |
||||
|
|
||||
|
import javax.validation.constraints.*; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 企业更新 Request VO") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
public class EnterpriseUpdateReqVO extends EnterpriseBaseVO { |
||||
|
|
||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "29956") |
||||
|
@NotNull(message = "id不能为空") |
||||
|
private Long id; |
||||
|
|
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package com.win.module.wms.convert.enterprise; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
|
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseCreateReqVO; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseExcelVO; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseRespVO; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseUpdateReqVO; |
||||
|
import org.mapstruct.Mapper; |
||||
|
import org.mapstruct.factory.Mappers; |
||||
|
import com.win.module.wms.dal.dataobject.enterprise.EnterpriseDO; |
||||
|
|
||||
|
/** |
||||
|
* 企业 Convert |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface EnterpriseConvert { |
||||
|
|
||||
|
EnterpriseConvert INSTANCE = Mappers.getMapper(EnterpriseConvert.class); |
||||
|
|
||||
|
EnterpriseDO convert(EnterpriseCreateReqVO bean); |
||||
|
|
||||
|
EnterpriseDO convert(EnterpriseUpdateReqVO bean); |
||||
|
|
||||
|
EnterpriseRespVO convert(EnterpriseDO bean); |
||||
|
|
||||
|
List<EnterpriseRespVO> convertList(List<EnterpriseDO> list); |
||||
|
|
||||
|
PageResult<EnterpriseRespVO> convertPage(PageResult<EnterpriseDO> page); |
||||
|
|
||||
|
List<EnterpriseExcelVO> convertList02(List<EnterpriseDO> list); |
||||
|
|
||||
|
} |
@ -0,0 +1,85 @@ |
|||||
|
package com.win.module.wms.dal.dataobject.enterprise; |
||||
|
|
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import com.win.framework.mybatis.core.dataobject.BaseDO; |
||||
|
|
||||
|
/** |
||||
|
* 企业 DO |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
@TableName("basic_enterprise") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class EnterpriseDO extends BaseDO { |
||||
|
|
||||
|
/** |
||||
|
* id |
||||
|
*/ |
||||
|
@TableId |
||||
|
private Long id; |
||||
|
/** |
||||
|
* 代码 |
||||
|
*/ |
||||
|
private String code; |
||||
|
/** |
||||
|
* 名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
/** |
||||
|
* 简称 |
||||
|
*/ |
||||
|
private String shortName; |
||||
|
/** |
||||
|
* 地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
/** |
||||
|
* 是否可用 |
||||
|
*/ |
||||
|
private String available; |
||||
|
/** |
||||
|
* 生效时间 |
||||
|
*/ |
||||
|
private LocalDateTime activeTime; |
||||
|
/** |
||||
|
* 失效时间 |
||||
|
*/ |
||||
|
private LocalDateTime expireTime; |
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
/** |
||||
|
* 删除时间 |
||||
|
*/ |
||||
|
private LocalDateTime deletionTime; |
||||
|
/** |
||||
|
* 删除者ID |
||||
|
*/ |
||||
|
private String deleterId; |
||||
|
/** |
||||
|
* 扩展属性 |
||||
|
*/ |
||||
|
private String extraProperties; |
||||
|
/** |
||||
|
* 并发乐观锁 |
||||
|
*/ |
||||
|
private String concurrencyStamp; |
||||
|
/** |
||||
|
* 地点ID |
||||
|
*/ |
||||
|
private String siteId; |
||||
|
|
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
package com.win.module.wms.dal.mysql.enterprise; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; |
||||
|
import com.win.framework.mybatis.core.mapper.BaseMapperX; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseExportReqVO; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterprisePageReqVO; |
||||
|
import com.win.module.wms.dal.dataobject.enterprise.EnterpriseDO; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 企业 Mapper |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface EnterpriseMapper extends BaseMapperX<EnterpriseDO> { |
||||
|
|
||||
|
default PageResult<EnterpriseDO> selectPage(EnterprisePageReqVO reqVO) { |
||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<EnterpriseDO>() |
||||
|
.eqIfPresent(EnterpriseDO::getCode, reqVO.getCode()) |
||||
|
.likeIfPresent(EnterpriseDO::getName, reqVO.getName()) |
||||
|
.likeIfPresent(EnterpriseDO::getShortName, reqVO.getShortName()) |
||||
|
.eqIfPresent(EnterpriseDO::getAddress, reqVO.getAddress()) |
||||
|
.eqIfPresent(EnterpriseDO::getAvailable, reqVO.getAvailable()) |
||||
|
.betweenIfPresent(EnterpriseDO::getActiveTime, reqVO.getActiveTime()) |
||||
|
.betweenIfPresent(EnterpriseDO::getExpireTime, reqVO.getExpireTime()) |
||||
|
.eqIfPresent(EnterpriseDO::getRemark, reqVO.getRemark()) |
||||
|
.betweenIfPresent(EnterpriseDO::getCreateTime, reqVO.getCreateTime()) |
||||
|
.betweenIfPresent(EnterpriseDO::getDeletionTime, reqVO.getDeletionTime()) |
||||
|
.eqIfPresent(EnterpriseDO::getDeleterId, reqVO.getDeleterId()) |
||||
|
.eqIfPresent(EnterpriseDO::getExtraProperties, reqVO.getExtraProperties()) |
||||
|
.eqIfPresent(EnterpriseDO::getConcurrencyStamp, reqVO.getConcurrencyStamp()) |
||||
|
.eqIfPresent(EnterpriseDO::getSiteId, reqVO.getSiteId()) |
||||
|
.orderByDesc(EnterpriseDO::getId)); |
||||
|
} |
||||
|
|
||||
|
default List<EnterpriseDO> selectList(EnterpriseExportReqVO reqVO) { |
||||
|
return selectList(new LambdaQueryWrapperX<EnterpriseDO>() |
||||
|
.eqIfPresent(EnterpriseDO::getCode, reqVO.getCode()) |
||||
|
.likeIfPresent(EnterpriseDO::getName, reqVO.getName()) |
||||
|
.likeIfPresent(EnterpriseDO::getShortName, reqVO.getShortName()) |
||||
|
.eqIfPresent(EnterpriseDO::getAddress, reqVO.getAddress()) |
||||
|
.eqIfPresent(EnterpriseDO::getAvailable, reqVO.getAvailable()) |
||||
|
.betweenIfPresent(EnterpriseDO::getActiveTime, reqVO.getActiveTime()) |
||||
|
.betweenIfPresent(EnterpriseDO::getExpireTime, reqVO.getExpireTime()) |
||||
|
.eqIfPresent(EnterpriseDO::getRemark, reqVO.getRemark()) |
||||
|
.betweenIfPresent(EnterpriseDO::getCreateTime, reqVO.getCreateTime()) |
||||
|
.betweenIfPresent(EnterpriseDO::getDeletionTime, reqVO.getDeletionTime()) |
||||
|
.eqIfPresent(EnterpriseDO::getDeleterId, reqVO.getDeleterId()) |
||||
|
.eqIfPresent(EnterpriseDO::getExtraProperties, reqVO.getExtraProperties()) |
||||
|
.eqIfPresent(EnterpriseDO::getConcurrencyStamp, reqVO.getConcurrencyStamp()) |
||||
|
.eqIfPresent(EnterpriseDO::getSiteId, reqVO.getSiteId()) |
||||
|
.orderByDesc(EnterpriseDO::getId)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,74 @@ |
|||||
|
package com.win.module.wms.service.enterprise; |
||||
|
|
||||
|
import java.util.*; |
||||
|
import javax.validation.*; |
||||
|
|
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseCreateReqVO; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseExportReqVO; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterprisePageReqVO; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseUpdateReqVO; |
||||
|
import com.win.module.wms.dal.dataobject.enterprise.EnterpriseDO; |
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
|
||||
|
/** |
||||
|
* 企业 Service 接口 |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
public interface EnterpriseService { |
||||
|
|
||||
|
/** |
||||
|
* 创建企业 |
||||
|
* |
||||
|
* @param createReqVO 创建信息 |
||||
|
* @return 编号 |
||||
|
*/ |
||||
|
Long createEnterprise(@Valid EnterpriseCreateReqVO createReqVO); |
||||
|
|
||||
|
/** |
||||
|
* 更新企业 |
||||
|
* |
||||
|
* @param updateReqVO 更新信息 |
||||
|
*/ |
||||
|
void updateEnterprise(@Valid EnterpriseUpdateReqVO updateReqVO); |
||||
|
|
||||
|
/** |
||||
|
* 删除企业 |
||||
|
* |
||||
|
* @param id 编号 |
||||
|
*/ |
||||
|
void deleteEnterprise(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 获得企业 |
||||
|
* |
||||
|
* @param id 编号 |
||||
|
* @return 企业 |
||||
|
*/ |
||||
|
EnterpriseDO getEnterprise(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 获得企业列表 |
||||
|
* |
||||
|
* @param ids 编号 |
||||
|
* @return 企业列表 |
||||
|
*/ |
||||
|
List<EnterpriseDO> getEnterpriseList(Collection<Long> ids); |
||||
|
|
||||
|
/** |
||||
|
* 获得企业分页 |
||||
|
* |
||||
|
* @param pageReqVO 分页查询 |
||||
|
* @return 企业分页 |
||||
|
*/ |
||||
|
PageResult<EnterpriseDO> getEnterprisePage(EnterprisePageReqVO pageReqVO); |
||||
|
|
||||
|
/** |
||||
|
* 获得企业列表, 用于 Excel 导出 |
||||
|
* |
||||
|
* @param exportReqVO 查询条件 |
||||
|
* @return 企业列表 |
||||
|
*/ |
||||
|
List<EnterpriseDO> getEnterpriseList(EnterpriseExportReqVO exportReqVO); |
||||
|
|
||||
|
} |
@ -0,0 +1,86 @@ |
|||||
|
package com.win.module.wms.service.enterprise; |
||||
|
|
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseCreateReqVO; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseExportReqVO; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterprisePageReqVO; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseUpdateReqVO; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import javax.annotation.Resource; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
import com.win.module.wms.dal.dataobject.enterprise.EnterpriseDO; |
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
|
||||
|
import com.win.module.wms.convert.enterprise.EnterpriseConvert; |
||||
|
import com.win.module.wms.dal.mysql.enterprise.EnterpriseMapper; |
||||
|
|
||||
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
||||
|
import static com.win.module.wms.enums.ErrorCodeConstants.ENTERPRISE_NOT_EXISTS; |
||||
|
|
||||
|
/** |
||||
|
* 企业 Service 实现类 |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
@Service |
||||
|
@Validated |
||||
|
public class EnterpriseServiceImpl implements EnterpriseService { |
||||
|
|
||||
|
@Resource |
||||
|
private EnterpriseMapper enterpriseMapper; |
||||
|
|
||||
|
@Override |
||||
|
public Long createEnterprise(EnterpriseCreateReqVO createReqVO) { |
||||
|
// 插入
|
||||
|
EnterpriseDO enterprise = EnterpriseConvert.INSTANCE.convert(createReqVO); |
||||
|
enterpriseMapper.insert(enterprise); |
||||
|
// 返回
|
||||
|
return enterprise.getId(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void updateEnterprise(EnterpriseUpdateReqVO updateReqVO) { |
||||
|
// 校验存在
|
||||
|
validateEnterpriseExists(updateReqVO.getId()); |
||||
|
// 更新
|
||||
|
EnterpriseDO updateObj = EnterpriseConvert.INSTANCE.convert(updateReqVO); |
||||
|
enterpriseMapper.updateById(updateObj); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void deleteEnterprise(Long id) { |
||||
|
// 校验存在
|
||||
|
validateEnterpriseExists(id); |
||||
|
// 删除
|
||||
|
enterpriseMapper.deleteById(id); |
||||
|
} |
||||
|
|
||||
|
private void validateEnterpriseExists(Long id) { |
||||
|
if (enterpriseMapper.selectById(id) == null) { |
||||
|
throw exception(ENTERPRISE_NOT_EXISTS); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public EnterpriseDO getEnterprise(Long id) { |
||||
|
return enterpriseMapper.selectById(id); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<EnterpriseDO> getEnterpriseList(Collection<Long> ids) { |
||||
|
return enterpriseMapper.selectBatchIds(ids); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageResult<EnterpriseDO> getEnterprisePage(EnterprisePageReqVO pageReqVO) { |
||||
|
return enterpriseMapper.selectPage(pageReqVO); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<EnterpriseDO> getEnterpriseList(EnterpriseExportReqVO exportReqVO) { |
||||
|
return enterpriseMapper.selectList(exportReqVO); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.win.module.wms.dal.mysql.enterprise.EnterpriseMapper"> |
||||
|
|
||||
|
<!-- |
||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 |
||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 |
||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 |
||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ |
||||
|
--> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,251 @@ |
|||||
|
package com.win.module.wms.service.enterprise; |
||||
|
|
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseCreateReqVO; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseExportReqVO; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterprisePageReqVO; |
||||
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseUpdateReqVO; |
||||
|
import org.junit.jupiter.api.Disabled; |
||||
|
import org.junit.jupiter.api.Test; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
|
||||
|
import com.win.framework.test.core.ut.BaseDbUnitTest; |
||||
|
|
||||
|
import com.win.module.wms.dal.dataobject.enterprise.EnterpriseDO; |
||||
|
import com.win.module.wms.dal.mysql.enterprise.EnterpriseMapper; |
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
|
||||
|
import org.springframework.context.annotation.Import; |
||||
|
import java.util.*; |
||||
|
|
||||
|
import static com.win.framework.test.core.util.AssertUtils.*; |
||||
|
import static com.win.framework.test.core.util.RandomUtils.*; |
||||
|
import static com.win.framework.common.util.date.LocalDateTimeUtils.*; |
||||
|
import static com.win.framework.common.util.object.ObjectUtils.*; |
||||
|
import static org.junit.jupiter.api.Assertions.*; |
||||
|
|
||||
|
/** |
||||
|
* {@link EnterpriseServiceImpl} 的单元测试类 |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
@Import(EnterpriseServiceImpl.class) |
||||
|
public class EnterpriseServiceImplTest extends BaseDbUnitTest { |
||||
|
|
||||
|
@Resource |
||||
|
private EnterpriseServiceImpl enterpriseService; |
||||
|
|
||||
|
@Resource |
||||
|
private EnterpriseMapper enterpriseMapper; |
||||
|
|
||||
|
@Test |
||||
|
public void testCreateEnterprise_success() { |
||||
|
// 准备参数
|
||||
|
EnterpriseCreateReqVO reqVO = randomPojo(EnterpriseCreateReqVO.class); |
||||
|
|
||||
|
// 调用
|
||||
|
Long enterpriseId = enterpriseService.createEnterprise(reqVO); |
||||
|
// 断言
|
||||
|
assertNotNull(enterpriseId); |
||||
|
// 校验记录的属性是否正确
|
||||
|
EnterpriseDO enterprise = enterpriseMapper.selectById(enterpriseId); |
||||
|
assertPojoEquals(reqVO, enterprise); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
public void testUpdateEnterprise_success() { |
||||
|
// mock 数据
|
||||
|
EnterpriseDO dbEnterprise = randomPojo(EnterpriseDO.class); |
||||
|
enterpriseMapper.insert(dbEnterprise);// @Sql: 先插入出一条存在的数据
|
||||
|
// 准备参数
|
||||
|
EnterpriseUpdateReqVO reqVO = randomPojo(EnterpriseUpdateReqVO.class, o -> { |
||||
|
o.setId(dbEnterprise.getId()); // 设置更新的 ID
|
||||
|
}); |
||||
|
|
||||
|
// 调用
|
||||
|
enterpriseService.updateEnterprise(reqVO); |
||||
|
// 校验是否更新正确
|
||||
|
EnterpriseDO enterprise = enterpriseMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
|
assertPojoEquals(reqVO, enterprise); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
public void testUpdateEnterprise_notExists() { |
||||
|
// 准备参数
|
||||
|
EnterpriseUpdateReqVO reqVO = randomPojo(EnterpriseUpdateReqVO.class); |
||||
|
|
||||
|
// 调用, 并断言异常
|
||||
|
assertServiceException(() -> enterpriseService.updateEnterprise(reqVO), ENTERPRISE_NOT_EXISTS); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
public void testDeleteEnterprise_success() { |
||||
|
// mock 数据
|
||||
|
EnterpriseDO dbEnterprise = randomPojo(EnterpriseDO.class); |
||||
|
enterpriseMapper.insert(dbEnterprise);// @Sql: 先插入出一条存在的数据
|
||||
|
// 准备参数
|
||||
|
Long id = dbEnterprise.getId(); |
||||
|
|
||||
|
// 调用
|
||||
|
enterpriseService.deleteEnterprise(id); |
||||
|
// 校验数据不存在了
|
||||
|
assertNull(enterpriseMapper.selectById(id)); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
public void testDeleteEnterprise_notExists() { |
||||
|
// 准备参数
|
||||
|
Long id = randomLongId(); |
||||
|
|
||||
|
// 调用, 并断言异常
|
||||
|
assertServiceException(() -> enterpriseService.deleteEnterprise(id), ENTERPRISE_NOT_EXISTS); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
|
public void testGetEnterprisePage() { |
||||
|
// mock 数据
|
||||
|
EnterpriseDO dbEnterprise = randomPojo(EnterpriseDO.class, o -> { // 等会查询到
|
||||
|
o.setCode(null); |
||||
|
o.setName(null); |
||||
|
o.setShortName(null); |
||||
|
o.setAddress(null); |
||||
|
o.setAvailable(null); |
||||
|
o.setActiveTime(null); |
||||
|
o.setExpireTime(null); |
||||
|
o.setRemark(null); |
||||
|
o.setCreateTime(null); |
||||
|
o.setDeletionTime(null); |
||||
|
o.setDeleterId(null); |
||||
|
o.setExtraProperties(null); |
||||
|
o.setConcurrencyStamp(null); |
||||
|
o.setSiteId(null); |
||||
|
}); |
||||
|
enterpriseMapper.insert(dbEnterprise); |
||||
|
// 测试 code 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setCode(null))); |
||||
|
// 测试 name 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setName(null))); |
||||
|
// 测试 shortName 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setShortName(null))); |
||||
|
// 测试 address 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setAddress(null))); |
||||
|
// 测试 available 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setAvailable(null))); |
||||
|
// 测试 activeTime 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setActiveTime(null))); |
||||
|
// 测试 expireTime 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setExpireTime(null))); |
||||
|
// 测试 remark 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setRemark(null))); |
||||
|
// 测试 createTime 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setCreateTime(null))); |
||||
|
// 测试 deletionTime 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setDeletionTime(null))); |
||||
|
// 测试 deleterId 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setDeleterId(null))); |
||||
|
// 测试 extraProperties 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setExtraProperties(null))); |
||||
|
// 测试 concurrencyStamp 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setConcurrencyStamp(null))); |
||||
|
// 测试 siteId 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setSiteId(null))); |
||||
|
// 准备参数
|
||||
|
EnterprisePageReqVO reqVO = new EnterprisePageReqVO(); |
||||
|
reqVO.setCode(null); |
||||
|
reqVO.setName(null); |
||||
|
reqVO.setShortName(null); |
||||
|
reqVO.setAddress(null); |
||||
|
reqVO.setAvailable(null); |
||||
|
reqVO.setActiveTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); |
||||
|
reqVO.setExpireTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); |
||||
|
reqVO.setRemark(null); |
||||
|
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); |
||||
|
reqVO.setDeletionTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); |
||||
|
reqVO.setDeleterId(null); |
||||
|
reqVO.setExtraProperties(null); |
||||
|
reqVO.setConcurrencyStamp(null); |
||||
|
reqVO.setSiteId(null); |
||||
|
|
||||
|
// 调用
|
||||
|
PageResult<EnterpriseDO> pageResult = enterpriseService.getEnterprisePage(reqVO); |
||||
|
// 断言
|
||||
|
assertEquals(1, pageResult.getTotal()); |
||||
|
assertEquals(1, pageResult.getList().size()); |
||||
|
assertPojoEquals(dbEnterprise, pageResult.getList().get(0)); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
|
public void testGetEnterpriseList() { |
||||
|
// mock 数据
|
||||
|
EnterpriseDO dbEnterprise = randomPojo(EnterpriseDO.class, o -> { // 等会查询到
|
||||
|
o.setCode(null); |
||||
|
o.setName(null); |
||||
|
o.setShortName(null); |
||||
|
o.setAddress(null); |
||||
|
o.setAvailable(null); |
||||
|
o.setActiveTime(null); |
||||
|
o.setExpireTime(null); |
||||
|
o.setRemark(null); |
||||
|
o.setCreateTime(null); |
||||
|
o.setDeletionTime(null); |
||||
|
o.setDeleterId(null); |
||||
|
o.setExtraProperties(null); |
||||
|
o.setConcurrencyStamp(null); |
||||
|
o.setSiteId(null); |
||||
|
}); |
||||
|
enterpriseMapper.insert(dbEnterprise); |
||||
|
// 测试 code 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setCode(null))); |
||||
|
// 测试 name 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setName(null))); |
||||
|
// 测试 shortName 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setShortName(null))); |
||||
|
// 测试 address 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setAddress(null))); |
||||
|
// 测试 available 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setAvailable(null))); |
||||
|
// 测试 activeTime 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setActiveTime(null))); |
||||
|
// 测试 expireTime 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setExpireTime(null))); |
||||
|
// 测试 remark 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setRemark(null))); |
||||
|
// 测试 createTime 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setCreateTime(null))); |
||||
|
// 测试 deletionTime 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setDeletionTime(null))); |
||||
|
// 测试 deleterId 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setDeleterId(null))); |
||||
|
// 测试 extraProperties 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setExtraProperties(null))); |
||||
|
// 测试 concurrencyStamp 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setConcurrencyStamp(null))); |
||||
|
// 测试 siteId 不匹配
|
||||
|
enterpriseMapper.insert(cloneIgnoreId(dbEnterprise, o -> o.setSiteId(null))); |
||||
|
// 准备参数
|
||||
|
EnterpriseExportReqVO reqVO = new EnterpriseExportReqVO(); |
||||
|
reqVO.setCode(null); |
||||
|
reqVO.setName(null); |
||||
|
reqVO.setShortName(null); |
||||
|
reqVO.setAddress(null); |
||||
|
reqVO.setAvailable(null); |
||||
|
reqVO.setActiveTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); |
||||
|
reqVO.setExpireTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); |
||||
|
reqVO.setRemark(null); |
||||
|
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); |
||||
|
reqVO.setDeletionTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); |
||||
|
reqVO.setDeleterId(null); |
||||
|
reqVO.setExtraProperties(null); |
||||
|
reqVO.setConcurrencyStamp(null); |
||||
|
reqVO.setSiteId(null); |
||||
|
|
||||
|
// 调用
|
||||
|
List<EnterpriseDO> list = enterpriseService.getEnterpriseList(reqVO); |
||||
|
// 断言
|
||||
|
assertEquals(1, list.size()); |
||||
|
assertPojoEquals(dbEnterprise, list.get(0)); |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue