feat:新增客户管理模块
parent
5d0c33d283
commit
d09de29de9
@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>yudao-module-customer</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>
|
||||||
|
customer 包下,客户管理
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-system</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 业务组件 -->
|
||||||
|
|
||||||
|
<!-- Web 相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- DB 相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 工具类相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Test 测试相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-test</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
package cn.iocoder.yudao.module.cus.controller.admin.management;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.cus.controller.admin.management.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.cus.dal.dataobject.management.ManagementDO;
|
||||||
|
import cn.iocoder.yudao.module.cus.service.management.ManagementService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 客户管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/cus/management")
|
||||||
|
@Validated
|
||||||
|
public class ManagementController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ManagementService managementService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建客户管理")
|
||||||
|
@PreAuthorize("@ss.hasPermission('cus:management:create')")
|
||||||
|
public CommonResult<Long> createManagement(@Valid @RequestBody ManagementSaveReqVO createReqVO) {
|
||||||
|
return success(managementService.createManagement(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新客户管理")
|
||||||
|
@PreAuthorize("@ss.hasPermission('cus:management:update')")
|
||||||
|
public CommonResult<Boolean> updateManagement(@Valid @RequestBody ManagementSaveReqVO updateReqVO) {
|
||||||
|
managementService.updateManagement(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除客户管理")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('cus:management:delete')")
|
||||||
|
public CommonResult<Boolean> deleteManagement(@RequestParam("id") Long id) {
|
||||||
|
managementService.deleteManagement(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除客户管理")
|
||||||
|
@PreAuthorize("@ss.hasPermission('cus:management:delete')")
|
||||||
|
public CommonResult<Boolean> deleteManagementList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
managementService.deleteManagementListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得客户管理")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('cus:management:query')")
|
||||||
|
public CommonResult<ManagementRespVO> getManagement(@RequestParam("id") Long id) {
|
||||||
|
ManagementDO management = managementService.getManagement(id);
|
||||||
|
return success(BeanUtils.toBean(management, ManagementRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得客户管理分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('cus:management:query')")
|
||||||
|
public CommonResult<PageResult<ManagementRespVO>> getManagementPage(@Valid ManagementPageReqVO pageReqVO) {
|
||||||
|
PageResult<ManagementDO> pageResult = managementService.getManagementPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, ManagementRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出客户管理 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('cus:management:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportManagementExcel(@Valid ManagementPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<ManagementDO> list = managementService.getManagementPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "客户管理.xls", "数据", ManagementRespVO.class,
|
||||||
|
BeanUtils.toBean(list, ManagementRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
package cn.iocoder.yudao.module.cus.controller.admin.management.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 客户管理分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class ManagementPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "客户编码")
|
||||||
|
private String customerCode;
|
||||||
|
|
||||||
|
@Schema(description = "客户名称", example = "张三")
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "售后负责人")
|
||||||
|
private String afterSalesManager;
|
||||||
|
|
||||||
|
@Schema(description = "国家编码")
|
||||||
|
private String countryCode;
|
||||||
|
|
||||||
|
@Schema(description = "国家名称", example = "王五")
|
||||||
|
private String countryName;
|
||||||
|
|
||||||
|
@Schema(description = "省编码")
|
||||||
|
private String provinceCode;
|
||||||
|
|
||||||
|
@Schema(description = "省名称", example = "王五")
|
||||||
|
private String provinceName;
|
||||||
|
|
||||||
|
@Schema(description = "城市编码")
|
||||||
|
private String cityCode;
|
||||||
|
|
||||||
|
@Schema(description = "城市名称", example = "赵六")
|
||||||
|
private String cityName;
|
||||||
|
|
||||||
|
@Schema(description = "详细地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@Schema(description = "经度")
|
||||||
|
private BigDecimal longitude;
|
||||||
|
|
||||||
|
@Schema(description = "纬度")
|
||||||
|
private BigDecimal latitude;
|
||||||
|
|
||||||
|
@Schema(description = "数据库IP")
|
||||||
|
private String dbIp;
|
||||||
|
|
||||||
|
@Schema(description = "数据库端口")
|
||||||
|
private Integer dbPort;
|
||||||
|
|
||||||
|
@Schema(description = "数据库账号", example = "赵六")
|
||||||
|
private String dbUsername;
|
||||||
|
|
||||||
|
@Schema(description = "数据库密码")
|
||||||
|
private String dbPassword;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,92 @@
|
|||||||
|
package cn.iocoder.yudao.module.cus.controller.admin.management.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import cn.idev.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 客户管理 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class ManagementRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14051")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "客户编码")
|
||||||
|
@ExcelProperty("客户编码")
|
||||||
|
private String customerCode;
|
||||||
|
|
||||||
|
@Schema(description = "客户名称", example = "张三")
|
||||||
|
@ExcelProperty("客户名称")
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "售后负责人")
|
||||||
|
@ExcelProperty("售后负责人")
|
||||||
|
private String afterSalesManager;
|
||||||
|
|
||||||
|
@Schema(description = "国家编码")
|
||||||
|
@ExcelProperty("国家编码")
|
||||||
|
private String countryCode;
|
||||||
|
|
||||||
|
@Schema(description = "国家名称", example = "王五")
|
||||||
|
@ExcelProperty("国家名称")
|
||||||
|
private String countryName;
|
||||||
|
|
||||||
|
@Schema(description = "省编码")
|
||||||
|
@ExcelProperty("省编码")
|
||||||
|
private String provinceCode;
|
||||||
|
|
||||||
|
@Schema(description = "省名称", example = "王五")
|
||||||
|
@ExcelProperty("省名称")
|
||||||
|
private String provinceName;
|
||||||
|
|
||||||
|
@Schema(description = "城市编码")
|
||||||
|
@ExcelProperty("城市编码")
|
||||||
|
private String cityCode;
|
||||||
|
|
||||||
|
@Schema(description = "城市名称", example = "赵六")
|
||||||
|
@ExcelProperty("城市名称")
|
||||||
|
private String cityName;
|
||||||
|
|
||||||
|
@Schema(description = "详细地址")
|
||||||
|
@ExcelProperty("详细地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@Schema(description = "经度")
|
||||||
|
@ExcelProperty("经度")
|
||||||
|
private BigDecimal longitude;
|
||||||
|
|
||||||
|
@Schema(description = "纬度")
|
||||||
|
@ExcelProperty("纬度")
|
||||||
|
private BigDecimal latitude;
|
||||||
|
|
||||||
|
@Schema(description = "数据库IP")
|
||||||
|
@ExcelProperty("数据库IP")
|
||||||
|
private String dbIp;
|
||||||
|
|
||||||
|
@Schema(description = "数据库端口")
|
||||||
|
@ExcelProperty("数据库端口")
|
||||||
|
private Integer dbPort;
|
||||||
|
|
||||||
|
@Schema(description = "数据库账号", example = "赵六")
|
||||||
|
@ExcelProperty("数据库账号")
|
||||||
|
private String dbUsername;
|
||||||
|
|
||||||
|
@Schema(description = "数据库密码")
|
||||||
|
@ExcelProperty("数据库密码")
|
||||||
|
private String dbPassword;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
package cn.iocoder.yudao.module.cus.controller.admin.management.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 客户管理新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class ManagementSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14051")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "客户编码")
|
||||||
|
private String customerCode;
|
||||||
|
|
||||||
|
@Schema(description = "客户名称", example = "张三")
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "售后负责人")
|
||||||
|
private String afterSalesManager;
|
||||||
|
|
||||||
|
@Schema(description = "国家编码")
|
||||||
|
private String countryCode;
|
||||||
|
|
||||||
|
@Schema(description = "国家名称", example = "王五")
|
||||||
|
private String countryName;
|
||||||
|
|
||||||
|
@Schema(description = "省编码")
|
||||||
|
private String provinceCode;
|
||||||
|
|
||||||
|
@Schema(description = "省名称", example = "王五")
|
||||||
|
private String provinceName;
|
||||||
|
|
||||||
|
@Schema(description = "城市编码")
|
||||||
|
private String cityCode;
|
||||||
|
|
||||||
|
@Schema(description = "城市名称", example = "赵六")
|
||||||
|
private String cityName;
|
||||||
|
|
||||||
|
@Schema(description = "详细地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@Schema(description = "经度")
|
||||||
|
private BigDecimal longitude;
|
||||||
|
|
||||||
|
@Schema(description = "纬度")
|
||||||
|
private BigDecimal latitude;
|
||||||
|
|
||||||
|
@Schema(description = "数据库IP")
|
||||||
|
private String dbIp;
|
||||||
|
|
||||||
|
@Schema(description = "数据库端口")
|
||||||
|
private Integer dbPort;
|
||||||
|
|
||||||
|
@Schema(description = "数据库账号", example = "赵六")
|
||||||
|
private String dbUsername;
|
||||||
|
|
||||||
|
@Schema(description = "数据库密码")
|
||||||
|
private String dbPassword;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,106 @@
|
|||||||
|
package cn.iocoder.yudao.module.cus.dal.dataobject.management;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户管理 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("cus_management")
|
||||||
|
@KeySequence("cus_management_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ManagementDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 客户编码
|
||||||
|
*/
|
||||||
|
private String customerCode;
|
||||||
|
/**
|
||||||
|
* 客户名称
|
||||||
|
*/
|
||||||
|
private String customerName;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 售后负责人
|
||||||
|
*/
|
||||||
|
private String afterSalesManager;
|
||||||
|
/**
|
||||||
|
* 国家编码
|
||||||
|
*/
|
||||||
|
private String countryCode;
|
||||||
|
/**
|
||||||
|
* 国家名称
|
||||||
|
*/
|
||||||
|
private String countryName;
|
||||||
|
/**
|
||||||
|
* 省编码
|
||||||
|
*/
|
||||||
|
private String provinceCode;
|
||||||
|
/**
|
||||||
|
* 省名称
|
||||||
|
*/
|
||||||
|
private String provinceName;
|
||||||
|
/**
|
||||||
|
* 城市编码
|
||||||
|
*/
|
||||||
|
private String cityCode;
|
||||||
|
/**
|
||||||
|
* 城市名称
|
||||||
|
*/
|
||||||
|
private String cityName;
|
||||||
|
/**
|
||||||
|
* 详细地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
private BigDecimal longitude;
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
private BigDecimal latitude;
|
||||||
|
/**
|
||||||
|
* 数据库IP
|
||||||
|
*/
|
||||||
|
private String dbIp;
|
||||||
|
/**
|
||||||
|
* 数据库端口
|
||||||
|
*/
|
||||||
|
private Integer dbPort;
|
||||||
|
/**
|
||||||
|
* 数据库账号
|
||||||
|
*/
|
||||||
|
private String dbUsername;
|
||||||
|
/**
|
||||||
|
* 数据库密码
|
||||||
|
*/
|
||||||
|
private String dbPassword;
|
||||||
|
/**
|
||||||
|
* 租户编号
|
||||||
|
*/
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package cn.iocoder.yudao.module.cus.dal.mysql.management;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.cus.dal.dataobject.management.ManagementDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.cus.controller.admin.management.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户管理 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ManagementMapper extends BaseMapperX<ManagementDO> {
|
||||||
|
|
||||||
|
default PageResult<ManagementDO> selectPage(ManagementPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<ManagementDO>()
|
||||||
|
.eqIfPresent(ManagementDO::getCustomerCode, reqVO.getCustomerCode())
|
||||||
|
.likeIfPresent(ManagementDO::getCustomerName, reqVO.getCustomerName())
|
||||||
|
.eqIfPresent(ManagementDO::getRemark, reqVO.getRemark())
|
||||||
|
.eqIfPresent(ManagementDO::getAfterSalesManager, reqVO.getAfterSalesManager())
|
||||||
|
.eqIfPresent(ManagementDO::getCountryCode, reqVO.getCountryCode())
|
||||||
|
.likeIfPresent(ManagementDO::getCountryName, reqVO.getCountryName())
|
||||||
|
.eqIfPresent(ManagementDO::getProvinceCode, reqVO.getProvinceCode())
|
||||||
|
.likeIfPresent(ManagementDO::getProvinceName, reqVO.getProvinceName())
|
||||||
|
.eqIfPresent(ManagementDO::getCityCode, reqVO.getCityCode())
|
||||||
|
.likeIfPresent(ManagementDO::getCityName, reqVO.getCityName())
|
||||||
|
.eqIfPresent(ManagementDO::getAddress, reqVO.getAddress())
|
||||||
|
.eqIfPresent(ManagementDO::getLongitude, reqVO.getLongitude())
|
||||||
|
.eqIfPresent(ManagementDO::getLatitude, reqVO.getLatitude())
|
||||||
|
.eqIfPresent(ManagementDO::getDbIp, reqVO.getDbIp())
|
||||||
|
.eqIfPresent(ManagementDO::getDbPort, reqVO.getDbPort())
|
||||||
|
.likeIfPresent(ManagementDO::getDbUsername, reqVO.getDbUsername())
|
||||||
|
.eqIfPresent(ManagementDO::getDbPassword, reqVO.getDbPassword())
|
||||||
|
.betweenIfPresent(ManagementDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(ManagementDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package cn.iocoder.yudao.module.cus.framework.web.config;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration;
|
||||||
|
import org.springdoc.core.GroupedOpenApi;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cus 模块的 web 组件的 Configuration
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Configuration(proxyBeanMethods = false)
|
||||||
|
public class CusWebConfiguration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cus 模块的 API 分组
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public GroupedOpenApi cusGroupedOpenApi() {
|
||||||
|
return YudaoSwaggerAutoConfiguration.buildGroupedOpenApi("cus");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
package cn.iocoder.yudao.module.cus.service.management;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.cus.controller.admin.management.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.cus.dal.dataobject.management.ManagementDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户管理 Service 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface ManagementService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建客户管理
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createManagement(@Valid ManagementSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新客户管理
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateManagement(@Valid ManagementSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除客户管理
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteManagement(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除客户管理
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteManagementListByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得客户管理
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 客户管理
|
||||||
|
*/
|
||||||
|
ManagementDO getManagement(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得客户管理分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 客户管理分页
|
||||||
|
*/
|
||||||
|
PageResult<ManagementDO> getManagementPage(ManagementPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
package cn.iocoder.yudao.module.cus.service.management;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.cus.controller.admin.management.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.cus.dal.dataobject.management.ManagementDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.cus.dal.mysql.management.ManagementMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.module.cus.enums.ErrorCodeConstants.MANAGEMENT_NOT_EXISTS;
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户管理 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class ManagementServiceImpl implements ManagementService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ManagementMapper managementMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createManagement(ManagementSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
ManagementDO management = BeanUtils.toBean(createReqVO, ManagementDO.class);
|
||||||
|
managementMapper.insert(management);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return management.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateManagement(ManagementSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateManagementExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
ManagementDO updateObj = BeanUtils.toBean(updateReqVO, ManagementDO.class);
|
||||||
|
managementMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteManagement(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateManagementExists(id);
|
||||||
|
// 删除
|
||||||
|
managementMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteManagementListByIds(List<Long> ids) {
|
||||||
|
// 删除
|
||||||
|
managementMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateManagementExists(Long id) {
|
||||||
|
if (managementMapper.selectById(id) == null) {
|
||||||
|
throw exception(MANAGEMENT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ManagementDO getManagement(Long id) {
|
||||||
|
return managementMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ManagementDO> getManagementPage(ManagementPageReqVO pageReqVO) {
|
||||||
|
return managementMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue