Commit bf247a6626f7f97d9d1cdd42ffb787b661c09176
Merge branch 'feature/crm' of https://gitee.com/ljlleo/ruoyi-vue-pro into feature/crm
# Conflicts: # sql/mysql/crm.sql
Showing
40 changed files
with
2059 additions
and
126 deletions
sql/mysql/crm.sql
| @@ -62,6 +62,10 @@ CREATE TABLE `crm_clue` ( | @@ -62,6 +62,10 @@ CREATE TABLE `crm_clue` ( | ||
| 62 | PRIMARY KEY (`id`) USING BTREE | 62 | PRIMARY KEY (`id`) USING BTREE |
| 63 | ) ENGINE = InnoDB COMMENT = '线索表' ; | 63 | ) ENGINE = InnoDB COMMENT = '线索表' ; |
| 64 | 64 | ||
| 65 | +-- ---------------------------- | ||
| 66 | +-- 商机表 | ||
| 67 | +-- ---------------------------- | ||
| 68 | + | ||
| 65 | DROP TABLE IF EXISTS `crm_business`; | 69 | DROP TABLE IF EXISTS `crm_business`; |
| 66 | CREATE TABLE `crm_business` ( | 70 | CREATE TABLE `crm_business` ( |
| 67 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', | 71 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', |
| @@ -211,4 +215,33 @@ CREATE TABLE `crm_customer` ( | @@ -211,4 +215,33 @@ CREATE TABLE `crm_customer` ( | ||
| 211 | `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', | 215 | `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', |
| 212 | PRIMARY KEY (`id`), | 216 | PRIMARY KEY (`id`), |
| 213 | KEY `owner_user_id` (`owner_user_id`) | 217 | KEY `owner_user_id` (`owner_user_id`) |
| 214 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='客户表'; | ||
| 215 | \ No newline at end of file | 218 | \ No newline at end of file |
| 219 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='客户表'; | ||
| 220 | +-- ---------------------------- | ||
| 221 | +-- 商机状态表 | ||
| 222 | +-- ---------------------------- | ||
| 223 | +DROP TABLE IF EXISTS `crm_business_status`; | ||
| 224 | +CREATE TABLE `crm_business_status` ( | ||
| 225 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', | ||
| 226 | + `type_id` bigint NOT NULL COMMENT '状态类型编号', | ||
| 227 | + `name` varchar(100) NOT NULL COMMENT '状态名', | ||
| 228 | + `percent` varchar(20) DEFAULT NULL COMMENT '赢单率', | ||
| 229 | + `sort` int DEFAULT NULL COMMENT '排序', | ||
| 230 | + `tenant_id` bigint DEFAULT '1' COMMENT '租户ID', | ||
| 231 | + PRIMARY KEY (`id`) | ||
| 232 | +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商机状态表' | ||
| 233 | + | ||
| 234 | +-- ---------------------------- | ||
| 235 | +-- 商机状态类型表 | ||
| 236 | +-- ---------------------------- | ||
| 237 | +DROP TABLE IF EXISTS `crm_business_status_type`; | ||
| 238 | +CREATE TABLE `crm_business_status_type` ( | ||
| 239 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', | ||
| 240 | + `name` varchar(100) NOT NULL COMMENT '状态类型名', | ||
| 241 | + `dept_ids` varchar(200) NOT NULL COMMENT '使用的部门编号', | ||
| 242 | + `status` bit(1) NOT NULL DEFAULT b'0' COMMENT '开启状态', | ||
| 243 | + `creator` varchar(64) NOT NULL COMMENT '创建人', | ||
| 244 | + `create_time` datetime NOT NULL COMMENT '创建时间', | ||
| 245 | + `update_time` datetime DEFAULT NULL COMMENT '更新时间', | ||
| 246 | + `tenant_id` bigint DEFAULT '1' COMMENT '租户ID', | ||
| 247 | + PRIMARY KEY (`id`) | ||
| 248 | +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商机状态类型表' |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java
| @@ -17,6 +17,8 @@ public interface ErrorCodeConstants { | @@ -17,6 +17,8 @@ public interface ErrorCodeConstants { | ||
| 17 | 17 | ||
| 18 | // ========== 商机管理 1-020-002-000 ========== | 18 | // ========== 商机管理 1-020-002-000 ========== |
| 19 | ErrorCode BUSINESS_NOT_EXISTS = new ErrorCode(1_020_002_000, "商机不存在"); | 19 | ErrorCode BUSINESS_NOT_EXISTS = new ErrorCode(1_020_002_000, "商机不存在"); |
| 20 | + ErrorCode BUSINESS_STATUS_TYPE_NOT_EXISTS = new ErrorCode(1_020_002_001, "商机状态类型不存在"); | ||
| 21 | + ErrorCode BUSINESS_STATUS_NOT_EXISTS = new ErrorCode(1_020_002_002, "商机状态不存在"); | ||
| 20 | 22 | ||
| 21 | // ========== 联系人管理 1-020-003-000 ========== | 23 | // ========== 联系人管理 1-020-003-000 ========== |
| 22 | ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_020_003_000, "联系人不存在"); | 24 | ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_020_003_000, "联系人不存在"); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
| @@ -71,6 +71,7 @@ public class CrmBusinessController { | @@ -71,6 +71,7 @@ public class CrmBusinessController { | ||
| 71 | @PreAuthorize("@ss.hasPermission('crm:business:query')") | 71 | @PreAuthorize("@ss.hasPermission('crm:business:query')") |
| 72 | public CommonResult<PageResult<CrmBusinessRespVO>> getBusinessPage(@Valid CrmBusinessPageReqVO pageVO) { | 72 | public CommonResult<PageResult<CrmBusinessRespVO>> getBusinessPage(@Valid CrmBusinessPageReqVO pageVO) { |
| 73 | PageResult<CrmBusinessDO> pageResult = businessService.getBusinessPage(pageVO); | 73 | PageResult<CrmBusinessDO> pageResult = businessService.getBusinessPage(pageVO); |
| 74 | + | ||
| 74 | return success(CrmBusinessConvert.INSTANCE.convertPage(pageResult)); | 75 | return success(CrmBusinessConvert.INSTANCE.convertPage(pageResult)); |
| 75 | } | 76 | } |
| 76 | 77 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessBaseVO.java
| @@ -21,13 +21,11 @@ public class CrmBusinessBaseVO { | @@ -21,13 +21,11 @@ public class CrmBusinessBaseVO { | ||
| 21 | @NotNull(message = "商机名称不能为空") | 21 | @NotNull(message = "商机名称不能为空") |
| 22 | private String name; | 22 | private String name; |
| 23 | 23 | ||
| 24 | - // TODO @ljileo:要写 requiredMode = Schema.RequiredMode.REQUIRED | ||
| 25 | - @Schema(description = "商机状态类型编号", example = "25714") | 24 | + @Schema(description = "商机状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25714") |
| 26 | @NotNull(message = "商机状态类型不能为空") | 25 | @NotNull(message = "商机状态类型不能为空") |
| 27 | private Long statusTypeId; | 26 | private Long statusTypeId; |
| 28 | 27 | ||
| 29 | - // TODO @ljileo:要写 requiredMode = Schema.RequiredMode.REQUIRED | ||
| 30 | - @Schema(description = "商机状态编号", example = "30320") | 28 | + @Schema(description = "商机状态编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") |
| 31 | @NotNull(message = "商机状态不能为空") | 29 | @NotNull(message = "商机状态不能为空") |
| 32 | private Long statusId; | 30 | private Long statusId; |
| 33 | 31 | ||
| @@ -43,13 +41,12 @@ public class CrmBusinessBaseVO { | @@ -43,13 +41,12 @@ public class CrmBusinessBaseVO { | ||
| 43 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 41 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 44 | private LocalDateTime dealTime; | 42 | private LocalDateTime dealTime; |
| 45 | 43 | ||
| 46 | - // TODO @ljileo:金额使用 Integer 类型,转换成分 | ||
| 47 | @Schema(description = "商机金额", example = "12371") | 44 | @Schema(description = "商机金额", example = "12371") |
| 48 | - private BigDecimal price; | 45 | + private Integer price; |
| 49 | 46 | ||
| 50 | // TODO @ljileo:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题 | 47 | // TODO @ljileo:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题 |
| 51 | @Schema(description = "整单折扣") | 48 | @Schema(description = "整单折扣") |
| 52 | - private BigDecimal discountPercent; | 49 | + private Integer discountPercent; |
| 53 | 50 | ||
| 54 | @Schema(description = "产品总金额", example = "12025") | 51 | @Schema(description = "产品总金额", example = "12025") |
| 55 | private BigDecimal productPrice; | 52 | private BigDecimal productPrice; |
| @@ -57,33 +54,4 @@ public class CrmBusinessBaseVO { | @@ -57,33 +54,4 @@ public class CrmBusinessBaseVO { | ||
| 57 | @Schema(description = "备注", example = "随便") | 54 | @Schema(description = "备注", example = "随便") |
| 58 | private String remark; | 55 | private String remark; |
| 59 | 56 | ||
| 60 | - // TODO @ljileo:这个新建和修改的时候,应该不传递哈;应该新建的人,就是它的负责人 | ||
| 61 | - @Schema(description = "负责人的用户编号", example = "25562") | ||
| 62 | - private Long ownerUserId; | ||
| 63 | - | ||
| 64 | - // TODO @ljileo:这个新建和修改的时候,应该不传递哈 | ||
| 65 | - @Schema(description = "只读权限的用户编号数组", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 66 | - private String roUserIds; | ||
| 67 | - | ||
| 68 | - // TODO @ljileo:这个新建和修改的时候,应该不传递哈 | ||
| 69 | - @Schema(description = "读写权限的用户编号数组", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 70 | - private String rwUserIds; | ||
| 71 | - | ||
| 72 | - // TODO @lijieo:新建的时候,不传递这个字段哈; | ||
| 73 | - @Schema(description = "1赢单2输单3无效", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 74 | - private Integer endStatus; | ||
| 75 | - | ||
| 76 | - // TODO @lijieo:新建的时候,不传递这个字段哈; | ||
| 77 | - @Schema(description = "结束时的备注", example = "你说的对") | ||
| 78 | - private String endRemark; | ||
| 79 | - | ||
| 80 | - // TODO @lijieo:新建的时候,不传递这个字段哈; | ||
| 81 | - @Schema(description = "最后跟进时间") | ||
| 82 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 83 | - private LocalDateTime contactLastTime; | ||
| 84 | - | ||
| 85 | - // TODO @lijieo:新建的时候,不传递这个字段哈; | ||
| 86 | - @Schema(description = "跟进状态", example = "1") | ||
| 87 | - private Integer followUpStatus; | ||
| 88 | - | ||
| 89 | } | 57 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessPageReqVO.java
| @@ -5,12 +5,6 @@ import io.swagger.v3.oas.annotations.media.Schema; | @@ -5,12 +5,6 @@ import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | import lombok.EqualsAndHashCode; | 6 | import lombok.EqualsAndHashCode; |
| 7 | import lombok.ToString; | 7 | import lombok.ToString; |
| 8 | -import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | - | ||
| 10 | -import java.math.BigDecimal; | ||
| 11 | -import java.time.LocalDateTime; | ||
| 12 | - | ||
| 13 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 14 | 8 | ||
| 15 | @Schema(description = "管理后台 - 商机分页 Request VO") | 9 | @Schema(description = "管理后台 - 商机分页 Request VO") |
| 16 | @Data | 10 | @Data |
| @@ -18,64 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | @@ -18,64 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | ||
| 18 | @ToString(callSuper = true) | 12 | @ToString(callSuper = true) |
| 19 | public class CrmBusinessPageReqVO extends PageParam { | 13 | public class CrmBusinessPageReqVO extends PageParam { |
| 20 | 14 | ||
| 21 | - // TODO @ljileo:目前就使用 name 检索即可; | ||
| 22 | - | ||
| 23 | @Schema(description = "商机名称", example = "李四") | 15 | @Schema(description = "商机名称", example = "李四") |
| 24 | private String name; | 16 | private String name; |
| 25 | 17 | ||
| 26 | - @Schema(description = "商机状态类型编号", example = "25714") | ||
| 27 | - private Long statusTypeId; | ||
| 28 | - | ||
| 29 | - @Schema(description = "商机状态编号", example = "30320") | ||
| 30 | - private Long statusId; | ||
| 31 | - | ||
| 32 | - @Schema(description = "下次联系时间") | ||
| 33 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 34 | - private LocalDateTime[] contactNextTime; | ||
| 35 | - | ||
| 36 | - @Schema(description = "客户编号", example = "10299") | ||
| 37 | - private Long customerId; | ||
| 38 | - | ||
| 39 | - @Schema(description = "预计成交日期") | ||
| 40 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 41 | - private LocalDateTime[] dealTime; | ||
| 42 | - | ||
| 43 | - @Schema(description = "商机金额", example = "12371") | ||
| 44 | - private BigDecimal price; | ||
| 45 | - | ||
| 46 | - @Schema(description = "整单折扣") | ||
| 47 | - private BigDecimal discountPercent; | ||
| 48 | - | ||
| 49 | - @Schema(description = "产品总金额", example = "12025") | ||
| 50 | - private BigDecimal productPrice; | ||
| 51 | - | ||
| 52 | - @Schema(description = "备注", example = "随便") | ||
| 53 | - private String remark; | ||
| 54 | - | ||
| 55 | - @Schema(description = "负责人的用户编号", example = "25562") | ||
| 56 | - private Long ownerUserId; | ||
| 57 | - | ||
| 58 | - @Schema(description = "创建时间") | ||
| 59 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 60 | - private LocalDateTime[] createTime; | ||
| 61 | - | ||
| 62 | - @Schema(description = "只读权限的用户编号数组") | ||
| 63 | - private String roUserIds; | ||
| 64 | - | ||
| 65 | - @Schema(description = "读写权限的用户编号数组") | ||
| 66 | - private String rwUserIds; | ||
| 67 | - | ||
| 68 | - @Schema(description = "1赢单2输单3无效", example = "1") | ||
| 69 | - private Integer endStatus; | ||
| 70 | - | ||
| 71 | - @Schema(description = "结束时的备注", example = "你说的对") | ||
| 72 | - private String endRemark; | ||
| 73 | - | ||
| 74 | - @Schema(description = "最后跟进时间") | ||
| 75 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 76 | - private LocalDateTime[] contactLastTime; | ||
| 77 | - | ||
| 78 | - @Schema(description = "跟进状态", example = "1") | ||
| 79 | - private Integer followUpStatus; | ||
| 80 | - | ||
| 81 | } | 18 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/CrmBusinessStatusController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 6 | +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.*; | ||
| 8 | +import cn.iocoder.yudao.module.crm.convert.businessstatus.CrmBusinessStatusConvert; | ||
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | ||
| 10 | +import cn.iocoder.yudao.module.crm.service.businessstatus.CrmBusinessStatusService; | ||
| 11 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 12 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 13 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 15 | +import org.springframework.validation.annotation.Validated; | ||
| 16 | +import org.springframework.web.bind.annotation.*; | ||
| 17 | + | ||
| 18 | +import javax.annotation.Resource; | ||
| 19 | +import javax.servlet.http.HttpServletResponse; | ||
| 20 | +import javax.validation.Valid; | ||
| 21 | +import java.io.IOException; | ||
| 22 | +import java.util.Collection; | ||
| 23 | +import java.util.List; | ||
| 24 | + | ||
| 25 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 26 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||
| 27 | + | ||
| 28 | +@Tag(name = "管理后台 - 商机状态") | ||
| 29 | +@RestController | ||
| 30 | +@RequestMapping("/crm/business-status") | ||
| 31 | +@Validated | ||
| 32 | +public class CrmBusinessStatusController { | ||
| 33 | + | ||
| 34 | + @Resource | ||
| 35 | + private CrmBusinessStatusService businessStatusService; | ||
| 36 | + | ||
| 37 | + @PostMapping("/create") | ||
| 38 | + @Operation(summary = "创建商机状态") | ||
| 39 | + @PreAuthorize("@ss.hasPermission('crm:business-status:create')") | ||
| 40 | + public CommonResult<Long> createBusinessStatus(@Valid @RequestBody CrmBusinessStatusCreateReqVO createReqVO) { | ||
| 41 | + return success(businessStatusService.createBusinessStatus(createReqVO)); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @PutMapping("/update") | ||
| 45 | + @Operation(summary = "更新商机状态") | ||
| 46 | + @PreAuthorize("@ss.hasPermission('crm:business-status:update')") | ||
| 47 | + public CommonResult<Boolean> updateBusinessStatus(@Valid @RequestBody CrmBusinessStatusUpdateReqVO updateReqVO) { | ||
| 48 | + businessStatusService.updateBusinessStatus(updateReqVO); | ||
| 49 | + return success(true); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @DeleteMapping("/delete") | ||
| 53 | + @Operation(summary = "删除商机状态") | ||
| 54 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 55 | + @PreAuthorize("@ss.hasPermission('crm:business-status:delete')") | ||
| 56 | + public CommonResult<Boolean> deleteBusinessStatus(@RequestParam("id") Long id) { | ||
| 57 | + businessStatusService.deleteBusinessStatus(id); | ||
| 58 | + return success(true); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @GetMapping("/get") | ||
| 62 | + @Operation(summary = "获得商机状态") | ||
| 63 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 64 | + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | ||
| 65 | + public CommonResult<CrmBusinessStatusRespVO> getBusinessStatus(@RequestParam("id") Long id) { | ||
| 66 | + CrmBusinessStatusDO businessStatus = businessStatusService.getBusinessStatus(id); | ||
| 67 | + return success(CrmBusinessStatusConvert.INSTANCE.convert(businessStatus)); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @GetMapping("/list") | ||
| 71 | + @Operation(summary = "获得商机状态列表") | ||
| 72 | + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") | ||
| 73 | + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | ||
| 74 | + public CommonResult<List<CrmBusinessStatusRespVO>> getBusinessStatusList(@RequestParam("ids") Collection<Long> ids) { | ||
| 75 | + List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(ids); | ||
| 76 | + return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + @GetMapping("/page") | ||
| 80 | + @Operation(summary = "获得商机状态分页") | ||
| 81 | + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | ||
| 82 | + public CommonResult<PageResult<CrmBusinessStatusRespVO>> getBusinessStatusPage(@Valid CrmBusinessStatusPageReqVO pageVO) { | ||
| 83 | + PageResult<CrmBusinessStatusDO> pageResult = businessStatusService.getBusinessStatusPage(pageVO); | ||
| 84 | + return success(CrmBusinessStatusConvert.INSTANCE.convertPage(pageResult)); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @GetMapping("/export-excel") | ||
| 88 | + @Operation(summary = "导出商机状态 Excel") | ||
| 89 | + @PreAuthorize("@ss.hasPermission('crm:business-status:export')") | ||
| 90 | + @OperateLog(type = EXPORT) | ||
| 91 | + public void exportBusinessStatusExcel(@Valid CrmBusinessStatusExportReqVO exportReqVO, | ||
| 92 | + HttpServletResponse response) throws IOException { | ||
| 93 | + List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(exportReqVO); | ||
| 94 | + // 导出 Excel | ||
| 95 | + List<CrmBusinessStatusExcelVO> datas = CrmBusinessStatusConvert.INSTANCE.convertList02(list); | ||
| 96 | + ExcelUtils.write(response, "商机状态.xls", "数据", CrmBusinessStatusExcelVO.class, datas); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + @GetMapping("/get-simple-list") | ||
| 100 | + @Operation(summary = "获得商机状态列表") | ||
| 101 | + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | ||
| 102 | + public CommonResult<List<CrmBusinessStatusRespVO>> getBusinessStatusListByTypeId(@RequestParam("typeId") Integer typeId) { | ||
| 103 | + List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusListByTypeId(typeId); | ||
| 104 | + return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + @GetMapping("/get-all-list") | ||
| 108 | + @Operation(summary = "获得商机状态列表") | ||
| 109 | + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | ||
| 110 | + public CommonResult<List<CrmBusinessStatusRespVO>> getBusinessStatusList() { | ||
| 111 | + List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(); | ||
| 112 | + return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import javax.validation.constraints.NotNull; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 商机状态 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 10 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +public class CrmBusinessStatusBaseVO { | ||
| 14 | + | ||
| 15 | + @Schema(description = "状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22882") | ||
| 16 | + @NotNull(message = "状态类型编号不能为空") | ||
| 17 | + private Long typeId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "状态名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | ||
| 20 | + @NotNull(message = "状态名不能为空") | ||
| 21 | + private String name; | ||
| 22 | + | ||
| 23 | + @Schema(description = "赢单率") | ||
| 24 | + private String percent; | ||
| 25 | + | ||
| 26 | + @Schema(description = "排序") | ||
| 27 | + private Integer sort; | ||
| 28 | + | ||
| 29 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import javax.validation.constraints.*; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - 商机状态创建 Request VO") | ||
| 9 | +@Data | ||
| 10 | +@EqualsAndHashCode(callSuper = true) | ||
| 11 | +@ToString(callSuper = true) | ||
| 12 | +public class CrmBusinessStatusCreateReqVO extends CrmBusinessStatusBaseVO { | ||
| 13 | + | ||
| 14 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusExcelVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | + | ||
| 7 | +import com.alibaba.excel.annotation.ExcelProperty; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 商机状态 Excel VO | ||
| 11 | + * | ||
| 12 | + * @author ljlleo | ||
| 13 | + */ | ||
| 14 | +@Data | ||
| 15 | +public class CrmBusinessStatusExcelVO { | ||
| 16 | + | ||
| 17 | + @ExcelProperty("主键") | ||
| 18 | + private Long id; | ||
| 19 | + | ||
| 20 | + @ExcelProperty("状态类型编号") | ||
| 21 | + private Long typeId; | ||
| 22 | + | ||
| 23 | + @ExcelProperty("状态名") | ||
| 24 | + private String name; | ||
| 25 | + | ||
| 26 | + @ExcelProperty("赢单率") | ||
| 27 | + private String percent; | ||
| 28 | + | ||
| 29 | + @ExcelProperty("排序") | ||
| 30 | + private Integer sort; | ||
| 31 | + | ||
| 32 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusExportReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - 商机状态 Excel 导出 Request VO,参数和 CrmBusinessStatusPageReqVO 是一致的") | ||
| 9 | +@Data | ||
| 10 | +public class CrmBusinessStatusExportReqVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "状态类型编号", example = "22882") | ||
| 13 | + private Long typeId; | ||
| 14 | + | ||
| 15 | + @Schema(description = "状态名", example = "李四") | ||
| 16 | + private String name; | ||
| 17 | + | ||
| 18 | + @Schema(description = "赢单率") | ||
| 19 | + private String percent; | ||
| 20 | + | ||
| 21 | + @Schema(description = "排序") | ||
| 22 | + private Integer sort; | ||
| 23 | + | ||
| 24 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.EqualsAndHashCode; | ||
| 7 | +import lombok.ToString; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - 商机状态分页 Request VO") | ||
| 10 | +@Data | ||
| 11 | +@EqualsAndHashCode(callSuper = true) | ||
| 12 | +@ToString(callSuper = true) | ||
| 13 | +public class CrmBusinessStatusPageReqVO extends PageParam { | ||
| 14 | + | ||
| 15 | + @Schema(description = "状态类型编号", example = "22882") | ||
| 16 | + private Long typeId; | ||
| 17 | + | ||
| 18 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | + | ||
| 6 | +@Schema(description = "管理后台 - 商机状态 Response VO") | ||
| 7 | +@Data | ||
| 8 | +@EqualsAndHashCode(callSuper = true) | ||
| 9 | +@ToString(callSuper = true) | ||
| 10 | +public class CrmBusinessStatusRespVO extends CrmBusinessStatusBaseVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "6802") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | +import javax.validation.constraints.*; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - 商机状态更新 Request VO") | ||
| 9 | +@Data | ||
| 10 | +@EqualsAndHashCode(callSuper = true) | ||
| 11 | +@ToString(callSuper = true) | ||
| 12 | +public class CrmBusinessStatusUpdateReqVO extends CrmBusinessStatusBaseVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "6802") | ||
| 15 | + @NotNull(message = "主键不能为空") | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/CrmBusinessStatusTypeController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 7 | +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.*; | ||
| 9 | +import cn.iocoder.yudao.module.crm.convert.businessstatustype.CrmBusinessStatusTypeConvert; | ||
| 10 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | ||
| 11 | +import cn.iocoder.yudao.module.crm.service.businessstatustype.CrmBusinessStatusTypeService; | ||
| 12 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 13 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 14 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 15 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 16 | +import org.springframework.validation.annotation.Validated; | ||
| 17 | +import org.springframework.web.bind.annotation.*; | ||
| 18 | + | ||
| 19 | +import javax.annotation.Resource; | ||
| 20 | +import javax.servlet.http.HttpServletResponse; | ||
| 21 | +import javax.validation.Valid; | ||
| 22 | +import java.io.IOException; | ||
| 23 | +import java.util.Collection; | ||
| 24 | +import java.util.List; | ||
| 25 | + | ||
| 26 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 27 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||
| 28 | + | ||
| 29 | +@Tag(name = "管理后台 - 商机状态类型") | ||
| 30 | +@RestController | ||
| 31 | +@RequestMapping("/crm/business-status-type") | ||
| 32 | +@Validated | ||
| 33 | +public class CrmBusinessStatusTypeController { | ||
| 34 | + | ||
| 35 | + @Resource | ||
| 36 | + private CrmBusinessStatusTypeService businessStatusTypeService; | ||
| 37 | + | ||
| 38 | + @PostMapping("/create") | ||
| 39 | + @Operation(summary = "创建商机状态类型") | ||
| 40 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:create')") | ||
| 41 | + public CommonResult<Long> createBusinessStatusType(@Valid @RequestBody CrmBusinessStatusTypeCreateReqVO createReqVO) { | ||
| 42 | + return success(businessStatusTypeService.createBusinessStatusType(createReqVO)); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @PutMapping("/update") | ||
| 46 | + @Operation(summary = "更新商机状态类型") | ||
| 47 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:update')") | ||
| 48 | + public CommonResult<Boolean> updateBusinessStatusType(@Valid @RequestBody CrmBusinessStatusTypeUpdateReqVO updateReqVO) { | ||
| 49 | + businessStatusTypeService.updateBusinessStatusType(updateReqVO); | ||
| 50 | + return success(true); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @DeleteMapping("/delete") | ||
| 54 | + @Operation(summary = "删除商机状态类型") | ||
| 55 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 56 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:delete')") | ||
| 57 | + public CommonResult<Boolean> deleteBusinessStatusType(@RequestParam("id") Long id) { | ||
| 58 | + businessStatusTypeService.deleteBusinessStatusType(id); | ||
| 59 | + return success(true); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @GetMapping("/get") | ||
| 63 | + @Operation(summary = "获得商机状态类型") | ||
| 64 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 65 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | ||
| 66 | + public CommonResult<CrmBusinessStatusTypeRespVO> getBusinessStatusType(@RequestParam("id") Long id) { | ||
| 67 | + CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeService.getBusinessStatusType(id); | ||
| 68 | + return success(CrmBusinessStatusTypeConvert.INSTANCE.convert(businessStatusType)); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + @GetMapping("/list") | ||
| 72 | + @Operation(summary = "获得商机状态类型列表") | ||
| 73 | + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") | ||
| 74 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | ||
| 75 | + public CommonResult<List<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypeList(@RequestParam("ids") Collection<Long> ids) { | ||
| 76 | + List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeList(ids); | ||
| 77 | + return success(CrmBusinessStatusTypeConvert.INSTANCE.convertList(list)); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @GetMapping("/page") | ||
| 81 | + @Operation(summary = "获得商机状态类型分页") | ||
| 82 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | ||
| 83 | + public CommonResult<PageResult<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypePage(@Valid CrmBusinessStatusTypePageReqVO pageVO) { | ||
| 84 | + PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageVO); | ||
| 85 | + return success(CrmBusinessStatusTypeConvert.INSTANCE.convertPage(pageResult)); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + @GetMapping("/export-excel") | ||
| 89 | + @Operation(summary = "导出商机状态类型 Excel") | ||
| 90 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:export')") | ||
| 91 | + @OperateLog(type = EXPORT) | ||
| 92 | + public void exportBusinessStatusTypeExcel(@Valid CrmBusinessStatusTypeExportReqVO exportReqVO, | ||
| 93 | + HttpServletResponse response) throws IOException { | ||
| 94 | + List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeList(exportReqVO); | ||
| 95 | + // 导出 Excel | ||
| 96 | + List<CrmBusinessStatusTypeExcelVO> datas = CrmBusinessStatusTypeConvert.INSTANCE.convertList02(list); | ||
| 97 | + ExcelUtils.write(response, "商机状态类型.xls", "数据", CrmBusinessStatusTypeExcelVO.class, datas); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @GetMapping("/get-simple-list") | ||
| 101 | + @Operation(summary = "获得商机状态类型列表") | ||
| 102 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | ||
| 103 | + public CommonResult<List<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypeList() { | ||
| 104 | + List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeListByStatus(CommonStatusEnum.ENABLE.getStatus()); | ||
| 105 | + return success(CrmBusinessStatusTypeConvert.INSTANCE.convertList(list)); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import javax.validation.constraints.NotNull; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 商机状态类型 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 10 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +public class CrmBusinessStatusTypeBaseVO { | ||
| 14 | + | ||
| 15 | + @Schema(description = "状态类型名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | ||
| 16 | + @NotNull(message = "状态类型名不能为空") | ||
| 17 | + private String name; | ||
| 18 | + | ||
| 19 | + @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 20 | + @NotNull(message = "使用的部门编号不能为空") | ||
| 21 | + private String deptIds; | ||
| 22 | + | ||
| 23 | + @Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 24 | + @NotNull(message = "开启状态不能为空") | ||
| 25 | + private Boolean status; | ||
| 26 | + | ||
| 27 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | +import lombok.EqualsAndHashCode; | ||
| 6 | +import lombok.ToString; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - 商机状态类型创建 Request VO") | ||
| 9 | +@Data | ||
| 10 | +@EqualsAndHashCode(callSuper = true) | ||
| 11 | +@ToString(callSuper = true) | ||
| 12 | +public class CrmBusinessStatusTypeCreateReqVO extends CrmBusinessStatusTypeBaseVO { | ||
| 13 | + | ||
| 14 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeExcelVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +import com.alibaba.excel.annotation.ExcelProperty; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 商机状态类型 Excel VO | ||
| 13 | + * | ||
| 14 | + * @author ljlleo | ||
| 15 | + */ | ||
| 16 | +@Data | ||
| 17 | +public class CrmBusinessStatusTypeExcelVO { | ||
| 18 | + | ||
| 19 | + @ExcelProperty("主键") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + @ExcelProperty("状态类型名") | ||
| 23 | + private String name; | ||
| 24 | + | ||
| 25 | + @ExcelProperty("使用的部门编号") | ||
| 26 | + private String deptIds; | ||
| 27 | + | ||
| 28 | + @ExcelProperty("开启状态") | ||
| 29 | + private Boolean status; | ||
| 30 | + | ||
| 31 | + @ExcelProperty("创建时间") | ||
| 32 | + private LocalDateTime createTime; | ||
| 33 | + | ||
| 34 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeExportReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | + | ||
| 10 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 11 | + | ||
| 12 | +@Schema(description = "管理后台 - 商机状态类型 Excel 导出 Request VO,参数和 CrmBusinessStatusTypePageReqVO 是一致的") | ||
| 13 | +@Data | ||
| 14 | +public class CrmBusinessStatusTypeExportReqVO { | ||
| 15 | + | ||
| 16 | + @Schema(description = "状态类型名", example = "芋艿") | ||
| 17 | + private String name; | ||
| 18 | + | ||
| 19 | + @Schema(description = "使用的部门编号") | ||
| 20 | + private String deptIds; | ||
| 21 | + | ||
| 22 | + @Schema(description = "开启状态", example = "1") | ||
| 23 | + private Boolean status; | ||
| 24 | + | ||
| 25 | + @Schema(description = "创建时间") | ||
| 26 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 27 | + private LocalDateTime[] createTime; | ||
| 28 | + | ||
| 29 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.EqualsAndHashCode; | ||
| 7 | +import lombok.ToString; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - 商机状态类型分页 Request VO") | ||
| 10 | +@Data | ||
| 11 | +@EqualsAndHashCode(callSuper = true) | ||
| 12 | +@ToString(callSuper = true) | ||
| 13 | +public class CrmBusinessStatusTypePageReqVO extends PageParam { | ||
| 14 | + | ||
| 15 | + @Schema(description = "状态类型名", example = "芋艿") | ||
| 16 | + private String name; | ||
| 17 | + | ||
| 18 | + @Schema(description = "开启状态", example = "1") | ||
| 19 | + private Boolean status; | ||
| 20 | + | ||
| 21 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.time.LocalDateTime; | ||
| 6 | + | ||
| 7 | +@Schema(description = "管理后台 - 商机状态类型 Response VO") | ||
| 8 | +@Data | ||
| 9 | +@EqualsAndHashCode(callSuper = true) | ||
| 10 | +@ToString(callSuper = true) | ||
| 11 | +public class CrmBusinessStatusTypeRespVO extends CrmBusinessStatusTypeBaseVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "24019") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 17 | + private LocalDateTime createTime; | ||
| 18 | + | ||
| 19 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | +import javax.validation.constraints.*; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - 商机状态类型更新 Request VO") | ||
| 9 | +@Data | ||
| 10 | +@EqualsAndHashCode(callSuper = true) | ||
| 11 | +@ToString(callSuper = true) | ||
| 12 | +public class CrmBusinessStatusTypeUpdateReqVO extends CrmBusinessStatusTypeBaseVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "24019") | ||
| 15 | + @NotNull(message = "主键不能为空") | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatus/CrmBusinessStatusConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.convert.businessstatus; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | + | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | + | ||
| 7 | +import org.mapstruct.Mapper; | ||
| 8 | +import org.mapstruct.factory.Mappers; | ||
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.*; | ||
| 10 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 商机状态 Convert | ||
| 14 | + * | ||
| 15 | + * @author ljlleo | ||
| 16 | + */ | ||
| 17 | +@Mapper | ||
| 18 | +public interface CrmBusinessStatusConvert { | ||
| 19 | + | ||
| 20 | + CrmBusinessStatusConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusConvert.class); | ||
| 21 | + | ||
| 22 | + CrmBusinessStatusDO convert(CrmBusinessStatusCreateReqVO bean); | ||
| 23 | + | ||
| 24 | + CrmBusinessStatusDO convert(CrmBusinessStatusUpdateReqVO bean); | ||
| 25 | + | ||
| 26 | + CrmBusinessStatusRespVO convert(CrmBusinessStatusDO bean); | ||
| 27 | + | ||
| 28 | + List<CrmBusinessStatusRespVO> convertList(List<CrmBusinessStatusDO> list); | ||
| 29 | + | ||
| 30 | + PageResult<CrmBusinessStatusRespVO> convertPage(PageResult<CrmBusinessStatusDO> page); | ||
| 31 | + | ||
| 32 | + List<CrmBusinessStatusExcelVO> convertList02(List<CrmBusinessStatusDO> list); | ||
| 33 | + | ||
| 34 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatustype/CrmBusinessStatusTypeConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.convert.businessstatustype; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | + | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | + | ||
| 7 | +import org.mapstruct.Mapper; | ||
| 8 | +import org.mapstruct.factory.Mappers; | ||
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.*; | ||
| 10 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 商机状态类型 Convert | ||
| 14 | + * | ||
| 15 | + * @author ljlleo | ||
| 16 | + */ | ||
| 17 | +@Mapper | ||
| 18 | +public interface CrmBusinessStatusTypeConvert { | ||
| 19 | + | ||
| 20 | + CrmBusinessStatusTypeConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusTypeConvert.class); | ||
| 21 | + | ||
| 22 | + CrmBusinessStatusTypeDO convert(CrmBusinessStatusTypeCreateReqVO bean); | ||
| 23 | + | ||
| 24 | + CrmBusinessStatusTypeDO convert(CrmBusinessStatusTypeUpdateReqVO bean); | ||
| 25 | + | ||
| 26 | + CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean); | ||
| 27 | + | ||
| 28 | + List<CrmBusinessStatusTypeRespVO> convertList(List<CrmBusinessStatusTypeDO> list); | ||
| 29 | + | ||
| 30 | + PageResult<CrmBusinessStatusTypeRespVO> convertPage(PageResult<CrmBusinessStatusTypeDO> page); | ||
| 31 | + | ||
| 32 | + List<CrmBusinessStatusTypeExcelVO> convertList02(List<CrmBusinessStatusTypeDO> list); | ||
| 33 | + | ||
| 34 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessDO.java
| 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.business; | 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.business; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | ||
| 5 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | ||
| 4 | import com.baomidou.mybatisplus.annotation.KeySequence; | 6 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 7 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | import com.baomidou.mybatisplus.annotation.TableName; | 8 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | import lombok.*; | 9 | import lombok.*; |
| 8 | 10 | ||
| 9 | -import java.math.BigDecimal; | ||
| 10 | import java.time.LocalDateTime; | 11 | import java.time.LocalDateTime; |
| 11 | 12 | ||
| 12 | /** | 13 | /** |
| @@ -36,13 +37,13 @@ public class CrmBusinessDO extends BaseDO { | @@ -36,13 +37,13 @@ public class CrmBusinessDO extends BaseDO { | ||
| 36 | /** | 37 | /** |
| 37 | * 商机状态类型编号 | 38 | * 商机状态类型编号 |
| 38 | * | 39 | * |
| 39 | - * TODO @ljileo:这个字段,后续要写下关联的实体哈 | 40 | + * 关联 {@link CrmBusinessStatusTypeDO#getId()} |
| 40 | */ | 41 | */ |
| 41 | private Long statusTypeId; | 42 | private Long statusTypeId; |
| 42 | /** | 43 | /** |
| 43 | * 商机状态编号 | 44 | * 商机状态编号 |
| 44 | * | 45 | * |
| 45 | - * TODO @ljileo:这个字段,后续要写下关联的实体哈 | 46 | + * 关联 {@link CrmBusinessStatusDO#getId()} |
| 46 | */ | 47 | */ |
| 47 | private Long statusId; | 48 | private Long statusId; |
| 48 | /** | 49 | /** |
| @@ -62,21 +63,18 @@ public class CrmBusinessDO extends BaseDO { | @@ -62,21 +63,18 @@ public class CrmBusinessDO extends BaseDO { | ||
| 62 | /** | 63 | /** |
| 63 | * 商机金额 | 64 | * 商机金额 |
| 64 | * | 65 | * |
| 65 | - * TODO @lijie:Integer | ||
| 66 | */ | 66 | */ |
| 67 | - private BigDecimal price; | 67 | + private Integer price; |
| 68 | /** | 68 | /** |
| 69 | * 整单折扣 | 69 | * 整单折扣 |
| 70 | * | 70 | * |
| 71 | - * TODO @lijie:Integer | ||
| 72 | */ | 71 | */ |
| 73 | - private BigDecimal discountPercent; | 72 | + private Integer discountPercent; |
| 74 | /** | 73 | /** |
| 75 | * 产品总金额 | 74 | * 产品总金额 |
| 76 | * | 75 | * |
| 77 | - * TODO @lijie:Integer | ||
| 78 | */ | 76 | */ |
| 79 | - private BigDecimal productPrice; | 77 | + private Integer productPrice; |
| 80 | /** | 78 | /** |
| 81 | * 备注 | 79 | * 备注 |
| 82 | */ | 80 | */ |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/businessstatus/CrmBusinessStatusDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import lombok.*; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 商机状态 DO | ||
| 10 | + * | ||
| 11 | + * @author ljlleo | ||
| 12 | + */ | ||
| 13 | +@TableName("crm_business_status") | ||
| 14 | +@KeySequence("crm_business_status_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 15 | +@Data | ||
| 16 | +@ToString(callSuper = true) | ||
| 17 | +@Builder | ||
| 18 | +@NoArgsConstructor | ||
| 19 | +@AllArgsConstructor | ||
| 20 | +public class CrmBusinessStatusDO { | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 主键 | ||
| 24 | + */ | ||
| 25 | + @TableId | ||
| 26 | + private Long id; | ||
| 27 | + /** | ||
| 28 | + * 状态类型编号 | ||
| 29 | + */ | ||
| 30 | + private Long typeId; | ||
| 31 | + /** | ||
| 32 | + * 状态名 | ||
| 33 | + */ | ||
| 34 | + private String name; | ||
| 35 | + /** | ||
| 36 | + * 赢单率 | ||
| 37 | + */ | ||
| 38 | + private String percent; | ||
| 39 | + /** | ||
| 40 | + * 排序 | ||
| 41 | + */ | ||
| 42 | + private Integer sort; | ||
| 43 | + | ||
| 44 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/businessstatustype/CrmBusinessStatusTypeDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import lombok.*; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 商机状态类型 DO | ||
| 10 | + * | ||
| 11 | + * @author ljlleo | ||
| 12 | + */ | ||
| 13 | +@TableName("crm_business_status_type") | ||
| 14 | +@KeySequence("crm_business_status_type_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 15 | +@Data | ||
| 16 | +@ToString(callSuper = true) | ||
| 17 | +@Builder | ||
| 18 | +@NoArgsConstructor | ||
| 19 | +@AllArgsConstructor | ||
| 20 | +public class CrmBusinessStatusTypeDO { | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 主键 | ||
| 24 | + */ | ||
| 25 | + @TableId | ||
| 26 | + private Long id; | ||
| 27 | + /** | ||
| 28 | + * 状态类型名 | ||
| 29 | + */ | ||
| 30 | + private String name; | ||
| 31 | + /** | ||
| 32 | + * 使用的部门编号 | ||
| 33 | + */ | ||
| 34 | + private String deptIds; | ||
| 35 | + /** | ||
| 36 | + * 开启状态 | ||
| 37 | + */ | ||
| 38 | + private Boolean status; | ||
| 39 | + | ||
| 40 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java
| @@ -21,23 +21,6 @@ public interface CrmBusinessMapper extends BaseMapperX<CrmBusinessDO> { | @@ -21,23 +21,6 @@ public interface CrmBusinessMapper extends BaseMapperX<CrmBusinessDO> { | ||
| 21 | default PageResult<CrmBusinessDO> selectPage(CrmBusinessPageReqVO reqVO) { | 21 | default PageResult<CrmBusinessDO> selectPage(CrmBusinessPageReqVO reqVO) { |
| 22 | return selectPage(reqVO, new LambdaQueryWrapperX<CrmBusinessDO>() | 22 | return selectPage(reqVO, new LambdaQueryWrapperX<CrmBusinessDO>() |
| 23 | .likeIfPresent(CrmBusinessDO::getName, reqVO.getName()) | 23 | .likeIfPresent(CrmBusinessDO::getName, reqVO.getName()) |
| 24 | - .eqIfPresent(CrmBusinessDO::getStatusTypeId, reqVO.getStatusTypeId()) | ||
| 25 | - .eqIfPresent(CrmBusinessDO::getStatusId, reqVO.getStatusId()) | ||
| 26 | - .betweenIfPresent(CrmBusinessDO::getContactNextTime, reqVO.getContactNextTime()) | ||
| 27 | - .eqIfPresent(CrmBusinessDO::getCustomerId, reqVO.getCustomerId()) | ||
| 28 | - .betweenIfPresent(CrmBusinessDO::getDealTime, reqVO.getDealTime()) | ||
| 29 | - .eqIfPresent(CrmBusinessDO::getPrice, reqVO.getPrice()) | ||
| 30 | - .eqIfPresent(CrmBusinessDO::getDiscountPercent, reqVO.getDiscountPercent()) | ||
| 31 | - .eqIfPresent(CrmBusinessDO::getProductPrice, reqVO.getProductPrice()) | ||
| 32 | - .eqIfPresent(CrmBusinessDO::getRemark, reqVO.getRemark()) | ||
| 33 | - .eqIfPresent(CrmBusinessDO::getOwnerUserId, reqVO.getOwnerUserId()) | ||
| 34 | - .betweenIfPresent(CrmBusinessDO::getCreateTime, reqVO.getCreateTime()) | ||
| 35 | - .eqIfPresent(CrmBusinessDO::getRoUserIds, reqVO.getRoUserIds()) | ||
| 36 | - .eqIfPresent(CrmBusinessDO::getRwUserIds, reqVO.getRwUserIds()) | ||
| 37 | - .eqIfPresent(CrmBusinessDO::getEndStatus, reqVO.getEndStatus()) | ||
| 38 | - .eqIfPresent(CrmBusinessDO::getEndRemark, reqVO.getEndRemark()) | ||
| 39 | - .betweenIfPresent(CrmBusinessDO::getContactLastTime, reqVO.getContactLastTime()) | ||
| 40 | - .eqIfPresent(CrmBusinessDO::getFollowUpStatus, reqVO.getFollowUpStatus()) | ||
| 41 | .orderByDesc(CrmBusinessDO::getId)); | 24 | .orderByDesc(CrmBusinessDO::getId)); |
| 42 | } | 25 | } |
| 43 | 26 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/businessstatus/CrmBusinessStatusMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.mysql.businessstatus; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | ||
| 9 | +import org.apache.ibatis.annotations.Mapper; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 商机状态 Mapper | ||
| 15 | + * | ||
| 16 | + * @author ljlleo | ||
| 17 | + */ | ||
| 18 | +@Mapper | ||
| 19 | +public interface CrmBusinessStatusMapper extends BaseMapperX<CrmBusinessStatusDO> { | ||
| 20 | + | ||
| 21 | + default PageResult<CrmBusinessStatusDO> selectPage(CrmBusinessStatusPageReqVO reqVO) { | ||
| 22 | + return selectPage(reqVO, new LambdaQueryWrapperX<CrmBusinessStatusDO>() | ||
| 23 | + .eqIfPresent(CrmBusinessStatusDO::getTypeId, reqVO.getTypeId()) | ||
| 24 | + .orderByDesc(CrmBusinessStatusDO::getId)); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + default List<CrmBusinessStatusDO> selectList(CrmBusinessStatusExportReqVO reqVO) { | ||
| 28 | + return selectList(new LambdaQueryWrapperX<CrmBusinessStatusDO>() | ||
| 29 | + .eqIfPresent(CrmBusinessStatusDO::getTypeId, reqVO.getTypeId()) | ||
| 30 | + .likeIfPresent(CrmBusinessStatusDO::getName, reqVO.getName()) | ||
| 31 | + .eqIfPresent(CrmBusinessStatusDO::getPercent, reqVO.getPercent()) | ||
| 32 | + .eqIfPresent(CrmBusinessStatusDO::getSort, reqVO.getSort()) | ||
| 33 | + .orderByDesc(CrmBusinessStatusDO::getId)); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + default List<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Integer typeId) { | ||
| 37 | + return selectList(CrmBusinessStatusDO::getTypeId, typeId); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/businessstatustype/CrmBusinessStatusTypeMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | ||
| 9 | +import org.apache.ibatis.annotations.Mapper; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 商机状态类型 Mapper | ||
| 15 | + * | ||
| 16 | + * @author ljlleo | ||
| 17 | + */ | ||
| 18 | +@Mapper | ||
| 19 | +public interface CrmBusinessStatusTypeMapper extends BaseMapperX<CrmBusinessStatusTypeDO> { | ||
| 20 | + | ||
| 21 | + default PageResult<CrmBusinessStatusTypeDO> selectPage(CrmBusinessStatusTypePageReqVO reqVO) { | ||
| 22 | + return selectPage(reqVO, new LambdaQueryWrapperX<CrmBusinessStatusTypeDO>() | ||
| 23 | + .likeIfPresent(CrmBusinessStatusTypeDO::getName, reqVO.getName()) | ||
| 24 | + .eqIfPresent(CrmBusinessStatusTypeDO::getDeptIds, reqVO.getDeptIds()) | ||
| 25 | + .eqIfPresent(CrmBusinessStatusTypeDO::getStatus, reqVO.getStatus()) | ||
| 26 | + .orderByDesc(CrmBusinessStatusTypeDO::getId)); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + default List<CrmBusinessStatusTypeDO> selectList(CrmBusinessStatusTypeExportReqVO reqVO) { | ||
| 30 | + return selectList(new LambdaQueryWrapperX<CrmBusinessStatusTypeDO>() | ||
| 31 | + .likeIfPresent(CrmBusinessStatusTypeDO::getName, reqVO.getName()) | ||
| 32 | + .eqIfPresent(CrmBusinessStatusTypeDO::getDeptIds, reqVO.getDeptIds()) | ||
| 33 | + .eqIfPresent(CrmBusinessStatusTypeDO::getStatus, reqVO.getStatus()) | ||
| 34 | + .orderByDesc(CrmBusinessStatusTypeDO::getId)); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + default List<CrmBusinessStatusTypeDO> getBusinessStatusTypeListByStatus(Integer status) { | ||
| 38 | + return selectList(CrmBusinessStatusTypeDO::getStatus, status.byteValue()); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + | ||
| 43 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.businessstatus; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusCreateReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusUpdateReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | ||
| 9 | + | ||
| 10 | +import javax.validation.Valid; | ||
| 11 | +import java.util.Collection; | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 商机状态 Service 接口 | ||
| 16 | + * | ||
| 17 | + * @author ljlleo | ||
| 18 | + */ | ||
| 19 | +public interface CrmBusinessStatusService { | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 创建商机状态 | ||
| 23 | + * | ||
| 24 | + * @param createReqVO 创建信息 | ||
| 25 | + * @return 编号 | ||
| 26 | + */ | ||
| 27 | + Long createBusinessStatus(@Valid CrmBusinessStatusCreateReqVO createReqVO); | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 更新商机状态 | ||
| 31 | + * | ||
| 32 | + * @param updateReqVO 更新信息 | ||
| 33 | + */ | ||
| 34 | + void updateBusinessStatus(@Valid CrmBusinessStatusUpdateReqVO updateReqVO); | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 删除商机状态 | ||
| 38 | + * | ||
| 39 | + * @param id 编号 | ||
| 40 | + */ | ||
| 41 | + void deleteBusinessStatus(Long id); | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 获得商机状态 | ||
| 45 | + * | ||
| 46 | + * @param id 编号 | ||
| 47 | + * @return 商机状态 | ||
| 48 | + */ | ||
| 49 | + CrmBusinessStatusDO getBusinessStatus(Long id); | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * 获得商机状态列表 | ||
| 53 | + * | ||
| 54 | + * @param ids 编号 | ||
| 55 | + * @return 商机状态列表 | ||
| 56 | + */ | ||
| 57 | + List<CrmBusinessStatusDO> getBusinessStatusList(Collection<Long> ids); | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * 获得商机状态分页 | ||
| 61 | + * | ||
| 62 | + * @param pageReqVO 分页查询 | ||
| 63 | + * @return 商机状态分页 | ||
| 64 | + */ | ||
| 65 | + PageResult<CrmBusinessStatusDO> getBusinessStatusPage(CrmBusinessStatusPageReqVO pageReqVO); | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 获得商机状态列表, 用于 Excel 导出 | ||
| 69 | + * | ||
| 70 | + * @param exportReqVO 查询条件 | ||
| 71 | + * @return 商机状态列表 | ||
| 72 | + */ | ||
| 73 | + List<CrmBusinessStatusDO> getBusinessStatusList(CrmBusinessStatusExportReqVO exportReqVO); | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 根据类型ID获得商机状态列表 | ||
| 77 | + * | ||
| 78 | + * @param typeId 商机状态类型ID | ||
| 79 | + * @return 商机状态列表 | ||
| 80 | + */ | ||
| 81 | + List<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Integer typeId); | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * 获得商机状态列表 | ||
| 85 | + * | ||
| 86 | + * @return 商机状态列表 | ||
| 87 | + */ | ||
| 88 | + List<CrmBusinessStatusDO> getBusinessStatusList(); | ||
| 89 | + | ||
| 90 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.businessstatus; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusCreateReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusUpdateReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.crm.convert.businessstatus.CrmBusinessStatusConvert; | ||
| 11 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | ||
| 12 | +import cn.iocoder.yudao.module.crm.dal.mysql.businessstatus.CrmBusinessStatusMapper; | ||
| 13 | +import org.springframework.stereotype.Service; | ||
| 14 | +import org.springframework.validation.annotation.Validated; | ||
| 15 | + | ||
| 16 | +import javax.annotation.Resource; | ||
| 17 | +import java.util.Collection; | ||
| 18 | +import java.util.List; | ||
| 19 | + | ||
| 20 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 21 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_NOT_EXISTS; | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * 商机状态 Service 实现类 | ||
| 25 | + * | ||
| 26 | + * @author ljlleo | ||
| 27 | + */ | ||
| 28 | +@Service | ||
| 29 | +@Validated | ||
| 30 | +public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { | ||
| 31 | + | ||
| 32 | + @Resource | ||
| 33 | + private CrmBusinessStatusMapper businessStatusMapper; | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public Long createBusinessStatus(CrmBusinessStatusCreateReqVO createReqVO) { | ||
| 37 | + // 插入 | ||
| 38 | + CrmBusinessStatusDO businessStatus = CrmBusinessStatusConvert.INSTANCE.convert(createReqVO); | ||
| 39 | + businessStatusMapper.insert(businessStatus); | ||
| 40 | + // 返回 | ||
| 41 | + return businessStatus.getId(); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @Override | ||
| 45 | + public void updateBusinessStatus(CrmBusinessStatusUpdateReqVO updateReqVO) { | ||
| 46 | + // 校验存在 | ||
| 47 | + validateBusinessStatusExists(updateReqVO.getId()); | ||
| 48 | + // 更新 | ||
| 49 | + CrmBusinessStatusDO updateObj = CrmBusinessStatusConvert.INSTANCE.convert(updateReqVO); | ||
| 50 | + businessStatusMapper.updateById(updateObj); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + public void deleteBusinessStatus(Long id) { | ||
| 55 | + // 校验存在 | ||
| 56 | + validateBusinessStatusExists(id); | ||
| 57 | + // 删除 | ||
| 58 | + businessStatusMapper.deleteById(id); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + private void validateBusinessStatusExists(Long id) { | ||
| 62 | + if (businessStatusMapper.selectById(id) == null) { | ||
| 63 | + throw exception(BUSINESS_STATUS_NOT_EXISTS); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public CrmBusinessStatusDO getBusinessStatus(Long id) { | ||
| 69 | + return businessStatusMapper.selectById(id); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @Override | ||
| 73 | + public List<CrmBusinessStatusDO> getBusinessStatusList(Collection<Long> ids) { | ||
| 74 | + if (CollUtil.isEmpty(ids)) { | ||
| 75 | + return ListUtil.empty(); | ||
| 76 | + } | ||
| 77 | + return businessStatusMapper.selectBatchIds(ids); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @Override | ||
| 81 | + public PageResult<CrmBusinessStatusDO> getBusinessStatusPage(CrmBusinessStatusPageReqVO pageReqVO) { | ||
| 82 | + return businessStatusMapper.selectPage(pageReqVO); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @Override | ||
| 86 | + public List<CrmBusinessStatusDO> getBusinessStatusList(CrmBusinessStatusExportReqVO exportReqVO) { | ||
| 87 | + return businessStatusMapper.selectList(exportReqVO); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + public List<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Integer typeId) { | ||
| 92 | + return businessStatusMapper.getBusinessStatusListByTypeId(typeId); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + @Override | ||
| 96 | + public List<CrmBusinessStatusDO> getBusinessStatusList() { | ||
| 97 | + return businessStatusMapper.selectList(); | ||
| 98 | + } | ||
| 99 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.businessstatustype; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeCreateReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeUpdateReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | ||
| 9 | + | ||
| 10 | +import javax.validation.Valid; | ||
| 11 | +import java.util.Collection; | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 商机状态类型 Service 接口 | ||
| 16 | + * | ||
| 17 | + * @author ljlleo | ||
| 18 | + */ | ||
| 19 | +public interface CrmBusinessStatusTypeService { | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 创建商机状态类型 | ||
| 23 | + * | ||
| 24 | + * @param createReqVO 创建信息 | ||
| 25 | + * @return 编号 | ||
| 26 | + */ | ||
| 27 | + Long createBusinessStatusType(@Valid CrmBusinessStatusTypeCreateReqVO createReqVO); | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 更新商机状态类型 | ||
| 31 | + * | ||
| 32 | + * @param updateReqVO 更新信息 | ||
| 33 | + */ | ||
| 34 | + void updateBusinessStatusType(@Valid CrmBusinessStatusTypeUpdateReqVO updateReqVO); | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 删除商机状态类型 | ||
| 38 | + * | ||
| 39 | + * @param id 编号 | ||
| 40 | + */ | ||
| 41 | + void deleteBusinessStatusType(Long id); | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 获得商机状态类型 | ||
| 45 | + * | ||
| 46 | + * @param id 编号 | ||
| 47 | + * @return 商机状态类型 | ||
| 48 | + */ | ||
| 49 | + CrmBusinessStatusTypeDO getBusinessStatusType(Long id); | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * 获得商机状态类型列表 | ||
| 53 | + * | ||
| 54 | + * @param ids 编号 | ||
| 55 | + * @return 商机状态类型列表 | ||
| 56 | + */ | ||
| 57 | + List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(Collection<Long> ids); | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * 获得商机状态类型分页 | ||
| 61 | + * | ||
| 62 | + * @param pageReqVO 分页查询 | ||
| 63 | + * @return 商机状态类型分页 | ||
| 64 | + */ | ||
| 65 | + PageResult<CrmBusinessStatusTypeDO> getBusinessStatusTypePage(CrmBusinessStatusTypePageReqVO pageReqVO); | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 获得商机状态类型列表, 用于 Excel 导出 | ||
| 69 | + * | ||
| 70 | + * @param exportReqVO 查询条件 | ||
| 71 | + * @return 商机状态类型列表 | ||
| 72 | + */ | ||
| 73 | + List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(CrmBusinessStatusTypeExportReqVO exportReqVO); | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 获得商机状态类型列表 | ||
| 77 | + * | ||
| 78 | + * @param status 状态 | ||
| 79 | + * @return 商机状态类型列表 | ||
| 80 | + */ | ||
| 81 | + List<CrmBusinessStatusTypeDO> getBusinessStatusTypeListByStatus(Integer status); | ||
| 82 | + | ||
| 83 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.businessstatustype; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeCreateReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeUpdateReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.crm.convert.businessstatustype.CrmBusinessStatusTypeConvert; | ||
| 11 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | ||
| 12 | +import cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype.CrmBusinessStatusTypeMapper; | ||
| 13 | +import org.springframework.stereotype.Service; | ||
| 14 | +import org.springframework.validation.annotation.Validated; | ||
| 15 | + | ||
| 16 | +import javax.annotation.Resource; | ||
| 17 | +import java.util.Collection; | ||
| 18 | +import java.util.List; | ||
| 19 | + | ||
| 20 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 21 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_TYPE_NOT_EXISTS; | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * 商机状态类型 Service 实现类 | ||
| 25 | + * | ||
| 26 | + * @author ljlleo | ||
| 27 | + */ | ||
| 28 | +@Service | ||
| 29 | +@Validated | ||
| 30 | +public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeService { | ||
| 31 | + | ||
| 32 | + @Resource | ||
| 33 | + private CrmBusinessStatusTypeMapper businessStatusTypeMapper; | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public Long createBusinessStatusType(CrmBusinessStatusTypeCreateReqVO createReqVO) { | ||
| 37 | + // 插入 | ||
| 38 | + CrmBusinessStatusTypeDO businessStatusType = CrmBusinessStatusTypeConvert.INSTANCE.convert(createReqVO); | ||
| 39 | + businessStatusTypeMapper.insert(businessStatusType); | ||
| 40 | + // 返回 | ||
| 41 | + return businessStatusType.getId(); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @Override | ||
| 45 | + public void updateBusinessStatusType(CrmBusinessStatusTypeUpdateReqVO updateReqVO) { | ||
| 46 | + // 校验存在 | ||
| 47 | + validateBusinessStatusTypeExists(updateReqVO.getId()); | ||
| 48 | + // 更新 | ||
| 49 | + CrmBusinessStatusTypeDO updateObj = CrmBusinessStatusTypeConvert.INSTANCE.convert(updateReqVO); | ||
| 50 | + businessStatusTypeMapper.updateById(updateObj); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + public void deleteBusinessStatusType(Long id) { | ||
| 55 | + // 校验存在 | ||
| 56 | + validateBusinessStatusTypeExists(id); | ||
| 57 | + // 删除 | ||
| 58 | + businessStatusTypeMapper.deleteById(id); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + private void validateBusinessStatusTypeExists(Long id) { | ||
| 62 | + if (businessStatusTypeMapper.selectById(id) == null) { | ||
| 63 | + throw exception(BUSINESS_STATUS_TYPE_NOT_EXISTS); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public CrmBusinessStatusTypeDO getBusinessStatusType(Long id) { | ||
| 69 | + return businessStatusTypeMapper.selectById(id); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @Override | ||
| 73 | + public List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(Collection<Long> ids) { | ||
| 74 | + if (CollUtil.isEmpty(ids)) { | ||
| 75 | + return ListUtil.empty(); | ||
| 76 | + } | ||
| 77 | + return businessStatusTypeMapper.selectBatchIds(ids); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @Override | ||
| 81 | + public PageResult<CrmBusinessStatusTypeDO> getBusinessStatusTypePage(CrmBusinessStatusTypePageReqVO pageReqVO) { | ||
| 82 | + return businessStatusTypeMapper.selectPage(pageReqVO); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @Override | ||
| 86 | + public List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(CrmBusinessStatusTypeExportReqVO exportReqVO) { | ||
| 87 | + return businessStatusTypeMapper.selectList(exportReqVO); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + public List<CrmBusinessStatusTypeDO> getBusinessStatusTypeListByStatus(Integer status) { | ||
| 92 | + return businessStatusTypeMapper.getBusinessStatusTypeListByStatus(status); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/businessstatustype/CrmBusinessStatusTypeMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | +<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype.CrmBusinessStatusTypeMapper"> | ||
| 4 | + | ||
| 5 | + <!-- | ||
| 6 | + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | ||
| 7 | + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | ||
| 8 | + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | ||
| 9 | + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | ||
| 10 | + --> | ||
| 11 | + | ||
| 12 | +</mapper> |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusServiceImplTest.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.businessstatus; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | ||
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusCreateReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusUpdateReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | ||
| 10 | +import cn.iocoder.yudao.module.crm.dal.mysql.businessstatus.CrmBusinessStatusMapper; | ||
| 11 | +import org.junit.jupiter.api.Disabled; | ||
| 12 | +import org.junit.jupiter.api.Test; | ||
| 13 | +import org.springframework.context.annotation.Import; | ||
| 14 | + | ||
| 15 | +import javax.annotation.Resource; | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 18 | +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | ||
| 19 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | ||
| 20 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | ||
| 21 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; | ||
| 22 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | ||
| 23 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_NOT_EXISTS; | ||
| 24 | +import static org.junit.jupiter.api.Assertions.*; | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * {@link CrmBusinessStatusServiceImpl} 的单元测试类 | ||
| 28 | + * | ||
| 29 | + * @author ljlleo | ||
| 30 | + */ | ||
| 31 | +@Import(CrmBusinessStatusServiceImpl.class) | ||
| 32 | +public class CrmBusinessStatusServiceImplTest extends BaseDbUnitTest { | ||
| 33 | + | ||
| 34 | + @Resource | ||
| 35 | + private CrmBusinessStatusServiceImpl businessStatusService; | ||
| 36 | + | ||
| 37 | + @Resource | ||
| 38 | + private CrmBusinessStatusMapper businessStatusMapper; | ||
| 39 | + | ||
| 40 | + @Test | ||
| 41 | + public void testCreateBusinessStatus_success() { | ||
| 42 | + // 准备参数 | ||
| 43 | + CrmBusinessStatusCreateReqVO reqVO = randomPojo(CrmBusinessStatusCreateReqVO.class); | ||
| 44 | + | ||
| 45 | + // 调用 | ||
| 46 | + Long businessStatusId = businessStatusService.createBusinessStatus(reqVO); | ||
| 47 | + // 断言 | ||
| 48 | + assertNotNull(businessStatusId); | ||
| 49 | + // 校验记录的属性是否正确 | ||
| 50 | + CrmBusinessStatusDO businessStatus = businessStatusMapper.selectById(businessStatusId); | ||
| 51 | + assertPojoEquals(reqVO, businessStatus); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @Test | ||
| 55 | + public void testUpdateBusinessStatus_success() { | ||
| 56 | + // mock 数据 | ||
| 57 | + CrmBusinessStatusDO dbBusinessStatus = randomPojo(CrmBusinessStatusDO.class); | ||
| 58 | + businessStatusMapper.insert(dbBusinessStatus);// @Sql: 先插入出一条存在的数据 | ||
| 59 | + // 准备参数 | ||
| 60 | + CrmBusinessStatusUpdateReqVO reqVO = randomPojo(CrmBusinessStatusUpdateReqVO.class, o -> { | ||
| 61 | + o.setId(dbBusinessStatus.getId()); // 设置更新的 ID | ||
| 62 | + }); | ||
| 63 | + | ||
| 64 | + // 调用 | ||
| 65 | + businessStatusService.updateBusinessStatus(reqVO); | ||
| 66 | + // 校验是否更新正确 | ||
| 67 | + CrmBusinessStatusDO businessStatus = businessStatusMapper.selectById(reqVO.getId()); // 获取最新的 | ||
| 68 | + assertPojoEquals(reqVO, businessStatus); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + @Test | ||
| 72 | + public void testUpdateBusinessStatus_notExists() { | ||
| 73 | + // 准备参数 | ||
| 74 | + CrmBusinessStatusUpdateReqVO reqVO = randomPojo(CrmBusinessStatusUpdateReqVO.class); | ||
| 75 | + | ||
| 76 | + // 调用, 并断言异常 | ||
| 77 | + assertServiceException(() -> businessStatusService.updateBusinessStatus(reqVO), BUSINESS_STATUS_NOT_EXISTS); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @Test | ||
| 81 | + public void testDeleteBusinessStatus_success() { | ||
| 82 | + // mock 数据 | ||
| 83 | + CrmBusinessStatusDO dbBusinessStatus = randomPojo(CrmBusinessStatusDO.class); | ||
| 84 | + businessStatusMapper.insert(dbBusinessStatus);// @Sql: 先插入出一条存在的数据 | ||
| 85 | + // 准备参数 | ||
| 86 | + Long id = dbBusinessStatus.getId(); | ||
| 87 | + | ||
| 88 | + // 调用 | ||
| 89 | + businessStatusService.deleteBusinessStatus(id); | ||
| 90 | + // 校验数据不存在了 | ||
| 91 | + assertNull(businessStatusMapper.selectById(id)); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @Test | ||
| 95 | + public void testDeleteBusinessStatus_notExists() { | ||
| 96 | + // 准备参数 | ||
| 97 | + Long id = randomLongId(); | ||
| 98 | + | ||
| 99 | + // 调用, 并断言异常 | ||
| 100 | + assertServiceException(() -> businessStatusService.deleteBusinessStatus(id), BUSINESS_STATUS_NOT_EXISTS); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + @Test | ||
| 104 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | ||
| 105 | + public void testGetBusinessStatusPage() { | ||
| 106 | + // mock 数据 | ||
| 107 | + CrmBusinessStatusDO dbBusinessStatus = randomPojo(CrmBusinessStatusDO.class, o -> { // 等会查询到 | ||
| 108 | + o.setTypeId(null); | ||
| 109 | + o.setName(null); | ||
| 110 | + o.setPercent(null); | ||
| 111 | + o.setSort(null); | ||
| 112 | + }); | ||
| 113 | + businessStatusMapper.insert(dbBusinessStatus); | ||
| 114 | + // 测试 typeId 不匹配 | ||
| 115 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setTypeId(null))); | ||
| 116 | + // 测试 name 不匹配 | ||
| 117 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setName(null))); | ||
| 118 | + // 测试 percent 不匹配 | ||
| 119 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setPercent(null))); | ||
| 120 | + // 测试 sort 不匹配 | ||
| 121 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setSort(null))); | ||
| 122 | + // 准备参数 | ||
| 123 | + CrmBusinessStatusPageReqVO reqVO = new CrmBusinessStatusPageReqVO(); | ||
| 124 | + reqVO.setTypeId(null); | ||
| 125 | + reqVO.setName(null); | ||
| 126 | + reqVO.setPercent(null); | ||
| 127 | + reqVO.setSort(null); | ||
| 128 | + | ||
| 129 | + // 调用 | ||
| 130 | + PageResult<CrmBusinessStatusDO> pageResult = businessStatusService.getBusinessStatusPage(reqVO); | ||
| 131 | + // 断言 | ||
| 132 | + assertEquals(1, pageResult.getTotal()); | ||
| 133 | + assertEquals(1, pageResult.getList().size()); | ||
| 134 | + assertPojoEquals(dbBusinessStatus, pageResult.getList().get(0)); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + @Test | ||
| 138 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | ||
| 139 | + public void testGetBusinessStatusList() { | ||
| 140 | + // mock 数据 | ||
| 141 | + CrmBusinessStatusDO dbBusinessStatus = randomPojo(CrmBusinessStatusDO.class, o -> { // 等会查询到 | ||
| 142 | + o.setTypeId(null); | ||
| 143 | + o.setName(null); | ||
| 144 | + o.setPercent(null); | ||
| 145 | + o.setSort(null); | ||
| 146 | + }); | ||
| 147 | + businessStatusMapper.insert(dbBusinessStatus); | ||
| 148 | + // 测试 typeId 不匹配 | ||
| 149 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setTypeId(null))); | ||
| 150 | + // 测试 name 不匹配 | ||
| 151 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setName(null))); | ||
| 152 | + // 测试 percent 不匹配 | ||
| 153 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setPercent(null))); | ||
| 154 | + // 测试 sort 不匹配 | ||
| 155 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setSort(null))); | ||
| 156 | + // 准备参数 | ||
| 157 | + CrmBusinessStatusExportReqVO reqVO = new CrmBusinessStatusExportReqVO(); | ||
| 158 | + reqVO.setTypeId(null); | ||
| 159 | + reqVO.setName(null); | ||
| 160 | + reqVO.setPercent(null); | ||
| 161 | + reqVO.setSort(null); | ||
| 162 | + | ||
| 163 | + // 调用 | ||
| 164 | + List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(reqVO); | ||
| 165 | + // 断言 | ||
| 166 | + assertEquals(1, list.size()); | ||
| 167 | + assertPojoEquals(dbBusinessStatus, list.get(0)); | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | +} |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeServiceImplTest.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.businessstatustype; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | ||
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeCreateReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeUpdateReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | ||
| 10 | +import cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype.CrmBusinessStatusTypeMapper; | ||
| 11 | +import org.junit.jupiter.api.Disabled; | ||
| 12 | +import org.junit.jupiter.api.Test; | ||
| 13 | +import org.springframework.context.annotation.Import; | ||
| 14 | + | ||
| 15 | +import javax.annotation.Resource; | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 18 | +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; | ||
| 19 | +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | ||
| 20 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | ||
| 21 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | ||
| 22 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; | ||
| 23 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | ||
| 24 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_TYPE_NOT_EXISTS; | ||
| 25 | +import static org.junit.jupiter.api.Assertions.*; | ||
| 26 | + | ||
| 27 | +/** | ||
| 28 | + * {@link CrmBusinessStatusTypeServiceImpl} 的单元测试类 | ||
| 29 | + * | ||
| 30 | + * @author ljlleo | ||
| 31 | + */ | ||
| 32 | +@Import(CrmBusinessStatusTypeServiceImpl.class) | ||
| 33 | +public class CrmBusinessStatusTypeServiceImplTest extends BaseDbUnitTest { | ||
| 34 | + | ||
| 35 | + @Resource | ||
| 36 | + private CrmBusinessStatusTypeServiceImpl businessStatusTypeService; | ||
| 37 | + | ||
| 38 | + @Resource | ||
| 39 | + private CrmBusinessStatusTypeMapper businessStatusTypeMapper; | ||
| 40 | + | ||
| 41 | + @Test | ||
| 42 | + public void testCreateBusinessStatusType_success() { | ||
| 43 | + // 准备参数 | ||
| 44 | + CrmBusinessStatusTypeCreateReqVO reqVO = randomPojo(CrmBusinessStatusTypeCreateReqVO.class); | ||
| 45 | + | ||
| 46 | + // 调用 | ||
| 47 | + Long businessStatusTypeId = businessStatusTypeService.createBusinessStatusType(reqVO); | ||
| 48 | + // 断言 | ||
| 49 | + assertNotNull(businessStatusTypeId); | ||
| 50 | + // 校验记录的属性是否正确 | ||
| 51 | + CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(businessStatusTypeId); | ||
| 52 | + assertPojoEquals(reqVO, businessStatusType); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @Test | ||
| 56 | + public void testUpdateBusinessStatusType_success() { | ||
| 57 | + // mock 数据 | ||
| 58 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class); | ||
| 59 | + businessStatusTypeMapper.insert(dbBusinessStatusType);// @Sql: 先插入出一条存在的数据 | ||
| 60 | + // 准备参数 | ||
| 61 | + CrmBusinessStatusTypeUpdateReqVO reqVO = randomPojo(CrmBusinessStatusTypeUpdateReqVO.class, o -> { | ||
| 62 | + o.setId(dbBusinessStatusType.getId()); // 设置更新的 ID | ||
| 63 | + }); | ||
| 64 | + | ||
| 65 | + // 调用 | ||
| 66 | + businessStatusTypeService.updateBusinessStatusType(reqVO); | ||
| 67 | + // 校验是否更新正确 | ||
| 68 | + CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(reqVO.getId()); // 获取最新的 | ||
| 69 | + assertPojoEquals(reqVO, businessStatusType); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @Test | ||
| 73 | + public void testUpdateBusinessStatusType_notExists() { | ||
| 74 | + // 准备参数 | ||
| 75 | + CrmBusinessStatusTypeUpdateReqVO reqVO = randomPojo(CrmBusinessStatusTypeUpdateReqVO.class); | ||
| 76 | + | ||
| 77 | + // 调用, 并断言异常 | ||
| 78 | + assertServiceException(() -> businessStatusTypeService.updateBusinessStatusType(reqVO), BUSINESS_STATUS_TYPE_NOT_EXISTS); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @Test | ||
| 82 | + public void testDeleteBusinessStatusType_success() { | ||
| 83 | + // mock 数据 | ||
| 84 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class); | ||
| 85 | + businessStatusTypeMapper.insert(dbBusinessStatusType);// @Sql: 先插入出一条存在的数据 | ||
| 86 | + // 准备参数 | ||
| 87 | + Long id = dbBusinessStatusType.getId(); | ||
| 88 | + | ||
| 89 | + // 调用 | ||
| 90 | + businessStatusTypeService.deleteBusinessStatusType(id); | ||
| 91 | + // 校验数据不存在了 | ||
| 92 | + assertNull(businessStatusTypeMapper.selectById(id)); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + @Test | ||
| 96 | + public void testDeleteBusinessStatusType_notExists() { | ||
| 97 | + // 准备参数 | ||
| 98 | + Long id = randomLongId(); | ||
| 99 | + | ||
| 100 | + // 调用, 并断言异常 | ||
| 101 | + assertServiceException(() -> businessStatusTypeService.deleteBusinessStatusType(id), BUSINESS_STATUS_TYPE_NOT_EXISTS); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + @Test | ||
| 105 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | ||
| 106 | + public void testGetBusinessStatusTypePage() { | ||
| 107 | + // mock 数据 | ||
| 108 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class, o -> { // 等会查询到 | ||
| 109 | + o.setName(null); | ||
| 110 | + o.setDeptIds(null); | ||
| 111 | + o.setStatus(null); | ||
| 112 | + o.setCreateTime(null); | ||
| 113 | + }); | ||
| 114 | + businessStatusTypeMapper.insert(dbBusinessStatusType); | ||
| 115 | + // 测试 name 不匹配 | ||
| 116 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setName(null))); | ||
| 117 | + // 测试 deptIds 不匹配 | ||
| 118 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setDeptIds(null))); | ||
| 119 | + // 测试 status 不匹配 | ||
| 120 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setStatus(null))); | ||
| 121 | + // 测试 createTime 不匹配 | ||
| 122 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setCreateTime(null))); | ||
| 123 | + // 准备参数 | ||
| 124 | + CrmBusinessStatusTypePageReqVO reqVO = new CrmBusinessStatusTypePageReqVO(); | ||
| 125 | + reqVO.setName(null); | ||
| 126 | + reqVO.setDeptIds(null); | ||
| 127 | + reqVO.setStatus(null); | ||
| 128 | + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | ||
| 129 | + | ||
| 130 | + // 调用 | ||
| 131 | + PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(reqVO); | ||
| 132 | + // 断言 | ||
| 133 | + assertEquals(1, pageResult.getTotal()); | ||
| 134 | + assertEquals(1, pageResult.getList().size()); | ||
| 135 | + assertPojoEquals(dbBusinessStatusType, pageResult.getList().get(0)); | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + @Test | ||
| 139 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | ||
| 140 | + public void testGetBusinessStatusTypeList() { | ||
| 141 | + // mock 数据 | ||
| 142 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class, o -> { // 等会查询到 | ||
| 143 | + o.setName(null); | ||
| 144 | + o.setDeptIds(null); | ||
| 145 | + o.setStatus(null); | ||
| 146 | + o.setCreateTime(null); | ||
| 147 | + }); | ||
| 148 | + businessStatusTypeMapper.insert(dbBusinessStatusType); | ||
| 149 | + // 测试 name 不匹配 | ||
| 150 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setName(null))); | ||
| 151 | + // 测试 deptIds 不匹配 | ||
| 152 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setDeptIds(null))); | ||
| 153 | + // 测试 status 不匹配 | ||
| 154 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setStatus(null))); | ||
| 155 | + // 测试 createTime 不匹配 | ||
| 156 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setCreateTime(null))); | ||
| 157 | + // 准备参数 | ||
| 158 | + CrmBusinessStatusTypeExportReqVO reqVO = new CrmBusinessStatusTypeExportReqVO(); | ||
| 159 | + reqVO.setName(null); | ||
| 160 | + reqVO.setDeptIds(null); | ||
| 161 | + reqVO.setStatus(null); | ||
| 162 | + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | ||
| 163 | + | ||
| 164 | + // 调用 | ||
| 165 | + List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeList(reqVO); | ||
| 166 | + // 断言 | ||
| 167 | + assertEquals(1, list.size()); | ||
| 168 | + assertPojoEquals(dbBusinessStatusType, list.get(0)); | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | +} |
yudao-ui-admin/src/api/crm/business.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 创建商机 | ||
| 4 | +export function createBusiness(data) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/crm/business/create', | ||
| 7 | + method: 'post', | ||
| 8 | + data: data | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +// 更新商机 | ||
| 13 | +export function updateBusiness(data) { | ||
| 14 | + return request({ | ||
| 15 | + url: '/crm/business/update', | ||
| 16 | + method: 'put', | ||
| 17 | + data: data | ||
| 18 | + }) | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +// 删除商机 | ||
| 22 | +export function deleteBusiness(id) { | ||
| 23 | + return request({ | ||
| 24 | + url: '/crm/business/delete?id=' + id, | ||
| 25 | + method: 'delete' | ||
| 26 | + }) | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +// 获得商机 | ||
| 30 | +export function getBusiness(id) { | ||
| 31 | + return request({ | ||
| 32 | + url: '/crm/business/get?id=' + id, | ||
| 33 | + method: 'get' | ||
| 34 | + }) | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +// 获得商机分页 | ||
| 38 | +export function getBusinessPage(query) { | ||
| 39 | + return request({ | ||
| 40 | + url: '/crm/business/page', | ||
| 41 | + method: 'get', | ||
| 42 | + params: query | ||
| 43 | + }) | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +// 导出商机 Excel | ||
| 47 | +export function exportBusinessExcel(query) { | ||
| 48 | + return request({ | ||
| 49 | + url: '/crm/business/export-excel', | ||
| 50 | + method: 'get', | ||
| 51 | + params: query, | ||
| 52 | + responseType: 'blob' | ||
| 53 | + }) | ||
| 54 | +} |
yudao-ui-admin/src/api/crm/businessStatus.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 创建商机状态 | ||
| 4 | +export function createBusinessStatus(data) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/crm/business-status/create', | ||
| 7 | + method: 'post', | ||
| 8 | + data: data | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +// 更新商机状态 | ||
| 13 | +export function updateBusinessStatus(data) { | ||
| 14 | + return request({ | ||
| 15 | + url: '/crm/business-status/update', | ||
| 16 | + method: 'put', | ||
| 17 | + data: data | ||
| 18 | + }) | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +// 删除商机状态 | ||
| 22 | +export function deleteBusinessStatus(id) { | ||
| 23 | + return request({ | ||
| 24 | + url: '/crm/business-status/delete?id=' + id, | ||
| 25 | + method: 'delete' | ||
| 26 | + }) | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +// 获得商机状态 | ||
| 30 | +export function getBusinessStatus(id) { | ||
| 31 | + return request({ | ||
| 32 | + url: '/crm/business-status/get?id=' + id, | ||
| 33 | + method: 'get' | ||
| 34 | + }) | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +// 获得商机状态分页 | ||
| 38 | +export function getBusinessStatusPage(query) { | ||
| 39 | + return request({ | ||
| 40 | + url: '/crm/business-status/page', | ||
| 41 | + method: 'get', | ||
| 42 | + params: query | ||
| 43 | + }) | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +// 导出商机状态 Excel | ||
| 47 | +export function exportBusinessStatusExcel(query) { | ||
| 48 | + return request({ | ||
| 49 | + url: '/crm/business-status/export-excel', | ||
| 50 | + method: 'get', | ||
| 51 | + params: query, | ||
| 52 | + responseType: 'blob' | ||
| 53 | + }) | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +// 根据类型ID获取商机状态信息列表 | ||
| 57 | +export function getBusinessStatusListByTypeId(typeId) { | ||
| 58 | + return request({ | ||
| 59 | + url: '/crm/business-status/get-simple-list?typeId=' + typeId, | ||
| 60 | + method: 'get' | ||
| 61 | + }) | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +// 获取商机状态信息列表 | ||
| 65 | +export function getBusinessStatusList() { | ||
| 66 | + return request({ | ||
| 67 | + url: '/crm/business-status/get-all-list', | ||
| 68 | + method: 'get' | ||
| 69 | + }) | ||
| 70 | +} |
yudao-ui-admin/src/api/crm/businessStatusType.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 创建商机状态类型 | ||
| 4 | +export function createBusinessStatusType(data) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/crm/business-status-type/create', | ||
| 7 | + method: 'post', | ||
| 8 | + data: data | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +// 更新商机状态类型 | ||
| 13 | +export function updateBusinessStatusType(data) { | ||
| 14 | + return request({ | ||
| 15 | + url: '/crm/business-status-type/update', | ||
| 16 | + method: 'put', | ||
| 17 | + data: data | ||
| 18 | + }) | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +// 删除商机状态类型 | ||
| 22 | +export function deleteBusinessStatusType(id) { | ||
| 23 | + return request({ | ||
| 24 | + url: '/crm/business-status-type/delete?id=' + id, | ||
| 25 | + method: 'delete' | ||
| 26 | + }) | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +// 获得商机状态类型 | ||
| 30 | +export function getBusinessStatusType(id) { | ||
| 31 | + return request({ | ||
| 32 | + url: '/crm/business-status-type/get?id=' + id, | ||
| 33 | + method: 'get' | ||
| 34 | + }) | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +// 获得商机状态类型分页 | ||
| 38 | +export function getBusinessStatusTypePage(query) { | ||
| 39 | + return request({ | ||
| 40 | + url: '/crm/business-status-type/page', | ||
| 41 | + method: 'get', | ||
| 42 | + params: query | ||
| 43 | + }) | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +// 导出商机状态类型 Excel | ||
| 47 | +export function exportBusinessStatusTypeExcel(query) { | ||
| 48 | + return request({ | ||
| 49 | + url: '/crm/business-status-type/export-excel', | ||
| 50 | + method: 'get', | ||
| 51 | + params: query, | ||
| 52 | + responseType: 'blob' | ||
| 53 | + }) | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +// 获取商机状态类型信息列表 | ||
| 57 | +export function getBusinessStatusTypeList() { | ||
| 58 | + return request({ | ||
| 59 | + url: '/crm/business-status-type/get-simple-list', | ||
| 60 | + method: 'get' | ||
| 61 | + }) | ||
| 62 | +} |
yudao-ui-admin/src/views/crm/business/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="app-container"> | ||
| 3 | + | ||
| 4 | + <!-- 搜索工作栏 --> | ||
| 5 | + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> | ||
| 6 | + <el-form-item label="商机名称" prop="name"> | ||
| 7 | + <el-input v-model="queryParams.name" placeholder="请输入商机名称" clearable @keyup.enter.native="handleQuery"/> | ||
| 8 | + </el-form-item> | ||
| 9 | + <el-form-item> | ||
| 10 | + <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | ||
| 11 | + <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | ||
| 12 | + </el-form-item> | ||
| 13 | + </el-form> | ||
| 14 | + | ||
| 15 | + <!-- 操作工具栏 --> | ||
| 16 | + <el-row :gutter="10" class="mb8"> | ||
| 17 | + <el-col :span="1.5"> | ||
| 18 | + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" | ||
| 19 | + v-hasPermi="['crm:business:create']">新增</el-button> | ||
| 20 | + </el-col> | ||
| 21 | + <el-col :span="1.5"> | ||
| 22 | + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" | ||
| 23 | + v-hasPermi="['crm:business:export']">导出</el-button> | ||
| 24 | + </el-col> | ||
| 25 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||
| 26 | + </el-row> | ||
| 27 | + | ||
| 28 | + <!-- 列表 --> | ||
| 29 | + <el-table v-loading="loading" :data="list"> | ||
| 30 | + <el-table-column label="商机名称" align="center" prop="name" /> | ||
| 31 | + <el-table-column label="客户名称" align="center" prop="customerId" /> | ||
| 32 | + <el-table-column label="商机金额" align="center" prop="price" /> | ||
| 33 | + <el-table-column label="预计成交日期" align="center" prop="dealTime" width="180"> | ||
| 34 | + <template v-slot="scope"> | ||
| 35 | + <span>{{ parseTime(scope.row.dealTime) }}</span> | ||
| 36 | + </template> | ||
| 37 | + </el-table-column> | ||
| 38 | + <el-table-column label="备注" align="center" prop="remark" /> | ||
| 39 | + <el-table-column label="商机状态类型" align="center" prop="statusTypeId" width="120"> | ||
| 40 | + <template v-slot="scope"> | ||
| 41 | + <el-tag> {{getBusinessStatusTypeName(scope.row.statusTypeId)}} </el-tag> | ||
| 42 | + </template> | ||
| 43 | + </el-table-column> | ||
| 44 | + <el-table-column label="商机状态" align="center" prop="statusId" width="100"> | ||
| 45 | + <template v-slot="scope"> | ||
| 46 | + <el-tag> {{getBusinessStatusName(scope.row.statusId)}} </el-tag> | ||
| 47 | + </template> | ||
| 48 | + </el-table-column> | ||
| 49 | + <el-table-column label="更新时间" align="center" prop="updateTime" width="180"> | ||
| 50 | + <template v-slot="scope"> | ||
| 51 | + <span>{{ parseTime(scope.row.updateTime) }}</span> | ||
| 52 | + </template> | ||
| 53 | + </el-table-column> | ||
| 54 | + <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | ||
| 55 | + <template v-slot="scope"> | ||
| 56 | + <span>{{ parseTime(scope.row.createTime) }}</span> | ||
| 57 | + </template> | ||
| 58 | + </el-table-column> | ||
| 59 | + <el-table-column label="负责人" align="center" prop="ownerUserId" /> | ||
| 60 | + <el-table-column label="创建人" align="center" prop="creator" /> | ||
| 61 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||
| 62 | + <template v-slot="scope"> | ||
| 63 | + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | ||
| 64 | + v-hasPermi="['crm:business:update']">修改</el-button> | ||
| 65 | + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" | ||
| 66 | + v-hasPermi="['crm:business:delete']">删除</el-button> | ||
| 67 | + </template> | ||
| 68 | + </el-table-column> | ||
| 69 | + </el-table> | ||
| 70 | + <!-- 分页组件 --> | ||
| 71 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | ||
| 72 | + @pagination="getList"/> | ||
| 73 | + | ||
| 74 | + <!-- 对话框(添加 / 修改) --> | ||
| 75 | + <el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body> | ||
| 76 | + <el-form ref="form" :model="form" :rules="rules" label-width="100px"> | ||
| 77 | + <el-form-item label="商机名称" prop="name"> | ||
| 78 | + <el-input v-model="form.name" placeholder="请输入商机名称" /> | ||
| 79 | + </el-form-item> | ||
| 80 | + <el-form-item label="客户编号" prop="customerId"> | ||
| 81 | + <el-input v-model="form.customerId" placeholder="请输入客户编号" /> | ||
| 82 | + </el-form-item> | ||
| 83 | + <el-form-item label="商机状态类型" prop="statusTypeId"> | ||
| 84 | + <el-select v-model="form.statusTypeId" placeholder="请选择商机状态类型" clearable size="small" @change="changeBusinessStatusType"> | ||
| 85 | + <el-option v-for="item in businessStatusTypeList" :key="item.id" :label="item.name" :value="item.id"/> | ||
| 86 | + </el-select> | ||
| 87 | + </el-form-item> | ||
| 88 | + <el-form-item label="商机状态" prop="statusId"> | ||
| 89 | + <el-select v-model="form.statusId" placeholder="请选择商机状态" clearable size="small"> | ||
| 90 | + <el-option v-for="item in businessStatusList" :key="item.id" :label="item.name" :value="item.id"/> | ||
| 91 | + </el-select> | ||
| 92 | + </el-form-item> | ||
| 93 | + <el-form-item label="预计成交日期" prop="dealTime"> | ||
| 94 | + <el-date-picker clearable v-model="form.dealTime" type="date" value-format="timestamp" placeholder="选择预计成交日期" /> | ||
| 95 | + </el-form-item> | ||
| 96 | + <el-form-item label="商机金额" prop="price"> | ||
| 97 | + <el-input v-model="form.price" placeholder="请输入商机金额" /> | ||
| 98 | + </el-form-item> | ||
| 99 | + <el-form-item label="整单折扣(%)" prop="discountPercent"> | ||
| 100 | + <el-input v-model="form.discountPercent" placeholder="请输入整单折扣" /> | ||
| 101 | + </el-form-item> | ||
| 102 | + <el-form-item label="产品总金额" prop="productPrice"> | ||
| 103 | + <el-input v-model="form.productPrice" placeholder="请输入产品总金额" /> | ||
| 104 | + </el-form-item> | ||
| 105 | + <el-form-item label="备注" prop="remark"> | ||
| 106 | + <el-input v-model="form.remark" placeholder="请输入备注" /> | ||
| 107 | + </el-form-item> | ||
| 108 | + </el-form> | ||
| 109 | + <div slot="footer" class="dialog-footer"> | ||
| 110 | + <el-button type="primary" @click="submitForm">确 定</el-button> | ||
| 111 | + <el-button @click="cancel">取 消</el-button> | ||
| 112 | + </div> | ||
| 113 | + </el-dialog> | ||
| 114 | + </div> | ||
| 115 | +</template> | ||
| 116 | + | ||
| 117 | +<script> | ||
| 118 | +import { createBusiness, updateBusiness, deleteBusiness, getBusiness, getBusinessPage, exportBusinessExcel } from "@/api/crm/business"; | ||
| 119 | +import { getBusinessStatusListByTypeId, getBusinessStatusList } from "@/api/crm/businessStatus"; | ||
| 120 | +import { getBusinessStatusTypeList } from "@/api/crm/businessStatusType"; | ||
| 121 | + | ||
| 122 | +export default { | ||
| 123 | + name: "Business", | ||
| 124 | + components: { | ||
| 125 | + }, | ||
| 126 | + data() { | ||
| 127 | + return { | ||
| 128 | + // 遮罩层 | ||
| 129 | + loading: true, | ||
| 130 | + // 导出遮罩层 | ||
| 131 | + exportLoading: false, | ||
| 132 | + // 显示搜索条件 | ||
| 133 | + showSearch: true, | ||
| 134 | + // 总条数 | ||
| 135 | + total: 0, | ||
| 136 | + // 商机列表 | ||
| 137 | + list: [], | ||
| 138 | + // 根据类型ID获取的商机状态列表 | ||
| 139 | + businessStatusList: [], | ||
| 140 | + // 所有商机状态列表 | ||
| 141 | + businessStatusAllList: [], | ||
| 142 | + // 商机状态类型列表 | ||
| 143 | + businessStatusTypeList: [], | ||
| 144 | + // 弹出层标题 | ||
| 145 | + title: "", | ||
| 146 | + // 是否显示弹出层 | ||
| 147 | + open: false, | ||
| 148 | + // 查询参数 | ||
| 149 | + queryParams: { | ||
| 150 | + pageNo: 1, | ||
| 151 | + pageSize: 10, | ||
| 152 | + name: null, | ||
| 153 | + statusTypeId: null, | ||
| 154 | + statusId: null, | ||
| 155 | + contactNextTime: [], | ||
| 156 | + customerId: null, | ||
| 157 | + dealTime: [], | ||
| 158 | + price: null, | ||
| 159 | + discountPercent: null, | ||
| 160 | + productPrice: null, | ||
| 161 | + remark: null, | ||
| 162 | + ownerUserId: null, | ||
| 163 | + createTime: [], | ||
| 164 | + roUserIds: null, | ||
| 165 | + rwUserIds: null, | ||
| 166 | + endStatus: null, | ||
| 167 | + endRemark: null, | ||
| 168 | + contactLastTime: [], | ||
| 169 | + followUpStatus: null, | ||
| 170 | + }, | ||
| 171 | + // 表单参数 | ||
| 172 | + form: {}, | ||
| 173 | + // 表单校验 | ||
| 174 | + rules: { | ||
| 175 | + name: [{ required: true, message: "商机名称不能为空", trigger: "blur" }], | ||
| 176 | + customerId: [{ required: true, message: "客户编号不能为空", trigger: "blur" }], | ||
| 177 | + roUserIds: [{ required: true, message: "只读权限的用户编号数组不能为空", trigger: "blur" }], | ||
| 178 | + rwUserIds: [{ required: true, message: "读写权限的用户编号数组不能为空", trigger: "blur" }], | ||
| 179 | + endStatus: [{ required: true, message: "1赢单2输单3无效不能为空", trigger: "blur" }], | ||
| 180 | + } | ||
| 181 | + }; | ||
| 182 | + }, | ||
| 183 | + created() { | ||
| 184 | + this.getList(); | ||
| 185 | + }, | ||
| 186 | + methods: { | ||
| 187 | + /** 查询列表 */ | ||
| 188 | + getList() { | ||
| 189 | + this.loading = true; | ||
| 190 | + // 执行查询 | ||
| 191 | + getBusinessPage(this.queryParams).then(response => { | ||
| 192 | + this.list = response.data.list; | ||
| 193 | + this.total = response.data.total; | ||
| 194 | + this.loading = false; | ||
| 195 | + }); | ||
| 196 | + //查询商机状态类型集合 | ||
| 197 | + getBusinessStatusTypeList().then(response => { | ||
| 198 | + this.businessStatusTypeList = response.data; | ||
| 199 | + }); | ||
| 200 | + //查询商机状态类型集合 | ||
| 201 | + getBusinessStatusList().then(response => { | ||
| 202 | + this.businessStatusAllList = response.data; | ||
| 203 | + }); | ||
| 204 | + | ||
| 205 | + }, | ||
| 206 | + /** 取消按钮 */ | ||
| 207 | + cancel() { | ||
| 208 | + this.open = false; | ||
| 209 | + this.reset(); | ||
| 210 | + }, | ||
| 211 | + /** 表单重置 */ | ||
| 212 | + reset() { | ||
| 213 | + this.form = { | ||
| 214 | + id: undefined, | ||
| 215 | + name: undefined, | ||
| 216 | + statusTypeId: undefined, | ||
| 217 | + statusId: undefined, | ||
| 218 | + contactNextTime: undefined, | ||
| 219 | + customerId: undefined, | ||
| 220 | + dealTime: undefined, | ||
| 221 | + price: undefined, | ||
| 222 | + discountPercent: undefined, | ||
| 223 | + productPrice: undefined, | ||
| 224 | + remark: undefined, | ||
| 225 | + ownerUserId: undefined, | ||
| 226 | + roUserIds: undefined, | ||
| 227 | + rwUserIds: undefined, | ||
| 228 | + endStatus: undefined, | ||
| 229 | + endRemark: undefined, | ||
| 230 | + contactLastTime: undefined, | ||
| 231 | + followUpStatus: undefined, | ||
| 232 | + }; | ||
| 233 | + this.resetForm("form"); | ||
| 234 | + }, | ||
| 235 | + /** 搜索按钮操作 */ | ||
| 236 | + handleQuery() { | ||
| 237 | + this.queryParams.pageNo = 1; | ||
| 238 | + this.getList(); | ||
| 239 | + }, | ||
| 240 | + /** 重置按钮操作 */ | ||
| 241 | + resetQuery() { | ||
| 242 | + this.resetForm("queryForm"); | ||
| 243 | + this.handleQuery(); | ||
| 244 | + }, | ||
| 245 | + /** 新增按钮操作 */ | ||
| 246 | + handleAdd() { | ||
| 247 | + this.reset(); | ||
| 248 | + this.open = true; | ||
| 249 | + this.title = "添加商机"; | ||
| 250 | + }, | ||
| 251 | + /** 修改按钮操作 */ | ||
| 252 | + handleUpdate(row) { | ||
| 253 | + this.reset(); | ||
| 254 | + const id = row.id; | ||
| 255 | + getBusiness(id).then(response => { | ||
| 256 | + this.form = response.data; | ||
| 257 | + this.open = true; | ||
| 258 | + this.title = "修改商机"; | ||
| 259 | + }); | ||
| 260 | + }, | ||
| 261 | + /** 提交按钮 */ | ||
| 262 | + submitForm() { | ||
| 263 | + this.$refs["form"].validate(valid => { | ||
| 264 | + if (!valid) { | ||
| 265 | + return; | ||
| 266 | + } | ||
| 267 | + // 修改的提交 | ||
| 268 | + if (this.form.id != null) { | ||
| 269 | + updateBusiness(this.form).then(response => { | ||
| 270 | + this.$modal.msgSuccess("修改成功"); | ||
| 271 | + this.open = false; | ||
| 272 | + this.getList(); | ||
| 273 | + }); | ||
| 274 | + return; | ||
| 275 | + } | ||
| 276 | + // 添加的提交 | ||
| 277 | + createBusiness(this.form).then(response => { | ||
| 278 | + this.$modal.msgSuccess("新增成功"); | ||
| 279 | + this.open = false; | ||
| 280 | + this.getList(); | ||
| 281 | + }); | ||
| 282 | + }); | ||
| 283 | + }, | ||
| 284 | + /** 删除按钮操作 */ | ||
| 285 | + handleDelete(row) { | ||
| 286 | + const id = row.id; | ||
| 287 | + this.$modal.confirm('是否确认删除商机编号为"' + id + '"的数据项?').then(function() { | ||
| 288 | + return deleteBusiness(id); | ||
| 289 | + }).then(() => { | ||
| 290 | + this.getList(); | ||
| 291 | + this.$modal.msgSuccess("删除成功"); | ||
| 292 | + }).catch(() => {}); | ||
| 293 | + }, | ||
| 294 | + /** 导出按钮操作 */ | ||
| 295 | + handleExport() { | ||
| 296 | + // 处理查询参数 | ||
| 297 | + let params = {...this.queryParams}; | ||
| 298 | + params.pageNo = undefined; | ||
| 299 | + params.pageSize = undefined; | ||
| 300 | + this.$modal.confirm('是否确认导出所有商机数据项?').then(() => { | ||
| 301 | + this.exportLoading = true; | ||
| 302 | + return exportBusinessExcel(params); | ||
| 303 | + }).then(response => { | ||
| 304 | + this.$download.excel(response, '商机.xls'); | ||
| 305 | + this.exportLoading = false; | ||
| 306 | + }).catch(() => {}); | ||
| 307 | + }, | ||
| 308 | + /** 选择商机状态类型事件 */ | ||
| 309 | + changeBusinessStatusType (id) { | ||
| 310 | + //查询商机状态集合 | ||
| 311 | + getBusinessStatusListByTypeId(id).then(response => { | ||
| 312 | + this.businessStatusList = response.data; | ||
| 313 | + }); | ||
| 314 | + }, | ||
| 315 | + /** 商机状态类型名格式化 */ | ||
| 316 | + getBusinessStatusTypeName(typeId) { | ||
| 317 | + for (const item of this.businessStatusTypeList) { | ||
| 318 | + if (item.id === typeId) { | ||
| 319 | + return item.name; | ||
| 320 | + } | ||
| 321 | + } | ||
| 322 | + return '未知'; | ||
| 323 | + }, | ||
| 324 | + /** 商机状态名格式化 */ | ||
| 325 | + getBusinessStatusName(id) { | ||
| 326 | + for (const item of this.businessStatusAllList) { | ||
| 327 | + if (item.id === id) { | ||
| 328 | + return item.name; | ||
| 329 | + } | ||
| 330 | + } | ||
| 331 | + return '未知'; | ||
| 332 | + } | ||
| 333 | + } | ||
| 334 | +}; | ||
| 335 | +</script> |