mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-28 01:45:08 +08:00
[feat] 添加
This commit is contained in:
5
pom.xml
5
pom.xml
@ -25,8 +25,9 @@
|
|||||||
<!-- <module>yudao-module-mall</module>-->
|
<!-- <module>yudao-module-mall</module>-->
|
||||||
<!-- <module>yudao-module-crm</module>-->
|
<!-- <module>yudao-module-crm</module>-->
|
||||||
<!-- <module>yudao-module-erp</module>-->
|
<!-- <module>yudao-module-erp</module>-->
|
||||||
<!-- <module>yudao-module-ai</module>-->
|
<module>yudao-module-ai</module>
|
||||||
<!-- <module>yudao-module-iot</module>-->
|
<module>yudao-module-pm</module>
|
||||||
|
<!-- <module>yudao-module-iot</module>-->
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
|
55
sql/generateCode/menu_pm_customer.sql
Normal file
55
sql/generateCode/menu_pm_customer.sql
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
-- 菜单 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status, component_name
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'客户信息管理', '', 2, 0, 2759,
|
||||||
|
'customer', '', 'pm/customer/index', 0, 'Customer'
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 按钮父菜单ID
|
||||||
|
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
||||||
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- 按钮 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'客户信息查询', 'pm:customer:query', 3, 1, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'客户信息创建', 'pm:customer:create', 3, 2, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'客户信息更新', 'pm:customer:update', 3, 3, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'客户信息删除', 'pm:customer:delete', 3, 4, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'客户信息导出', 'pm:customer:export', 3, 5, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
55
sql/generateCode/menu_subcontractor.sql
Normal file
55
sql/generateCode/menu_subcontractor.sql
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
-- 菜单 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status, component_name
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'供应商信息管理', '', 2, 0, 2759,
|
||||||
|
'subcontractor', '', 'pm/subcontractor/index', 0, 'Subcontractor'
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 按钮父菜单ID
|
||||||
|
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
||||||
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- 按钮 SQL
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'供应商信息查询', 'pm:subcontractor:query', 3, 1, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'供应商信息创建', 'pm:subcontractor:create', 3, 2, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'供应商信息更新', 'pm:subcontractor:update', 3, 3, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'供应商信息删除', 'pm:subcontractor:delete', 3, 4, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
||||||
|
INSERT INTO system_menu(
|
||||||
|
name, permission, type, sort, parent_id,
|
||||||
|
path, icon, component, status
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
'供应商信息导出', 'pm:subcontractor:export', 3, 5, @parentId,
|
||||||
|
'', '', '', 0
|
||||||
|
);
|
23
yudao-module-pm/pom.xml
Normal file
23
yudao-module-pm/pom.xml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>yudao-module-pm</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>
|
||||||
|
项目管理模块
|
||||||
|
</description>
|
||||||
|
<modules>
|
||||||
|
<module>yudao-module-pm-api</module>
|
||||||
|
<module>yudao-module-pm-biz</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
27
yudao-module-pm/yudao-module-pm-api/pom.xml
Normal file
27
yudao-module-pm/yudao-module-pm-api/pom.xml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-pm</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>yudao-module-pm-api</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
项目管理 API,暴露给业务系统调用
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,4 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.enums;
|
||||||
|
|
||||||
|
public interface DictTypeConstants {
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.enums;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||||
|
|
||||||
|
public interface ErrorCodeConstants {
|
||||||
|
ErrorCode CUSTOMER_NOT_EXISTS = new ErrorCode(1_060_000_000, "客户信息不存在");
|
||||||
|
ErrorCode SUBCONTRACTOR_NOT_EXISTS = new ErrorCode(1_061_000_000, "供应商信息不存在");
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm;
|
70
yudao-module-pm/yudao-module-pm-biz/pom.xml
Normal file
70
yudao-module-pm/yudao-module-pm-biz/pom.xml
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-pm</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>yudao-module-pm-biz</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
项目管理-业务模块
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-pm-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 流程相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-bpm-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 系统业务 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-system-biz</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>
|
||||||
|
|
||||||
|
<!-- Test 测试相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-test</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,95 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.controller.admin.customer;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import jakarta.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 jakarta.validation.constraints.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import jakarta.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.pm.controller.admin.customer.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.pm.dal.dataobject.customer.CustomerDO;
|
||||||
|
import cn.iocoder.yudao.module.pm.service.customer.CustomerService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 客户信息")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pm/customer")
|
||||||
|
@Validated
|
||||||
|
public class CustomerController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CustomerService customerService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建客户信息")
|
||||||
|
@PreAuthorize("@ss.hasPermission('pm:customer:create')")
|
||||||
|
public CommonResult<Long> createCustomer(@Valid @RequestBody CustomerSaveReqVO createReqVO) {
|
||||||
|
return success(customerService.createCustomer(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新客户信息")
|
||||||
|
@PreAuthorize("@ss.hasPermission('pm:customer:update')")
|
||||||
|
public CommonResult<Boolean> updateCustomer(@Valid @RequestBody CustomerSaveReqVO updateReqVO) {
|
||||||
|
customerService.updateCustomer(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除客户信息")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('pm:customer:delete')")
|
||||||
|
public CommonResult<Boolean> deleteCustomer(@RequestParam("id") Long id) {
|
||||||
|
customerService.deleteCustomer(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得客户信息")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('pm:customer:query')")
|
||||||
|
public CommonResult<CustomerRespVO> getCustomer(@RequestParam("id") Long id) {
|
||||||
|
CustomerDO customer = customerService.getCustomer(id);
|
||||||
|
return success(BeanUtils.toBean(customer, CustomerRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得客户信息分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('pm:customer:query')")
|
||||||
|
public CommonResult<PageResult<CustomerRespVO>> getCustomerPage(@Valid CustomerPageReqVO pageReqVO) {
|
||||||
|
PageResult<CustomerDO> pageResult = customerService.getCustomerPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, CustomerRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出客户信息 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('pm:customer:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportCustomerExcel(@Valid CustomerPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<CustomerDO> list = customerService.getCustomerPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "客户信息.xls", "数据", CustomerRespVO.class,
|
||||||
|
BeanUtils.toBean(list, CustomerRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.controller.admin.customer.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 客户信息分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class CustomerPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18202")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "客户名称", example = "设计院")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "组织机构代码", example = "91350200MAD0EHH44J")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "联系人", example = "张三")
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
@Schema(description = "电话", example = "18655424896")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@Schema(description = "地址", example = "厦门市湖里区槟城道289号701室")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.controller.admin.customer.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 客户信息 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class CustomerRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18202")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "设计院")
|
||||||
|
@ExcelProperty("客户名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "组织机构代码", requiredMode = Schema.RequiredMode.REQUIRED, example = "91350200MAD0EHH44J")
|
||||||
|
@ExcelProperty("组织机构代码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "联系人", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||||
|
@ExcelProperty("联系人")
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
@Schema(description = "电话", requiredMode = Schema.RequiredMode.REQUIRED, example = "18655424896")
|
||||||
|
@ExcelProperty("电话")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@Schema(description = "地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "厦门市湖里区槟城道289号701室")
|
||||||
|
@ExcelProperty("地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.controller.admin.customer.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 客户信息新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class CustomerSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18202")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "设计院")
|
||||||
|
@NotEmpty(message = "客户名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "组织机构代码", requiredMode = Schema.RequiredMode.REQUIRED, example = "91350200MAD0EHH44J")
|
||||||
|
@NotEmpty(message = "组织机构代码不能为空")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "联系人", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||||
|
@NotEmpty(message = "联系人不能为空")
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
@Schema(description = "电话", requiredMode = Schema.RequiredMode.REQUIRED, example = "18655424896")
|
||||||
|
@NotEmpty(message = "电话不能为空")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@Schema(description = "地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "厦门市湖里区槟城道289号701室")
|
||||||
|
@NotEmpty(message = "地址不能为空")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,95 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.controller.admin.subcontractor;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import jakarta.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 jakarta.validation.constraints.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import jakarta.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.pm.controller.admin.subcontractor.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.pm.dal.dataobject.subcontractor.SubcontractorDO;
|
||||||
|
import cn.iocoder.yudao.module.pm.service.subcontractor.SubcontractorService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 供应商信息")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pm/subcontractor")
|
||||||
|
@Validated
|
||||||
|
public class SubcontractorController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SubcontractorService subcontractorService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建供应商信息")
|
||||||
|
@PreAuthorize("@ss.hasPermission('pm:subcontractor:create')")
|
||||||
|
public CommonResult<Long> createSubcontractor(@Valid @RequestBody SubcontractorSaveReqVO createReqVO) {
|
||||||
|
return success(subcontractorService.createSubcontractor(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新供应商信息")
|
||||||
|
@PreAuthorize("@ss.hasPermission('pm:subcontractor:update')")
|
||||||
|
public CommonResult<Boolean> updateSubcontractor(@Valid @RequestBody SubcontractorSaveReqVO updateReqVO) {
|
||||||
|
subcontractorService.updateSubcontractor(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除供应商信息")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('pm:subcontractor:delete')")
|
||||||
|
public CommonResult<Boolean> deleteSubcontractor(@RequestParam("id") Long id) {
|
||||||
|
subcontractorService.deleteSubcontractor(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得供应商信息")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('pm:subcontractor:query')")
|
||||||
|
public CommonResult<SubcontractorRespVO> getSubcontractor(@RequestParam("id") Long id) {
|
||||||
|
SubcontractorDO subcontractor = subcontractorService.getSubcontractor(id);
|
||||||
|
return success(BeanUtils.toBean(subcontractor, SubcontractorRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得供应商信息分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('pm:subcontractor:query')")
|
||||||
|
public CommonResult<PageResult<SubcontractorRespVO>> getSubcontractorPage(@Valid SubcontractorPageReqVO pageReqVO) {
|
||||||
|
PageResult<SubcontractorDO> pageResult = subcontractorService.getSubcontractorPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, SubcontractorRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出供应商信息 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('pm:subcontractor:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportSubcontractorExcel(@Valid SubcontractorPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<SubcontractorDO> list = subcontractorService.getSubcontractorPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "供应商信息.xls", "数据", SubcontractorRespVO.class,
|
||||||
|
BeanUtils.toBean(list, SubcontractorRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.controller.admin.subcontractor.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 供应商信息分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SubcontractorPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "供应商名称", example = "张三")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "组织机构代码", example = "12345")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "联系人", example = "张三")
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
@Schema(description = "电话 ", example = "145789754112")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@Schema(description = "地址 ", example = "北京合同1234路")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.controller.admin.subcontractor.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 供应商信息 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class SubcontractorRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "9785")
|
||||||
|
@ExcelProperty("主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "供应商名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||||
|
@ExcelProperty("供应商名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "组织机构代码", requiredMode = Schema.RequiredMode.REQUIRED, example = "12345")
|
||||||
|
@ExcelProperty("组织机构代码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "联系人", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||||
|
@ExcelProperty("联系人")
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
@Schema(description = "电话 ", requiredMode = Schema.RequiredMode.REQUIRED, example = "145789754112")
|
||||||
|
@ExcelProperty("电话 ")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@Schema(description = "地址 ", requiredMode = Schema.RequiredMode.REQUIRED, example = "北京合同1234路")
|
||||||
|
@ExcelProperty("地址 ")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.controller.admin.subcontractor.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 供应商信息新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class SubcontractorSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "9785")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "供应商名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||||
|
@NotEmpty(message = "供应商名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "组织机构代码", requiredMode = Schema.RequiredMode.REQUIRED, example = "12345")
|
||||||
|
@NotEmpty(message = "组织机构代码不能为空")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "联系人", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||||
|
@NotEmpty(message = "联系人不能为空")
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
@Schema(description = "电话 ", requiredMode = Schema.RequiredMode.REQUIRED, example = "145789754112")
|
||||||
|
@NotEmpty(message = "电话 不能为空")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@Schema(description = "地址 ", requiredMode = Schema.RequiredMode.REQUIRED, example = "北京合同1234路")
|
||||||
|
@NotEmpty(message = "地址 不能为空")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.dal.dataobject.customer;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户信息 DO
|
||||||
|
*
|
||||||
|
* @author hhyykk
|
||||||
|
*/
|
||||||
|
@TableName("pm_customer")
|
||||||
|
@KeySequence("pm_customer_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CustomerDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 客户名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 组织机构代码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
private String contacts;
|
||||||
|
/**
|
||||||
|
* 电话
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
/**
|
||||||
|
* 拓展字段1
|
||||||
|
*/
|
||||||
|
private String exText1;
|
||||||
|
/**
|
||||||
|
* 拓展字段2
|
||||||
|
*/
|
||||||
|
private String exText2;
|
||||||
|
/**
|
||||||
|
* 拓展字段3
|
||||||
|
*/
|
||||||
|
private String exText3;
|
||||||
|
/**
|
||||||
|
* 拓展字段3
|
||||||
|
*/
|
||||||
|
private String exText4;
|
||||||
|
/**
|
||||||
|
* 拓展字段4
|
||||||
|
*/
|
||||||
|
private String exText5;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.dal.dataobject.subcontractor;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商信息 DO
|
||||||
|
*
|
||||||
|
* @author hhyykk
|
||||||
|
*/
|
||||||
|
@TableName("pm_subcontractor")
|
||||||
|
@KeySequence("pm_subcontractor_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SubcontractorDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 供应商名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 组织机构代码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
private String contacts;
|
||||||
|
/**
|
||||||
|
* 电话
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
/**
|
||||||
|
* 拓展字段1
|
||||||
|
*/
|
||||||
|
private String exTxt1;
|
||||||
|
/**
|
||||||
|
* 拓展字段2
|
||||||
|
*/
|
||||||
|
private String exTxt2;
|
||||||
|
/**
|
||||||
|
* 拓展字段3
|
||||||
|
*/
|
||||||
|
private String exTxt3;
|
||||||
|
/**
|
||||||
|
* 拓展字段4
|
||||||
|
*/
|
||||||
|
private String exTxt4;
|
||||||
|
/**
|
||||||
|
* 拓展字段5
|
||||||
|
*/
|
||||||
|
private String exTxt5;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.dal.mysql.customer;
|
||||||
|
|
||||||
|
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.pm.dal.dataobject.customer.CustomerDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.pm.controller.admin.customer.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户信息 Mapper
|
||||||
|
*
|
||||||
|
* @author hhyykk
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CustomerMapper extends BaseMapperX<CustomerDO> {
|
||||||
|
|
||||||
|
default PageResult<CustomerDO> selectPage(CustomerPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<CustomerDO>()
|
||||||
|
.likeIfPresent(CustomerDO::getName, reqVO.getName())
|
||||||
|
.likeIfPresent(CustomerDO::getCode, reqVO.getCode())
|
||||||
|
.likeIfPresent(CustomerDO::getContacts, reqVO.getContacts())
|
||||||
|
.likeIfPresent(CustomerDO::getPhone, reqVO.getPhone())
|
||||||
|
.likeIfPresent(CustomerDO::getAddress, reqVO.getAddress())
|
||||||
|
.orderByDesc(CustomerDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.dal.mysql.subcontractor;
|
||||||
|
|
||||||
|
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.pm.dal.dataobject.subcontractor.SubcontractorDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.pm.controller.admin.subcontractor.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商信息 Mapper
|
||||||
|
*
|
||||||
|
* @author hhyykk
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SubcontractorMapper extends BaseMapperX<SubcontractorDO> {
|
||||||
|
|
||||||
|
default PageResult<SubcontractorDO> selectPage(SubcontractorPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<SubcontractorDO>()
|
||||||
|
.likeIfPresent(SubcontractorDO::getName, reqVO.getName())
|
||||||
|
.likeIfPresent(SubcontractorDO::getCode, reqVO.getCode())
|
||||||
|
.likeIfPresent(SubcontractorDO::getContacts, reqVO.getContacts())
|
||||||
|
.likeIfPresent(SubcontractorDO::getPhone, reqVO.getPhone())
|
||||||
|
.likeIfPresent(SubcontractorDO::getAddress, reqVO.getAddress())
|
||||||
|
.orderByDesc(SubcontractorDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm;
|
@ -0,0 +1,55 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.service.customer;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.pm.controller.admin.customer.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.pm.dal.dataobject.customer.CustomerDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户信息 Service 接口
|
||||||
|
*
|
||||||
|
* @author hhyykk
|
||||||
|
*/
|
||||||
|
public interface CustomerService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建客户信息
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createCustomer(@Valid CustomerSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新客户信息
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateCustomer(@Valid CustomerSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除客户信息
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteCustomer(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得客户信息
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 客户信息
|
||||||
|
*/
|
||||||
|
CustomerDO getCustomer(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得客户信息分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 客户信息分页
|
||||||
|
*/
|
||||||
|
PageResult<CustomerDO> getCustomerPage(CustomerPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.service.customer;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.pm.controller.admin.customer.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.pm.dal.dataobject.customer.CustomerDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.pm.dal.mysql.customer.CustomerMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.pm.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户信息 Service 实现类
|
||||||
|
*
|
||||||
|
* @author hhyykk
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class CustomerServiceImpl implements CustomerService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CustomerMapper customerMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createCustomer(CustomerSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
CustomerDO customer = BeanUtils.toBean(createReqVO, CustomerDO.class);
|
||||||
|
customerMapper.insert(customer);
|
||||||
|
// 返回
|
||||||
|
return customer.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateCustomer(CustomerSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateCustomerExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
CustomerDO updateObj = BeanUtils.toBean(updateReqVO, CustomerDO.class);
|
||||||
|
customerMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteCustomer(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateCustomerExists(id);
|
||||||
|
// 删除
|
||||||
|
customerMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateCustomerExists(Long id) {
|
||||||
|
if (customerMapper.selectById(id) == null) {
|
||||||
|
throw exception(CUSTOMER_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CustomerDO getCustomer(Long id) {
|
||||||
|
return customerMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<CustomerDO> getCustomerPage(CustomerPageReqVO pageReqVO) {
|
||||||
|
return customerMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.service.subcontractor;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.pm.controller.admin.subcontractor.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.pm.dal.dataobject.subcontractor.SubcontractorDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商信息 Service 接口
|
||||||
|
*
|
||||||
|
* @author hhyykk
|
||||||
|
*/
|
||||||
|
public interface SubcontractorService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建供应商信息
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createSubcontractor(@Valid SubcontractorSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新供应商信息
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateSubcontractor(@Valid SubcontractorSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除供应商信息
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteSubcontractor(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得供应商信息
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 供应商信息
|
||||||
|
*/
|
||||||
|
SubcontractorDO getSubcontractor(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得供应商信息分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 供应商信息分页
|
||||||
|
*/
|
||||||
|
PageResult<SubcontractorDO> getSubcontractorPage(SubcontractorPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package cn.iocoder.yudao.module.pm.service.subcontractor;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.pm.controller.admin.subcontractor.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.pm.dal.dataobject.subcontractor.SubcontractorDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.pm.dal.mysql.subcontractor.SubcontractorMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.pm.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商信息 Service 实现类
|
||||||
|
*
|
||||||
|
* @author hhyykk
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class SubcontractorServiceImpl implements SubcontractorService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SubcontractorMapper subcontractorMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createSubcontractor(SubcontractorSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
SubcontractorDO subcontractor = BeanUtils.toBean(createReqVO, SubcontractorDO.class);
|
||||||
|
subcontractorMapper.insert(subcontractor);
|
||||||
|
// 返回
|
||||||
|
return subcontractor.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSubcontractor(SubcontractorSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateSubcontractorExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
SubcontractorDO updateObj = BeanUtils.toBean(updateReqVO, SubcontractorDO.class);
|
||||||
|
subcontractorMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteSubcontractor(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateSubcontractorExists(id);
|
||||||
|
// 删除
|
||||||
|
subcontractorMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateSubcontractorExists(Long id) {
|
||||||
|
if (subcontractorMapper.selectById(id) == null) {
|
||||||
|
throw exception(SUBCONTRACTOR_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SubcontractorDO getSubcontractor(Long id) {
|
||||||
|
return subcontractorMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<SubcontractorDO> getSubcontractorPage(SubcontractorPageReqVO pageReqVO) {
|
||||||
|
return subcontractorMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="cn.iocoder.yudao.module.pm.dal.mysql.customer.CustomerMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="cn.iocoder.yudao.module.pm.dal.mysql.subcontractor.SubcontractorMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
@ -66,7 +66,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
<artifactId>yudao-module-cms-biz</artifactId>
|
<artifactId>yudao-module-cms-biz</artifactId>
|
||||||
<version>2.1.0-snapshot</version>
|
<version>${revision}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -113,12 +113,20 @@
|
|||||||
<artifactId>yudao-module-cms-biz</artifactId>
|
<artifactId>yudao-module-cms-biz</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 新项目管理模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-pm-biz</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- AI 大模型相关模块。默认注释,保证编译速度 -->
|
<!-- AI 大模型相关模块。默认注释,保证编译速度 -->
|
||||||
<!-- <dependency>-->
|
<dependency>
|
||||||
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
<!-- <artifactId>yudao-module-ai-biz</artifactId>-->
|
<artifactId>yudao-module-ai-biz</artifactId>
|
||||||
<!-- <version>${revision}</version>-->
|
<version>${revision}</version>
|
||||||
<!-- </dependency>-->
|
</dependency>
|
||||||
|
|
||||||
<!-- IoT 物联网相关模块。默认注释,保证编译速度 -->
|
<!-- IoT 物联网相关模块。默认注释,保证编译速度 -->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
|
Reference in New Issue
Block a user