parent
0a118be1b9
commit
12e26128c4
@ -0,0 +1,110 @@
|
||||
package com.yunxi.scm.module.xxjj.controller.admin.businessline;
|
||||
|
||||
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 com.yunxi.scm.framework.common.pojo.PageResult;
|
||||
import com.yunxi.scm.framework.common.pojo.CommonResult;
|
||||
import static com.yunxi.scm.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.yunxi.scm.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.yunxi.scm.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.yunxi.scm.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.yunxi.scm.module.xxjj.controller.admin.businessline.vo.*;
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO;
|
||||
import com.yunxi.scm.module.xxjj.convert.businessline.BusinessLineConvert;
|
||||
import com.yunxi.scm.module.xxjj.service.businessline.BusinessLineService;
|
||||
|
||||
@Tag(name = "管理后台 - 业务线")
|
||||
@RestController
|
||||
@RequestMapping("/xxjj/business-line")
|
||||
@Validated
|
||||
public class BusinessLineController {
|
||||
|
||||
@Resource
|
||||
private BusinessLineService businessLineService;
|
||||
|
||||
@GetMapping("/tree")
|
||||
@Operation(summary = "获得业务线/仓库")
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:business-line:tree')")
|
||||
public CommonResult<List<BusinessLineRespVO>> getBusinessLineTree(@Valid BusinessLinePageReqVO pageVO) {
|
||||
List<BusinessLineDO> pageResult = businessLineService.getBusinessLineTree();
|
||||
return success(BusinessLineConvert.INSTANCE.convertList(pageResult));
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建业务线")
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:business-line:create')")
|
||||
public CommonResult<Long> createBusinessLine(@Valid @RequestBody BusinessLineCreateReqVO createReqVO) {
|
||||
return success(businessLineService.createBusinessLine(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新业务线")
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:business-line:update')")
|
||||
public CommonResult<Boolean> updateBusinessLine(@Valid @RequestBody BusinessLineUpdateReqVO updateReqVO) {
|
||||
businessLineService.updateBusinessLine(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除业务线")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:business-line:delete')")
|
||||
public CommonResult<Boolean> deleteBusinessLine(@RequestParam("id") Long id) {
|
||||
businessLineService.deleteBusinessLine(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得业务线")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:business-line:query')")
|
||||
public CommonResult<BusinessLineRespVO> getBusinessLine(@RequestParam("id") Long id) {
|
||||
BusinessLineDO businessLine = businessLineService.getBusinessLine(id);
|
||||
return success(BusinessLineConvert.INSTANCE.convert(businessLine));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得业务线列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:business-line:query')")
|
||||
public CommonResult<List<BusinessLineRespVO>> getBusinessLineList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<BusinessLineDO> list = businessLineService.getBusinessLineList(ids);
|
||||
return success(BusinessLineConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得业务线分页")
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:business-line:query')")
|
||||
public CommonResult<PageResult<BusinessLineRespVO>> getBusinessLinePage(@Valid BusinessLinePageReqVO pageVO) {
|
||||
PageResult<BusinessLineDO> pageResult = businessLineService.getBusinessLinePage(pageVO);
|
||||
return success(BusinessLineConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出业务线 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:business-line:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportBusinessLineExcel(@Valid BusinessLineExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<BusinessLineDO> list = businessLineService.getBusinessLineList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<BusinessLineExcelVO> datas = BusinessLineConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "业务线.xls", "数据", BusinessLineExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.yunxi.scm.module.xxjj.controller.admin.businessline.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 BusinessLineCreateReqVO extends BusinessLineBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.yunxi.scm.module.xxjj.controller.admin.businessline.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 com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 业务线 Excel VO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class BusinessLineExcelVO {
|
||||
|
||||
@ExcelProperty("业务id")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("业务线编号")
|
||||
private String businessCode;
|
||||
|
||||
@ExcelProperty("业务线名称")
|
||||
private String businessName;
|
||||
|
||||
@ExcelProperty("业务线简称")
|
||||
private String businessSimple;
|
||||
|
||||
@ExcelProperty("业务线LOGO")
|
||||
private String businessLogo;
|
||||
|
||||
@ExcelProperty("隶属企业")
|
||||
private Long affiliatCompanyId;
|
||||
|
||||
@ExcelProperty("类型")
|
||||
private String type;
|
||||
|
||||
@ExcelProperty("所属行业")
|
||||
private String industry;
|
||||
|
||||
@ExcelProperty("所在城市")
|
||||
private String city;
|
||||
|
||||
@ExcelProperty("成立时间")
|
||||
private LocalDateTime establishDate;
|
||||
|
||||
@ExcelProperty("归属人员")
|
||||
private Long belongUserId;
|
||||
|
||||
@ExcelProperty("品牌/业务线/事业群名称")
|
||||
private String brandName;
|
||||
|
||||
@ExcelProperty("电话")
|
||||
private Integer phone;
|
||||
|
||||
@ExcelProperty("传真")
|
||||
private String fax;
|
||||
|
||||
@ExcelProperty("网址")
|
||||
private String url;
|
||||
|
||||
@ExcelProperty("介绍")
|
||||
private String description;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.yunxi.scm.module.xxjj.controller.admin.businessline.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.yunxi.scm.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.yunxi.scm.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 BusinessLinePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "业务线编号")
|
||||
private String businessCode;
|
||||
|
||||
@Schema(description = "业务线名称", example = "赵六")
|
||||
private String businessName;
|
||||
|
||||
@Schema(description = "隶属企业", example = "16269")
|
||||
private Long affiliatCompanyId;
|
||||
|
||||
@Schema(description = "类型", example = "1")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "所属行业")
|
||||
private String industry;
|
||||
|
||||
@Schema(description = "所在城市")
|
||||
private String city;
|
||||
|
||||
@Schema(description = "成立时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] establishDate;
|
||||
|
||||
@Schema(description = "品牌/业务线/事业群名称", example = "张三")
|
||||
private String brandName;
|
||||
|
||||
@Schema(description = "电话")
|
||||
private Integer phone;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.yunxi.scm.module.xxjj.controller.admin.businessline.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 BusinessLineRespVO extends BusinessLineBaseVO {
|
||||
|
||||
@Schema(description = "业务id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12404")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.yunxi.scm.module.xxjj.controller.admin.businessline.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 BusinessLineUpdateReqVO extends BusinessLineBaseVO {
|
||||
|
||||
@Schema(description = "业务id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12404")
|
||||
@NotNull(message = "业务id不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package com.yunxi.scm.module.xxjj.controller.admin.warehouse;
|
||||
|
||||
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 com.yunxi.scm.framework.common.pojo.PageResult;
|
||||
import com.yunxi.scm.framework.common.pojo.CommonResult;
|
||||
import static com.yunxi.scm.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.yunxi.scm.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.yunxi.scm.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.yunxi.scm.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo.*;
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
|
||||
import com.yunxi.scm.module.xxjj.convert.warehouse.WarehouseConvert;
|
||||
import com.yunxi.scm.module.xxjj.service.warehouse.WarehouseService;
|
||||
|
||||
@Tag(name = "管理后台 - 仓库")
|
||||
@RestController
|
||||
@RequestMapping("/xxjj/warehouse")
|
||||
@Validated
|
||||
public class WarehouseController {
|
||||
|
||||
@Resource
|
||||
private WarehouseService warehouseService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建仓库")
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:create')")
|
||||
public CommonResult<Long> createWarehouse(@Valid @RequestBody WarehouseCreateReqVO createReqVO) {
|
||||
return success(warehouseService.createWarehouse(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新仓库")
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:update')")
|
||||
public CommonResult<Boolean> updateWarehouse(@Valid @RequestBody WarehouseUpdateReqVO updateReqVO) {
|
||||
warehouseService.updateWarehouse(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除仓库")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:delete')")
|
||||
public CommonResult<Boolean> deleteWarehouse(@RequestParam("id") Long id) {
|
||||
warehouseService.deleteWarehouse(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得仓库")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:query')")
|
||||
public CommonResult<WarehouseRespVO> getWarehouse(@RequestParam("id") Long id) {
|
||||
WarehouseDO warehouse = warehouseService.getWarehouse(id);
|
||||
return success(WarehouseConvert.INSTANCE.convert(warehouse));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得仓库列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:query')")
|
||||
public CommonResult<List<WarehouseRespVO>> getWarehouseList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<WarehouseDO> list = warehouseService.getWarehouseList(ids);
|
||||
return success(WarehouseConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得仓库分页")
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:query')")
|
||||
public CommonResult<PageResult<WarehouseRespVO>> getWarehousePage(@Valid WarehousePageReqVO pageVO) {
|
||||
PageResult<WarehouseDO> pageResult = warehouseService.getWarehousePage(pageVO);
|
||||
return success(WarehouseConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出仓库 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('xxjj:warehouse:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportWarehouseExcel(@Valid WarehouseExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<WarehouseDO> list = warehouseService.getWarehouseList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<WarehouseExcelVO> datas = WarehouseConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "仓库.xls", "数据", WarehouseExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.yunxi.scm.module.xxjj.controller.admin.warehouse.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 WarehouseCreateReqVO extends WarehouseBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.yunxi.scm.module.xxjj.controller.admin.warehouse.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 com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 仓库 Excel VO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class WarehouseExcelVO {
|
||||
|
||||
@ExcelProperty("仓库id")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("仓库编号")
|
||||
private String warehouseCode;
|
||||
|
||||
@ExcelProperty("仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ExcelProperty("仓库简称")
|
||||
private String warehouseSimple;
|
||||
|
||||
@ExcelProperty("隶属业务线")
|
||||
private Long affiliatLineId;
|
||||
|
||||
@ExcelProperty("类型")
|
||||
private String type;
|
||||
|
||||
@ExcelProperty("所在城市")
|
||||
private String city;
|
||||
|
||||
@ExcelProperty("成立时间")
|
||||
private LocalDateTime establishDate;
|
||||
|
||||
@ExcelProperty("归属人员")
|
||||
private Long belongUserId;
|
||||
|
||||
@ExcelProperty("介绍")
|
||||
private String description;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.yunxi.scm.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.yunxi.scm.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 WarehousePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "仓库编号")
|
||||
private String warehouseCode;
|
||||
|
||||
@Schema(description = "仓库名称", example = "芋艿")
|
||||
private String warehouseName;
|
||||
|
||||
@Schema(description = "隶属业务线", example = "28362")
|
||||
private Long affiliatLineId;
|
||||
|
||||
@Schema(description = "类型", example = "1")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "所在城市")
|
||||
private String city;
|
||||
|
||||
@Schema(description = "成立时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] establishDate;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.yunxi.scm.module.xxjj.controller.admin.warehouse.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 WarehouseRespVO extends WarehouseBaseVO {
|
||||
|
||||
@Schema(description = "仓库id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6005")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.yunxi.scm.module.xxjj.controller.admin.warehouse.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 WarehouseUpdateReqVO extends WarehouseBaseVO {
|
||||
|
||||
@Schema(description = "仓库id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6005")
|
||||
@NotNull(message = "仓库id不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.yunxi.scm.module.xxjj.convert.businessline;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.yunxi.scm.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import com.yunxi.scm.module.xxjj.controller.admin.businessline.vo.*;
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO;
|
||||
|
||||
/**
|
||||
* 业务线 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface BusinessLineConvert {
|
||||
|
||||
BusinessLineConvert INSTANCE = Mappers.getMapper(BusinessLineConvert.class);
|
||||
|
||||
BusinessLineDO convert(BusinessLineCreateReqVO bean);
|
||||
|
||||
BusinessLineDO convert(BusinessLineUpdateReqVO bean);
|
||||
|
||||
BusinessLineRespVO convert(BusinessLineDO bean);
|
||||
|
||||
List<BusinessLineRespVO> convertList(List<BusinessLineDO> list);
|
||||
|
||||
PageResult<BusinessLineRespVO> convertPage(PageResult<BusinessLineDO> page);
|
||||
|
||||
List<BusinessLineExcelVO> convertList02(List<BusinessLineDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.yunxi.scm.module.xxjj.convert.warehouse;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.yunxi.scm.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo.*;
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
|
||||
|
||||
/**
|
||||
* 仓库 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface WarehouseConvert {
|
||||
|
||||
WarehouseConvert INSTANCE = Mappers.getMapper(WarehouseConvert.class);
|
||||
|
||||
WarehouseDO convert(WarehouseCreateReqVO bean);
|
||||
|
||||
WarehouseDO convert(WarehouseUpdateReqVO bean);
|
||||
|
||||
WarehouseRespVO convert(WarehouseDO bean);
|
||||
|
||||
List<WarehouseRespVO> convertList(List<WarehouseDO> list);
|
||||
|
||||
PageResult<WarehouseRespVO> convertPage(PageResult<WarehouseDO> page);
|
||||
|
||||
List<WarehouseExcelVO> convertList02(List<WarehouseDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
package com.yunxi.scm.module.xxjj.dal.dataobject.businessline;
|
||||
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.yunxi.scm.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 业务线 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("xxjj_business_line")
|
||||
@KeySequence("xxjj_business_line_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BusinessLineDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 业务线编号
|
||||
*/
|
||||
private String businessCode;
|
||||
/**
|
||||
* 业务线名称
|
||||
*/
|
||||
private String businessName;
|
||||
/**
|
||||
* 业务线简称
|
||||
*/
|
||||
private String businessSimple;
|
||||
/**
|
||||
* 业务线LOGO
|
||||
*/
|
||||
private String businessLogo;
|
||||
/**
|
||||
* 隶属企业
|
||||
*/
|
||||
private Long affiliatCompanyId;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 所属行业
|
||||
*/
|
||||
private String industry;
|
||||
/**
|
||||
* 所在城市
|
||||
*/
|
||||
private String city;
|
||||
/**
|
||||
* 成立时间
|
||||
*/
|
||||
private LocalDateTime establishDate;
|
||||
/**
|
||||
* 归属人员
|
||||
*/
|
||||
private Long belongUserId;
|
||||
/**
|
||||
* 品牌/业务线/事业群名称
|
||||
*/
|
||||
private String brandName;
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
private Integer phone;
|
||||
/**
|
||||
* 传真
|
||||
*/
|
||||
private String fax;
|
||||
/**
|
||||
* 网址
|
||||
*/
|
||||
private String url;
|
||||
/**
|
||||
* 介绍
|
||||
*/
|
||||
private String description;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<WarehouseDO> children;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String name;
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package com.yunxi.scm.module.xxjj.dal.dataobject.warehouse;
|
||||
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.customer.CustomerDO;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.yunxi.scm.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 仓库 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("xxjj_warehouse")
|
||||
@KeySequence("xxjj_warehouse_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WarehouseDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 仓库id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 仓库编号
|
||||
*/
|
||||
private String warehouseCode;
|
||||
/**
|
||||
* 仓库名称
|
||||
*/
|
||||
private String warehouseName;
|
||||
/**
|
||||
* 仓库简称
|
||||
*/
|
||||
private String warehouseSimple;
|
||||
/**
|
||||
* 隶属业务线
|
||||
*/
|
||||
private Long affiliatLineId;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 所在城市
|
||||
*/
|
||||
private String city;
|
||||
/**
|
||||
* 成立时间
|
||||
*/
|
||||
private LocalDateTime establishDate;
|
||||
/**
|
||||
* 归属人员
|
||||
*/
|
||||
private Long belongUserId;
|
||||
/**
|
||||
* 介绍
|
||||
*/
|
||||
private String description;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String name;
|
||||
@TableField(exist = false)
|
||||
private List<CustomerDO> children;
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.yunxi.scm.module.xxjj.dal.mysql.businessline;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.yunxi.scm.framework.common.pojo.PageResult;
|
||||
import com.yunxi.scm.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.yunxi.scm.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.yunxi.scm.module.xxjj.controller.admin.businessline.vo.*;
|
||||
|
||||
/**
|
||||
* 业务线 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface BusinessLineMapper extends BaseMapperX<BusinessLineDO> {
|
||||
|
||||
default PageResult<BusinessLineDO> selectPage(BusinessLinePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<BusinessLineDO>()
|
||||
.eqIfPresent(BusinessLineDO::getBusinessCode, reqVO.getBusinessCode())
|
||||
.likeIfPresent(BusinessLineDO::getBusinessName, reqVO.getBusinessName())
|
||||
.eqIfPresent(BusinessLineDO::getAffiliatCompanyId, reqVO.getAffiliatCompanyId())
|
||||
.eqIfPresent(BusinessLineDO::getType, reqVO.getType())
|
||||
.eqIfPresent(BusinessLineDO::getIndustry, reqVO.getIndustry())
|
||||
.eqIfPresent(BusinessLineDO::getCity, reqVO.getCity())
|
||||
.betweenIfPresent(BusinessLineDO::getEstablishDate, reqVO.getEstablishDate())
|
||||
.likeIfPresent(BusinessLineDO::getBrandName, reqVO.getBrandName())
|
||||
.eqIfPresent(BusinessLineDO::getPhone, reqVO.getPhone())
|
||||
.betweenIfPresent(BusinessLineDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(BusinessLineDO::getId));
|
||||
}
|
||||
|
||||
default List<BusinessLineDO> selectList(BusinessLineExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<BusinessLineDO>()
|
||||
.eqIfPresent(BusinessLineDO::getBusinessCode, reqVO.getBusinessCode())
|
||||
.likeIfPresent(BusinessLineDO::getBusinessName, reqVO.getBusinessName())
|
||||
.eqIfPresent(BusinessLineDO::getAffiliatCompanyId, reqVO.getAffiliatCompanyId())
|
||||
.eqIfPresent(BusinessLineDO::getType, reqVO.getType())
|
||||
.eqIfPresent(BusinessLineDO::getIndustry, reqVO.getIndustry())
|
||||
.eqIfPresent(BusinessLineDO::getCity, reqVO.getCity())
|
||||
.betweenIfPresent(BusinessLineDO::getEstablishDate, reqVO.getEstablishDate())
|
||||
.likeIfPresent(BusinessLineDO::getBrandName, reqVO.getBrandName())
|
||||
.eqIfPresent(BusinessLineDO::getPhone, reqVO.getPhone())
|
||||
.betweenIfPresent(BusinessLineDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(BusinessLineDO::getId));
|
||||
}
|
||||
|
||||
List<BusinessLineDO> queryBusinessLineTree();
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.yunxi.scm.module.xxjj.dal.mysql.warehouse;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.yunxi.scm.framework.common.pojo.PageResult;
|
||||
import com.yunxi.scm.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.yunxi.scm.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 仓库 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface WarehouseMapper extends BaseMapperX<WarehouseDO> {
|
||||
|
||||
default PageResult<WarehouseDO> selectPage(WarehousePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<WarehouseDO>()
|
||||
.eqIfPresent(WarehouseDO::getWarehouseCode, reqVO.getWarehouseCode())
|
||||
.likeIfPresent(WarehouseDO::getWarehouseName, reqVO.getWarehouseName())
|
||||
.eqIfPresent(WarehouseDO::getAffiliatLineId, reqVO.getAffiliatLineId())
|
||||
.eqIfPresent(WarehouseDO::getType, reqVO.getType())
|
||||
.eqIfPresent(WarehouseDO::getCity, reqVO.getCity())
|
||||
.betweenIfPresent(WarehouseDO::getEstablishDate, reqVO.getEstablishDate())
|
||||
.betweenIfPresent(WarehouseDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(WarehouseDO::getId));
|
||||
}
|
||||
|
||||
default List<WarehouseDO> selectList(WarehouseExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<WarehouseDO>()
|
||||
.eqIfPresent(WarehouseDO::getWarehouseCode, reqVO.getWarehouseCode())
|
||||
.likeIfPresent(WarehouseDO::getWarehouseName, reqVO.getWarehouseName())
|
||||
.eqIfPresent(WarehouseDO::getAffiliatLineId, reqVO.getAffiliatLineId())
|
||||
.eqIfPresent(WarehouseDO::getType, reqVO.getType())
|
||||
.eqIfPresent(WarehouseDO::getCity, reqVO.getCity())
|
||||
.betweenIfPresent(WarehouseDO::getEstablishDate, reqVO.getEstablishDate())
|
||||
.betweenIfPresent(WarehouseDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(WarehouseDO::getId));
|
||||
}
|
||||
|
||||
List<WarehouseDO> queryWarehouseTree(@Param("id") Long id);
|
||||
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.yunxi.scm.module.xxjj.service.businessline;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import com.yunxi.scm.module.xxjj.controller.admin.businessline.vo.*;
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO;
|
||||
import com.yunxi.scm.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 业务线 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface BusinessLineService {
|
||||
|
||||
/**
|
||||
* 创建业务线
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createBusinessLine(@Valid BusinessLineCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新业务线
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateBusinessLine(@Valid BusinessLineUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除业务线
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteBusinessLine(Long id);
|
||||
|
||||
/**
|
||||
* 获得业务线
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 业务线
|
||||
*/
|
||||
BusinessLineDO getBusinessLine(Long id);
|
||||
|
||||
/**
|
||||
* 获得业务线列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 业务线列表
|
||||
*/
|
||||
List<BusinessLineDO> getBusinessLineList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得业务线分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 业务线分页
|
||||
*/
|
||||
PageResult<BusinessLineDO> getBusinessLinePage(BusinessLinePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得业务线列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 业务线列表
|
||||
*/
|
||||
List<BusinessLineDO> getBusinessLineList(BusinessLineExportReqVO exportReqVO);
|
||||
|
||||
/**
|
||||
* 获得业务线树
|
||||
*
|
||||
* @param
|
||||
* @return 业务线分页
|
||||
*/
|
||||
List<BusinessLineDO> getBusinessLineTree();
|
||||
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package com.yunxi.scm.module.xxjj.service.businessline;
|
||||
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.customer.CustomerDO;
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
|
||||
import com.yunxi.scm.module.xxjj.dal.mysql.customer.CustomerMapper;
|
||||
import com.yunxi.scm.module.xxjj.dal.mysql.warehouse.WarehouseMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import com.yunxi.scm.module.xxjj.controller.admin.businessline.vo.*;
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO;
|
||||
import com.yunxi.scm.framework.common.pojo.PageResult;
|
||||
|
||||
import com.yunxi.scm.module.xxjj.convert.businessline.BusinessLineConvert;
|
||||
import com.yunxi.scm.module.xxjj.dal.mysql.businessline.BusinessLineMapper;
|
||||
|
||||
import static com.yunxi.scm.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.yunxi.scm.module.xxjj.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 业务线 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class BusinessLineServiceImpl implements BusinessLineService {
|
||||
|
||||
@Resource
|
||||
private BusinessLineMapper businessLineMapper;
|
||||
@Resource
|
||||
private WarehouseMapper warehouseMapper;
|
||||
@Resource
|
||||
private CustomerMapper customerMapper;
|
||||
|
||||
@Override
|
||||
public Long createBusinessLine(BusinessLineCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
BusinessLineDO businessLine = BusinessLineConvert.INSTANCE.convert(createReqVO);
|
||||
businessLineMapper.insert(businessLine);
|
||||
// 返回
|
||||
return businessLine.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBusinessLine(BusinessLineUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateBusinessLineExists(updateReqVO.getId());
|
||||
// 更新
|
||||
BusinessLineDO updateObj = BusinessLineConvert.INSTANCE.convert(updateReqVO);
|
||||
businessLineMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBusinessLine(Long id) {
|
||||
// 校验存在
|
||||
validateBusinessLineExists(id);
|
||||
// 删除
|
||||
businessLineMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateBusinessLineExists(Long id) {
|
||||
if (businessLineMapper.selectById(id) == null) {
|
||||
throw exception(BUSINESS_LINE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BusinessLineDO getBusinessLine(Long id) {
|
||||
return businessLineMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BusinessLineDO> getBusinessLineList(Collection<Long> ids) {
|
||||
return businessLineMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<BusinessLineDO> getBusinessLinePage(BusinessLinePageReqVO pageReqVO) {
|
||||
return businessLineMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BusinessLineDO> getBusinessLineList(BusinessLineExportReqVO exportReqVO) {
|
||||
return businessLineMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BusinessLineDO> getBusinessLineTree() {
|
||||
List<BusinessLineDO> businessLineDOList = businessLineMapper.queryBusinessLineTree();
|
||||
if (businessLineDOList != null && businessLineDOList.size() > 0){
|
||||
for (BusinessLineDO entity : businessLineDOList) {
|
||||
List<WarehouseDO> warehouseDOList = warehouseMapper.queryWarehouseTree(entity.getId());
|
||||
entity.setChildren(warehouseDOList);
|
||||
// for (WarehouseDO warehouseEntity : warehouseDOList){
|
||||
// List<CustomerDO> customerDOList = customerMapper.queryCustomerTree(warehouseEntity.getId());
|
||||
// warehouseEntity.setChildren(customerDOList);
|
||||
// }
|
||||
}
|
||||
}
|
||||
return businessLineDOList;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.yunxi.scm.module.xxjj.service.warehouse;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo.*;
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
|
||||
import com.yunxi.scm.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 仓库 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface WarehouseService {
|
||||
|
||||
/**
|
||||
* 创建仓库
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createWarehouse(@Valid WarehouseCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新仓库
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateWarehouse(@Valid WarehouseUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除仓库
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteWarehouse(Long id);
|
||||
|
||||
/**
|
||||
* 获得仓库
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 仓库
|
||||
*/
|
||||
WarehouseDO getWarehouse(Long id);
|
||||
|
||||
/**
|
||||
* 获得仓库列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 仓库列表
|
||||
*/
|
||||
List<WarehouseDO> getWarehouseList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得仓库分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 仓库分页
|
||||
*/
|
||||
PageResult<WarehouseDO> getWarehousePage(WarehousePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得仓库列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 仓库列表
|
||||
*/
|
||||
List<WarehouseDO> getWarehouseList(WarehouseExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package com.yunxi.scm.module.xxjj.service.warehouse;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo.*;
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
|
||||
import com.yunxi.scm.framework.common.pojo.PageResult;
|
||||
|
||||
import com.yunxi.scm.module.xxjj.convert.warehouse.WarehouseConvert;
|
||||
import com.yunxi.scm.module.xxjj.dal.mysql.warehouse.WarehouseMapper;
|
||||
|
||||
import static com.yunxi.scm.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.yunxi.scm.module.xxjj.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 仓库 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class WarehouseServiceImpl implements WarehouseService {
|
||||
|
||||
@Resource
|
||||
private WarehouseMapper warehouseMapper;
|
||||
|
||||
@Override
|
||||
public Long createWarehouse(WarehouseCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
WarehouseDO warehouse = WarehouseConvert.INSTANCE.convert(createReqVO);
|
||||
warehouseMapper.insert(warehouse);
|
||||
// 返回
|
||||
return warehouse.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWarehouse(WarehouseUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateWarehouseExists(updateReqVO.getId());
|
||||
// 更新
|
||||
WarehouseDO updateObj = WarehouseConvert.INSTANCE.convert(updateReqVO);
|
||||
warehouseMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteWarehouse(Long id) {
|
||||
// 校验存在
|
||||
validateWarehouseExists(id);
|
||||
// 删除
|
||||
warehouseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateWarehouseExists(Long id) {
|
||||
if (warehouseMapper.selectById(id) == null) {
|
||||
throw exception(WAREHOUSE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarehouseDO getWarehouse(Long id) {
|
||||
return warehouseMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarehouseDO> getWarehouseList(Collection<Long> ids) {
|
||||
return warehouseMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<WarehouseDO> getWarehousePage(WarehousePageReqVO pageReqVO) {
|
||||
return warehouseMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarehouseDO> getWarehouseList(WarehouseExportReqVO exportReqVO) {
|
||||
return warehouseMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<?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.yunxi.scm.module.xxjj.dal.mysql.businessline.BusinessLineMapper">
|
||||
|
||||
<select id="queryBusinessLineTree" resultType="com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO">
|
||||
select id,business_name as name ,affiliat_company_id from xxjj_business_line
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,10 @@
|
||||
<?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.yunxi.scm.module.xxjj.dal.mysql.warehouse.WarehouseMapper">
|
||||
|
||||
<select id="queryWarehouseTree" resultType="com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO">
|
||||
select id,warehouse_name as name,affiliat_line_id from xxjj_warehouse
|
||||
where affiliat_line_id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,223 @@
|
||||
package com.yunxi.scm.module.xxjj.service.businessline;
|
||||
|
||||
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 com.yunxi.scm.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import com.yunxi.scm.module.xxjj.controller.admin.businessline.vo.*;
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.businessline.BusinessLineDO;
|
||||
import com.yunxi.scm.module.xxjj.dal.mysql.businessline.BusinessLineMapper;
|
||||
import com.yunxi.scm.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 com.yunxi.scm.module.xxjj.enums.ErrorCodeConstants.*;
|
||||
import static com.yunxi.scm.framework.test.core.util.AssertUtils.*;
|
||||
import static com.yunxi.scm.framework.test.core.util.RandomUtils.*;
|
||||
import static com.yunxi.scm.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static com.yunxi.scm.framework.common.util.object.ObjectUtils.*;
|
||||
import static com.yunxi.scm.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link BusinessLineServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(BusinessLineServiceImpl.class)
|
||||
public class BusinessLineServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private BusinessLineServiceImpl businessLineService;
|
||||
|
||||
@Resource
|
||||
private BusinessLineMapper businessLineMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateBusinessLine_success() {
|
||||
// 准备参数
|
||||
BusinessLineCreateReqVO reqVO = randomPojo(BusinessLineCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Long businessLineId = businessLineService.createBusinessLine(reqVO);
|
||||
// 断言
|
||||
assertNotNull(businessLineId);
|
||||
// 校验记录的属性是否正确
|
||||
BusinessLineDO businessLine = businessLineMapper.selectById(businessLineId);
|
||||
assertPojoEquals(reqVO, businessLine);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateBusinessLine_success() {
|
||||
// mock 数据
|
||||
BusinessLineDO dbBusinessLine = randomPojo(BusinessLineDO.class);
|
||||
businessLineMapper.insert(dbBusinessLine);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
BusinessLineUpdateReqVO reqVO = randomPojo(BusinessLineUpdateReqVO.class, o -> {
|
||||
o.setId(dbBusinessLine.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
businessLineService.updateBusinessLine(reqVO);
|
||||
// 校验是否更新正确
|
||||
BusinessLineDO businessLine = businessLineMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, businessLine);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateBusinessLine_notExists() {
|
||||
// 准备参数
|
||||
BusinessLineUpdateReqVO reqVO = randomPojo(BusinessLineUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> businessLineService.updateBusinessLine(reqVO), BUSINESS_LINE_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteBusinessLine_success() {
|
||||
// mock 数据
|
||||
BusinessLineDO dbBusinessLine = randomPojo(BusinessLineDO.class);
|
||||
businessLineMapper.insert(dbBusinessLine);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbBusinessLine.getId();
|
||||
|
||||
// 调用
|
||||
businessLineService.deleteBusinessLine(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(businessLineMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteBusinessLine_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> businessLineService.deleteBusinessLine(id), BUSINESS_LINE_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetBusinessLinePage() {
|
||||
// mock 数据
|
||||
BusinessLineDO dbBusinessLine = randomPojo(BusinessLineDO.class, o -> { // 等会查询到
|
||||
o.setBusinessCode(null);
|
||||
o.setBusinessName(null);
|
||||
o.setAffiliatCompanyId(null);
|
||||
o.setType(null);
|
||||
o.setIndustry(null);
|
||||
o.setCity(null);
|
||||
o.setEstablishDate(null);
|
||||
o.setBrandName(null);
|
||||
o.setPhone(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
businessLineMapper.insert(dbBusinessLine);
|
||||
// 测试 businessCode 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setBusinessCode(null)));
|
||||
// 测试 businessName 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setBusinessName(null)));
|
||||
// 测试 affiliatCompanyId 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setAffiliatCompanyId(null)));
|
||||
// 测试 type 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setType(null)));
|
||||
// 测试 industry 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setIndustry(null)));
|
||||
// 测试 city 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setCity(null)));
|
||||
// 测试 establishDate 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setEstablishDate(null)));
|
||||
// 测试 brandName 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setBrandName(null)));
|
||||
// 测试 phone 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setPhone(null)));
|
||||
// 测试 createTime 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
BusinessLinePageReqVO reqVO = new BusinessLinePageReqVO();
|
||||
reqVO.setBusinessCode(null);
|
||||
reqVO.setBusinessName(null);
|
||||
reqVO.setAffiliatCompanyId(null);
|
||||
reqVO.setType(null);
|
||||
reqVO.setIndustry(null);
|
||||
reqVO.setCity(null);
|
||||
reqVO.setEstablishDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setBrandName(null);
|
||||
reqVO.setPhone(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
PageResult<BusinessLineDO> pageResult = businessLineService.getBusinessLinePage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbBusinessLine, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetBusinessLineList() {
|
||||
// mock 数据
|
||||
BusinessLineDO dbBusinessLine = randomPojo(BusinessLineDO.class, o -> { // 等会查询到
|
||||
o.setBusinessCode(null);
|
||||
o.setBusinessName(null);
|
||||
o.setAffiliatCompanyId(null);
|
||||
o.setType(null);
|
||||
o.setIndustry(null);
|
||||
o.setCity(null);
|
||||
o.setEstablishDate(null);
|
||||
o.setBrandName(null);
|
||||
o.setPhone(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
businessLineMapper.insert(dbBusinessLine);
|
||||
// 测试 businessCode 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setBusinessCode(null)));
|
||||
// 测试 businessName 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setBusinessName(null)));
|
||||
// 测试 affiliatCompanyId 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setAffiliatCompanyId(null)));
|
||||
// 测试 type 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setType(null)));
|
||||
// 测试 industry 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setIndustry(null)));
|
||||
// 测试 city 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setCity(null)));
|
||||
// 测试 establishDate 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setEstablishDate(null)));
|
||||
// 测试 brandName 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setBrandName(null)));
|
||||
// 测试 phone 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setPhone(null)));
|
||||
// 测试 createTime 不匹配
|
||||
businessLineMapper.insert(cloneIgnoreId(dbBusinessLine, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
BusinessLineExportReqVO reqVO = new BusinessLineExportReqVO();
|
||||
reqVO.setBusinessCode(null);
|
||||
reqVO.setBusinessName(null);
|
||||
reqVO.setAffiliatCompanyId(null);
|
||||
reqVO.setType(null);
|
||||
reqVO.setIndustry(null);
|
||||
reqVO.setCity(null);
|
||||
reqVO.setEstablishDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setBrandName(null);
|
||||
reqVO.setPhone(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
List<BusinessLineDO> list = businessLineService.getBusinessLineList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbBusinessLine, list.get(0));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,199 @@
|
||||
package com.yunxi.scm.module.xxjj.service.warehouse;
|
||||
|
||||
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 com.yunxi.scm.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import com.yunxi.scm.module.xxjj.controller.admin.warehouse.vo.*;
|
||||
import com.yunxi.scm.module.xxjj.dal.dataobject.warehouse.WarehouseDO;
|
||||
import com.yunxi.scm.module.xxjj.dal.mysql.warehouse.WarehouseMapper;
|
||||
import com.yunxi.scm.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 com.yunxi.scm.module.xxjj.enums.ErrorCodeConstants.*;
|
||||
import static com.yunxi.scm.framework.test.core.util.AssertUtils.*;
|
||||
import static com.yunxi.scm.framework.test.core.util.RandomUtils.*;
|
||||
import static com.yunxi.scm.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static com.yunxi.scm.framework.common.util.object.ObjectUtils.*;
|
||||
import static com.yunxi.scm.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link WarehouseServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(WarehouseServiceImpl.class)
|
||||
public class WarehouseServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private WarehouseServiceImpl warehouseService;
|
||||
|
||||
@Resource
|
||||
private WarehouseMapper warehouseMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateWarehouse_success() {
|
||||
// 准备参数
|
||||
WarehouseCreateReqVO reqVO = randomPojo(WarehouseCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Long warehouseId = warehouseService.createWarehouse(reqVO);
|
||||
// 断言
|
||||
assertNotNull(warehouseId);
|
||||
// 校验记录的属性是否正确
|
||||
WarehouseDO warehouse = warehouseMapper.selectById(warehouseId);
|
||||
assertPojoEquals(reqVO, warehouse);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateWarehouse_success() {
|
||||
// mock 数据
|
||||
WarehouseDO dbWarehouse = randomPojo(WarehouseDO.class);
|
||||
warehouseMapper.insert(dbWarehouse);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
WarehouseUpdateReqVO reqVO = randomPojo(WarehouseUpdateReqVO.class, o -> {
|
||||
o.setId(dbWarehouse.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
warehouseService.updateWarehouse(reqVO);
|
||||
// 校验是否更新正确
|
||||
WarehouseDO warehouse = warehouseMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, warehouse);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateWarehouse_notExists() {
|
||||
// 准备参数
|
||||
WarehouseUpdateReqVO reqVO = randomPojo(WarehouseUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> warehouseService.updateWarehouse(reqVO), WAREHOUSE_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteWarehouse_success() {
|
||||
// mock 数据
|
||||
WarehouseDO dbWarehouse = randomPojo(WarehouseDO.class);
|
||||
warehouseMapper.insert(dbWarehouse);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbWarehouse.getId();
|
||||
|
||||
// 调用
|
||||
warehouseService.deleteWarehouse(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(warehouseMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteWarehouse_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> warehouseService.deleteWarehouse(id), WAREHOUSE_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetWarehousePage() {
|
||||
// mock 数据
|
||||
WarehouseDO dbWarehouse = randomPojo(WarehouseDO.class, o -> { // 等会查询到
|
||||
o.setWarehouseCode(null);
|
||||
o.setWarehouseName(null);
|
||||
o.setAffiliatLineId(null);
|
||||
o.setType(null);
|
||||
o.setCity(null);
|
||||
o.setEstablishDate(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
warehouseMapper.insert(dbWarehouse);
|
||||
// 测试 warehouseCode 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setWarehouseCode(null)));
|
||||
// 测试 warehouseName 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setWarehouseName(null)));
|
||||
// 测试 affiliatLineId 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setAffiliatLineId(null)));
|
||||
// 测试 type 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setType(null)));
|
||||
// 测试 city 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setCity(null)));
|
||||
// 测试 establishDate 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setEstablishDate(null)));
|
||||
// 测试 createTime 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
WarehousePageReqVO reqVO = new WarehousePageReqVO();
|
||||
reqVO.setWarehouseCode(null);
|
||||
reqVO.setWarehouseName(null);
|
||||
reqVO.setAffiliatLineId(null);
|
||||
reqVO.setType(null);
|
||||
reqVO.setCity(null);
|
||||
reqVO.setEstablishDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
PageResult<WarehouseDO> pageResult = warehouseService.getWarehousePage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbWarehouse, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetWarehouseList() {
|
||||
// mock 数据
|
||||
WarehouseDO dbWarehouse = randomPojo(WarehouseDO.class, o -> { // 等会查询到
|
||||
o.setWarehouseCode(null);
|
||||
o.setWarehouseName(null);
|
||||
o.setAffiliatLineId(null);
|
||||
o.setType(null);
|
||||
o.setCity(null);
|
||||
o.setEstablishDate(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
warehouseMapper.insert(dbWarehouse);
|
||||
// 测试 warehouseCode 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setWarehouseCode(null)));
|
||||
// 测试 warehouseName 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setWarehouseName(null)));
|
||||
// 测试 affiliatLineId 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setAffiliatLineId(null)));
|
||||
// 测试 type 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setType(null)));
|
||||
// 测试 city 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setCity(null)));
|
||||
// 测试 establishDate 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setEstablishDate(null)));
|
||||
// 测试 createTime 不匹配
|
||||
warehouseMapper.insert(cloneIgnoreId(dbWarehouse, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
WarehouseExportReqVO reqVO = new WarehouseExportReqVO();
|
||||
reqVO.setWarehouseCode(null);
|
||||
reqVO.setWarehouseName(null);
|
||||
reqVO.setAffiliatLineId(null);
|
||||
reqVO.setType(null);
|
||||
reqVO.setCity(null);
|
||||
reqVO.setEstablishDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
List<WarehouseDO> list = warehouseService.getWarehouseList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbWarehouse, list.get(0));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建业务线
|
||||
export function createBusinessLine(data) {
|
||||
return request({
|
||||
url: '/xxjj/business-line/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新业务线
|
||||
export function updateBusinessLine(data) {
|
||||
return request({
|
||||
url: '/xxjj/business-line/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除业务线
|
||||
export function deleteBusinessLine(id) {
|
||||
return request({
|
||||
url: '/xxjj/business-line/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得业务线
|
||||
export function getBusinessLine(id) {
|
||||
return request({
|
||||
url: '/xxjj/business-line/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得业务线分页
|
||||
export function getBusinessLinePage(query) {
|
||||
return request({
|
||||
url: '/xxjj/business-line/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出业务线 Excel
|
||||
export function exportBusinessLineExcel(query) {
|
||||
return request({
|
||||
url: '/xxjj/business-line/export-excel',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
export function getBusinessLintTree(query) {
|
||||
return request({
|
||||
url: '/xxjj/business-line/tree',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建仓库
|
||||
export function createWarehouse(data) {
|
||||
return request({
|
||||
url: '/xxjj/warehouse/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新仓库
|
||||
export function updateWarehouse(data) {
|
||||
return request({
|
||||
url: '/xxjj/warehouse/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除仓库
|
||||
export function deleteWarehouse(id) {
|
||||
return request({
|
||||
url: '/xxjj/warehouse/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得仓库
|
||||
export function getWarehouse(id) {
|
||||
return request({
|
||||
url: '/xxjj/warehouse/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得仓库分页
|
||||
export function getWarehousePage(query) {
|
||||
return request({
|
||||
url: '/xxjj/warehouse/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出仓库 Excel
|
||||
export function exportWarehouseExcel(query) {
|
||||
return request({
|
||||
url: '/xxjj/warehouse/export-excel',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,336 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="业务线编号" prop="businessCode">
|
||||
<el-input v-model="queryParams.businessCode" placeholder="请输入业务线编号" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="业务线名称" prop="businessName">
|
||||
<el-input v-model="queryParams.businessName" placeholder="请输入业务线名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="隶属企业" prop="affiliatCompanyId">
|
||||
<el-input v-model="queryParams.affiliatCompanyId" placeholder="请输入隶属企业" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.BUSINESS_TYPE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属行业" prop="industry">
|
||||
<el-input v-model="queryParams.industry" placeholder="请输入所属行业" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所在城市" prop="city">
|
||||
<el-input v-model="queryParams.city" placeholder="请输入所在城市" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="成立时间" prop="establishDate">
|
||||
<el-date-picker v-model="queryParams.establishDate" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
|
||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
|
||||
</el-form-item>
|
||||
<el-form-item label="品牌/业务线/事业群名称" prop="brandName">
|
||||
<el-input v-model="queryParams.brandName" placeholder="请输入品牌/业务线/事业群名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="电话" prop="phone">
|
||||
<el-input v-model="queryParams.phone" placeholder="请输入电话" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
|
||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
v-hasPermi="['xxjj:business-line:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['xxjj:business-line:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="业务id" align="center" prop="id" />
|
||||
<el-table-column label="业务线编号" align="center" prop="businessCode" />
|
||||
<el-table-column label="业务线名称" align="center" prop="businessName" />
|
||||
<el-table-column label="业务线简称" align="center" prop="businessSimple" />
|
||||
<el-table-column label="业务线LOGO" align="center" prop="businessLogo" />
|
||||
<el-table-column label="隶属企业" align="center" prop="affiliatCompanyId" />
|
||||
<el-table-column label="类型" align="center" prop="type" >
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.BUSINESS_TYPE" :value="scope.row.type" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所属行业" align="center" prop="industry" />
|
||||
<el-table-column label="所在城市" align="center" prop="city" />
|
||||
<el-table-column label="成立时间" align="center" prop="establishDate" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.establishDate) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="归属人员" align="center" prop="belongUserId" />
|
||||
<el-table-column label="品牌/业务线/事业群名称" align="center" prop="brandName" />
|
||||
<el-table-column label="电话" align="center" prop="phone" />
|
||||
<el-table-column label="传真" align="center" prop="fax" />
|
||||
<el-table-column label="网址" align="center" prop="url" />
|
||||
<el-table-column label="介绍" align="center" prop="desc" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['xxjj:business-line:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['xxjj:business-line:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="业务线编号" prop="businessCode">
|
||||
<el-input v-model="form.businessCode" placeholder="请输入业务线编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="业务线名称" prop="businessName">
|
||||
<el-input v-model="form.businessName" placeholder="请输入业务线名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="业务线简称" prop="businessSimple">
|
||||
<el-input v-model="form.businessSimple" placeholder="请输入业务线简称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="业务线LOGO" prop="businessLogo">
|
||||
<el-input v-model="form.businessLogo" placeholder="请输入业务线LOGO" />
|
||||
</el-form-item>
|
||||
<el-form-item label="隶属企业" prop="affiliatCompanyId">
|
||||
<el-input v-model="form.affiliatCompanyId" placeholder="请输入隶属企业" />
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择类型">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.BUSINESS_TYPE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属行业" prop="industry">
|
||||
<el-input v-model="form.industry" placeholder="请输入所属行业" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所在城市" prop="city">
|
||||
<el-input v-model="form.city" placeholder="请输入所在城市" />
|
||||
</el-form-item>
|
||||
<el-form-item label="成立时间" prop="establishDate">
|
||||
<el-date-picker clearable v-model="form.establishDate" type="date" value-format="timestamp" placeholder="选择成立时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="归属人员" prop="belongUserId">
|
||||
<el-input v-model="form.belongUserId" placeholder="请输入归属人员" />
|
||||
</el-form-item>
|
||||
<el-form-item label="品牌/业务线/事业群名称" prop="brandName">
|
||||
<el-input v-model="form.brandName" placeholder="请输入品牌/业务线/事业群名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="电话" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入电话" />
|
||||
</el-form-item>
|
||||
<el-form-item label="传真" prop="fax">
|
||||
<el-input v-model="form.fax" placeholder="请输入传真" />
|
||||
</el-form-item>
|
||||
<el-form-item label="网址" prop="url">
|
||||
<el-input v-model="form.url" placeholder="请输入网址" />
|
||||
</el-form-item>
|
||||
<el-form-item label="介绍" prop="desc">
|
||||
<el-input v-model="form.desc" placeholder="请输入介绍" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createBusinessLine, updateBusinessLine, deleteBusinessLine, getBusinessLine, getBusinessLinePage, exportBusinessLineExcel } from "@/api/xxjj/businessLine";
|
||||
|
||||
export default {
|
||||
name: "BusinessLine",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 业务线列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
businessCode: null,
|
||||
businessName: null,
|
||||
affiliatCompanyId: null,
|
||||
type: null,
|
||||
industry: null,
|
||||
city: null,
|
||||
establishDate: [],
|
||||
brandName: null,
|
||||
phone: null,
|
||||
createTime: [],
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
businessCode: [{ required: true, message: "业务线编号不能为空", trigger: "blur" }],
|
||||
businessName: [{ required: true, message: "业务线名称不能为空", trigger: "blur" }],
|
||||
businessLogo: [{ required: true, message: "业务线LOGO不能为空", trigger: "blur" }],
|
||||
affiliatCompanyId: [{ required: true, message: "隶属企业不能为空", trigger: "blur" }],
|
||||
type: [{ required: true, message: "类型不能为空", trigger: "change" }],
|
||||
industry: [{ required: true, message: "所属行业不能为空", trigger: "blur" }],
|
||||
city: [{ required: true, message: "所在城市不能为空", trigger: "blur" }],
|
||||
establishDate: [{ required: true, message: "成立时间不能为空", trigger: "blur" }],
|
||||
belongUserId: [{ required: true, message: "归属人员不能为空", trigger: "blur" }],
|
||||
brandName: [{ required: true, message: "品牌/业务线/事业群名称不能为空", trigger: "blur" }],
|
||||
phone: [{ required: true, message: "电话不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getBusinessLinePage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
businessCode: undefined,
|
||||
businessName: undefined,
|
||||
businessSimple: undefined,
|
||||
businessLogo: undefined,
|
||||
affiliatCompanyId: undefined,
|
||||
type: undefined,
|
||||
industry: undefined,
|
||||
city: undefined,
|
||||
establishDate: undefined,
|
||||
belongUserId: undefined,
|
||||
brandName: undefined,
|
||||
phone: undefined,
|
||||
fax: undefined,
|
||||
url: undefined,
|
||||
desc: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加业务线";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getBusinessLine(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改业务线";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateBusinessLine(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createBusinessLine(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除业务线编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteBusinessLine(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有业务线数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportBusinessLineExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '业务线.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,290 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="仓库编号" prop="warehouseCode">
|
||||
<el-input v-model="queryParams.warehouseCode" placeholder="请输入仓库编号" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库名称" prop="warehouseName">
|
||||
<el-input v-model="queryParams.warehouseName" placeholder="请输入仓库名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="隶属业务线" prop="affiliatLineId">
|
||||
<el-input v-model="queryParams.affiliatLineId" placeholder="请输入隶属业务线" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.WAREHOUSE_TYPE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="所在城市" prop="city">
|
||||
<el-input v-model="queryParams.city" placeholder="请输入所在城市" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="成立时间" prop="establishDate">
|
||||
<el-date-picker v-model="queryParams.establishDate" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
|
||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
|
||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
v-hasPermi="['xxjj:warehouse:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['xxjj:warehouse:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="仓库id" align="center" prop="id" />
|
||||
<el-table-column label="仓库编号" align="center" prop="warehouseCode" />
|
||||
<el-table-column label="仓库名称" align="center" prop="warehouseName" />
|
||||
<el-table-column label="仓库简称" align="center" prop="warehouseSimple" />
|
||||
<el-table-column label="隶属业务线" align="center" prop="affiliatLineId" />
|
||||
<el-table-column label="类型" align="center" prop="type" >
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.WAREHOUSE_TYPE" :value="scope.row.type" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所在城市" align="center" prop="city" />
|
||||
<el-table-column label="成立时间" align="center" prop="establishDate" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.establishDate) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="归属人员" align="center" prop="belongUserId" />
|
||||
<el-table-column label="介绍" align="center" prop="desc" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['xxjj:warehouse:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['xxjj:warehouse:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="仓库编号" prop="warehouseCode">
|
||||
<el-input v-model="form.warehouseCode" placeholder="请输入仓库编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库名称" prop="warehouseName">
|
||||
<el-input v-model="form.warehouseName" placeholder="请输入仓库名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库简称" prop="warehouseSimple">
|
||||
<el-input v-model="form.warehouseSimple" placeholder="请输入仓库简称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="隶属业务线" prop="affiliatLineId">
|
||||
<el-input v-model="form.affiliatLineId" placeholder="请输入隶属业务线" />
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择类型">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.WAREHOUSE_TYPE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="所在城市" prop="city">
|
||||
<el-input v-model="form.city" placeholder="请输入所在城市" />
|
||||
</el-form-item>
|
||||
<el-form-item label="成立时间" prop="establishDate">
|
||||
<el-date-picker clearable v-model="form.establishDate" type="date" value-format="timestamp" placeholder="选择成立时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="归属人员" prop="belongUserId">
|
||||
<el-input v-model="form.belongUserId" placeholder="请输入归属人员" />
|
||||
</el-form-item>
|
||||
<el-form-item label="介绍" prop="desc">
|
||||
<el-input v-model="form.desc" placeholder="请输入介绍" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createWarehouse, updateWarehouse, deleteWarehouse, getWarehouse, getWarehousePage, exportWarehouseExcel } from "@/api/xxjj/warehouse";
|
||||
|
||||
export default {
|
||||
name: "Warehouse",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 仓库列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
warehouseCode: null,
|
||||
warehouseName: null,
|
||||
affiliatLineId: null,
|
||||
type: null,
|
||||
city: null,
|
||||
establishDate: [],
|
||||
createTime: [],
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
warehouseCode: [{ required: true, message: "仓库编号不能为空", trigger: "blur" }],
|
||||
warehouseName: [{ required: true, message: "仓库名称不能为空", trigger: "blur" }],
|
||||
affiliatLineId: [{ required: true, message: "隶属业务线不能为空", trigger: "blur" }],
|
||||
type: [{ required: true, message: "类型不能为空", trigger: "change" }],
|
||||
city: [{ required: true, message: "所在城市不能为空", trigger: "blur" }],
|
||||
establishDate: [{ required: true, message: "成立时间不能为空", trigger: "blur" }],
|
||||
belongUserId: [{ required: true, message: "归属人员不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getWarehousePage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
warehouseCode: undefined,
|
||||
warehouseName: undefined,
|
||||
warehouseSimple: undefined,
|
||||
affiliatLineId: undefined,
|
||||
type: undefined,
|
||||
city: undefined,
|
||||
establishDate: undefined,
|
||||
belongUserId: undefined,
|
||||
desc: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加仓库";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getWarehouse(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改仓库";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateWarehouse(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createWarehouse(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除仓库编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteWarehouse(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有仓库数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportWarehouseExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '仓库.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in new issue