From fba3f7140d65851b1b0ac8f7088b12bdc9d803a8 Mon Sep 17 00:00:00 2001 From: siontion Date: Wed, 10 Jan 2024 09:12:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除client --- .../admin/client/ClientController.java | 95 -------- .../admin/client/vo/ClientPageReqVO.java | 33 --- .../admin/client/vo/ClientRespVO.java | 52 ---- .../admin/client/vo/ClientSaveReqVO.java | 38 --- .../heli/dal/dataobject/client/ClientDO.java | 59 ----- .../heli/dal/mysql/client/ClientMapper.java | 30 --- .../heli/service/client/ClientService.java | 55 ----- .../service/client/ClientServiceImpl.java | 74 ------ .../resources/mapper/client/ClientMapper.xml | 12 - .../service/client/ClientServiceImplTest.java | 146 ------------ .../src/api/heli/client/index.ts | 42 ---- .../src/views/heli/client/ClientForm.vue | 128 ---------- .../src/views/heli/client/index.vue | 222 ------------------ .../src/views/heli/customer/index.vue | 7 +- 14 files changed, 3 insertions(+), 990 deletions(-) delete mode 100644 mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/ClientController.java delete mode 100644 mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/vo/ClientPageReqVO.java delete mode 100644 mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/vo/ClientRespVO.java delete mode 100644 mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/vo/ClientSaveReqVO.java delete mode 100644 mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/client/ClientDO.java delete mode 100644 mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/client/ClientMapper.java delete mode 100644 mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/client/ClientService.java delete mode 100644 mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/client/ClientServiceImpl.java delete mode 100644 mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/client/ClientMapper.xml delete mode 100644 mes-module-heli/mes-module-heli-biz/src/test/java/com/chanko/yunxi/mes/module/heli/service/client/ClientServiceImplTest.java delete mode 100644 mes-ui/mes-ui-admin-vue3/src/api/heli/client/index.ts delete mode 100644 mes-ui/mes-ui-admin-vue3/src/views/heli/client/ClientForm.vue delete mode 100644 mes-ui/mes-ui-admin-vue3/src/views/heli/client/index.vue diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/ClientController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/ClientController.java deleted file mode 100644 index 4b5b4b35..00000000 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/ClientController.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.client; - -import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Operation; - -import javax.validation.constraints.*; -import javax.validation.*; -import javax.servlet.http.*; -import java.util.*; -import java.io.IOException; - -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; -import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; -import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; - -import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; - -import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; -import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; - -import com.chanko.yunxi.mes.module.heli.controller.admin.client.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.client.ClientDO; -import com.chanko.yunxi.mes.module.heli.service.client.ClientService; - -@Tag(name = "管理后台 - 客户") -@RestController -@RequestMapping("/heli/client") -@Validated -public class ClientController { - - @Resource - private ClientService clientService; - - @PostMapping("/create") - @Operation(summary = "创建客户") - @PreAuthorize("@ss.hasPermission('heli:client:create')") - public CommonResult createClient(@Valid @RequestBody ClientSaveReqVO createReqVO) { - return success(clientService.createClient(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新客户") - @PreAuthorize("@ss.hasPermission('heli:client:update')") - public CommonResult updateClient(@Valid @RequestBody ClientSaveReqVO updateReqVO) { - clientService.updateClient(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除客户") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('heli:client:delete')") - public CommonResult deleteClient(@RequestParam("id") Long id) { - clientService.deleteClient(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得客户") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('heli:client:query')") - public CommonResult getClient(@RequestParam("id") Long id) { - ClientDO client = clientService.getClient(id); - return success(BeanUtils.toBean(client, ClientRespVO.class)); - } - - @GetMapping("/page") - @Operation(summary = "获得客户分页") - @PreAuthorize("@ss.hasPermission('heli:client:query')") - public CommonResult> getClientPage(@Valid ClientPageReqVO pageReqVO) { - PageResult pageResult = clientService.getClientPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, ClientRespVO.class)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出客户 Excel") - @PreAuthorize("@ss.hasPermission('heli:client:export')") - @OperateLog(type = EXPORT) - public void exportClientExcel(@Valid ClientPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = clientService.getClientPage(pageReqVO).getList(); - // 导出 Excel - ExcelUtils.write(response, "客户.xls", "数据", ClientRespVO.class, - BeanUtils.toBean(list, ClientRespVO.class)); - } - -} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/vo/ClientPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/vo/ClientPageReqVO.java deleted file mode 100644 index 03ca8642..00000000 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/vo/ClientPageReqVO.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.client.vo; - -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; -import org.springframework.format.annotation.DateTimeFormat; -import java.time.LocalDateTime; - -import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; - -@Schema(description = "管理后台 - 客户分页 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class ClientPageReqVO extends PageParam { - - @Schema(description = "客户编号,唯一") - private String code; - - @Schema(description = "客户简称", example = "赵六") - private String simpleName; - - @Schema(description = "客户全称,唯一", example = "张三") - private String name; - - @Schema(description = "客户电话") - private String telephone; - - @Schema(description = "状态,1表示正常,2表示禁用,默认是1", example = "1") - private Integer status; - -} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/vo/ClientRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/vo/ClientRespVO.java deleted file mode 100644 index 9eefbc55..00000000 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/vo/ClientRespVO.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.client.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import java.util.*; -import org.springframework.format.annotation.DateTimeFormat; -import java.time.LocalDateTime; -import com.alibaba.excel.annotation.*; - -@Schema(description = "管理后台 - 客户 Response VO") -@Data -@ExcelIgnoreUnannotated -public class ClientRespVO { - - @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "13999") - @ExcelProperty("自增字段,唯一") - private Long id; - - @Schema(description = "客户编号,唯一") - @ExcelProperty("客户编号,唯一") - private String code; - - @Schema(description = "客户简称", example = "赵六") - @ExcelProperty("客户简称") - private String simpleName; - - @Schema(description = "客户全称,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") - @ExcelProperty("客户全称,唯一") - private String name; - - @Schema(description = "客户电话") - @ExcelProperty("客户电话") - private String telephone; - - @Schema(description = "客户地址") - @ExcelProperty("客户地址") - private String address; - - @Schema(description = "描述信息", example = "你猜") - @ExcelProperty("描述信息") - private String description; - - @Schema(description = "状态,1表示正常,2表示禁用,默认是1", example = "1") - @ExcelProperty("状态,1表示正常,2表示禁用,默认是1") - private Integer status; - - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) - @ExcelProperty("创建时间") - private LocalDateTime createTime; - -} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/vo/ClientSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/vo/ClientSaveReqVO.java deleted file mode 100644 index 48a4d5f4..00000000 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/client/vo/ClientSaveReqVO.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.client.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import javax.validation.constraints.*; -import java.util.*; - -@Schema(description = "管理后台 - 客户新增/修改 Request VO") -@Data -public class ClientSaveReqVO { - - @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "13999") - private Long id; - - @Schema(description = "客户编号,唯一") - private String code; - - @Schema(description = "客户简称", example = "赵六") - private String simpleName; - - @Schema(description = "客户全称,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") - @NotEmpty(message = "客户全称,唯一不能为空") - private String name; - - @Schema(description = "客户电话") - private String telephone; - - @Schema(description = "客户地址") - private String address; - - @Schema(description = "描述信息", example = "你猜") - private String description; - - @Schema(description = "状态,1表示正常,2表示禁用,默认是1", example = "1") - private Integer status; - -} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/client/ClientDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/client/ClientDO.java deleted file mode 100644 index f8e9797f..00000000 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/client/ClientDO.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.chanko.yunxi.mes.module.heli.dal.dataobject.client; - -import lombok.*; -import java.util.*; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.*; -import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; - -/** - * 客户 DO - * - * @author 开发者 - */ -@TableName("base_client") -@KeySequence("base_client_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class ClientDO extends BaseDO { - - /** - * 自增字段,唯一 - */ - @TableId - private Long id; - /** - * 客户编号,唯一 - */ - private String code; - /** - * 客户简称 - */ - private String simpleName; - /** - * 客户全称,唯一 - */ - private String name; - /** - * 客户电话 - */ - private String telephone; - /** - * 客户地址 - */ - private String address; - /** - * 描述信息 - */ - private String description; - /** - * 状态,1表示正常,2表示禁用,默认是1 - */ - private Integer status; - -} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/client/ClientMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/client/ClientMapper.java deleted file mode 100644 index 50359236..00000000 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/client/ClientMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.chanko.yunxi.mes.module.heli.dal.mysql.client; - -import java.util.*; - -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX; -import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.client.ClientDO; -import org.apache.ibatis.annotations.Mapper; -import com.chanko.yunxi.mes.module.heli.controller.admin.client.vo.*; - -/** - * 客户 Mapper - * - * @author 开发者 - */ -@Mapper -public interface ClientMapper extends BaseMapperX { - - default PageResult selectPage(ClientPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .likeIfPresent(ClientDO::getCode, reqVO.getCode()) - .likeIfPresent(ClientDO::getSimpleName, reqVO.getSimpleName()) - .likeIfPresent(ClientDO::getName, reqVO.getName()) - .likeIfPresent(ClientDO::getTelephone, reqVO.getTelephone()) - .eqIfPresent(ClientDO::getStatus, reqVO.getStatus()) - .orderByDesc(ClientDO::getId)); - } - -} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/client/ClientService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/client/ClientService.java deleted file mode 100644 index b2076685..00000000 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/client/ClientService.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.chanko.yunxi.mes.module.heli.service.client; - -import java.util.*; -import javax.validation.*; -import com.chanko.yunxi.mes.module.heli.controller.admin.client.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.client.ClientDO; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; - -/** - * 客户 Service 接口 - * - * @author 开发者 - */ -public interface ClientService { - - /** - * 创建客户 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Long createClient(@Valid ClientSaveReqVO createReqVO); - - /** - * 更新客户 - * - * @param updateReqVO 更新信息 - */ - void updateClient(@Valid ClientSaveReqVO updateReqVO); - - /** - * 删除客户 - * - * @param id 编号 - */ - void deleteClient(Long id); - - /** - * 获得客户 - * - * @param id 编号 - * @return 客户 - */ - ClientDO getClient(Long id); - - /** - * 获得客户分页 - * - * @param pageReqVO 分页查询 - * @return 客户分页 - */ - PageResult getClientPage(ClientPageReqVO pageReqVO); - -} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/client/ClientServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/client/ClientServiceImpl.java deleted file mode 100644 index 7ba9bce8..00000000 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/client/ClientServiceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.chanko.yunxi.mes.module.heli.service.client; - -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; -import com.chanko.yunxi.mes.module.heli.controller.admin.client.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.client.ClientDO; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; -import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; - -import com.chanko.yunxi.mes.module.heli.dal.mysql.client.ClientMapper; - -import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; -import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; - -/** - * 客户 Service 实现类 - * - * @author 开发者 - */ -@Service -@Validated -public class ClientServiceImpl implements ClientService { - - @Resource - private ClientMapper clientMapper; - - @Override - public Long createClient(ClientSaveReqVO createReqVO) { - // 插入 - ClientDO client = BeanUtils.toBean(createReqVO, ClientDO.class); - clientMapper.insert(client); - // 返回 - return client.getId(); - } - - @Override - public void updateClient(ClientSaveReqVO updateReqVO) { - // 校验存在 - validateClientExists(updateReqVO.getId()); - // 更新 - ClientDO updateObj = BeanUtils.toBean(updateReqVO, ClientDO.class); - clientMapper.updateById(updateObj); - } - - @Override - public void deleteClient(Long id) { - // 校验存在 - validateClientExists(id); - // 删除 - clientMapper.deleteById(id); - } - - private void validateClientExists(Long id) { - if (clientMapper.selectById(id) == null) { - throw exception(CLIENT_NOT_EXISTS); - } - } - - @Override - public ClientDO getClient(Long id) { - return clientMapper.selectById(id); - } - - @Override - public PageResult getClientPage(ClientPageReqVO pageReqVO) { - return clientMapper.selectPage(pageReqVO); - } - -} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/client/ClientMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/client/ClientMapper.xml deleted file mode 100644 index c78d900b..00000000 --- a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/client/ClientMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/test/java/com/chanko/yunxi/mes/module/heli/service/client/ClientServiceImplTest.java b/mes-module-heli/mes-module-heli-biz/src/test/java/com/chanko/yunxi/mes/module/heli/service/client/ClientServiceImplTest.java deleted file mode 100644 index eed39352..00000000 --- a/mes-module-heli/mes-module-heli-biz/src/test/java/com/chanko/yunxi/mes/module/heli/service/client/ClientServiceImplTest.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.chanko.yunxi.mes.module.heli.service.client; - -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.mock.mockito.MockBean; - -import javax.annotation.Resource; - -import com.chanko.yunxi.mes.framework.test.core.ut.BaseDbUnitTest; - -import com.chanko.yunxi.mes.module.heli.controller.admin.client.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.client.ClientDO; -import com.chanko.yunxi.mes.module.heli.dal.mysql.client.ClientMapper; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; - -import javax.annotation.Resource; -import org.springframework.context.annotation.Import; -import java.util.*; -import java.time.LocalDateTime; - -import static cn.hutool.core.util.RandomUtil.*; -import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; -import static com.chanko.yunxi.mes.framework.test.core.util.AssertUtils.*; -import static com.chanko.yunxi.mes.framework.test.core.util.RandomUtils.*; -import static com.chanko.yunxi.mes.framework.common.util.date.LocalDateTimeUtils.*; -import static com.chanko.yunxi.mes.framework.common.util.object.ObjectUtils.*; -import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.*; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; - -/** - * {@link ClientServiceImpl} 的单元测试类 - * - * @author 开发者 - */ -@Import(ClientServiceImpl.class) -public class ClientServiceImplTest extends BaseDbUnitTest { - - @Resource - private ClientServiceImpl clientService; - - @Resource - private ClientMapper clientMapper; - - @Test - public void testCreateClient_success() { - // 准备参数 - ClientSaveReqVO createReqVO = randomPojo(ClientSaveReqVO.class).setId(null); - - // 调用 - Long clientId = clientService.createClient(createReqVO); - // 断言 - assertNotNull(clientId); - // 校验记录的属性是否正确 - ClientDO client = clientMapper.selectById(clientId); - assertPojoEquals(createReqVO, client, "id"); - } - - @Test - public void testUpdateClient_success() { - // mock 数据 - ClientDO dbClient = randomPojo(ClientDO.class); - clientMapper.insert(dbClient);// @Sql: 先插入出一条存在的数据 - // 准备参数 - ClientSaveReqVO updateReqVO = randomPojo(ClientSaveReqVO.class, o -> { - o.setId(dbClient.getId()); // 设置更新的 ID - }); - - // 调用 - clientService.updateClient(updateReqVO); - // 校验是否更新正确 - ClientDO client = clientMapper.selectById(updateReqVO.getId()); // 获取最新的 - assertPojoEquals(updateReqVO, client); - } - - @Test - public void testUpdateClient_notExists() { - // 准备参数 - ClientSaveReqVO updateReqVO = randomPojo(ClientSaveReqVO.class); - - // 调用, 并断言异常 - assertServiceException(() -> clientService.updateClient(updateReqVO), CLIENT_NOT_EXISTS); - } - - @Test - public void testDeleteClient_success() { - // mock 数据 - ClientDO dbClient = randomPojo(ClientDO.class); - clientMapper.insert(dbClient);// @Sql: 先插入出一条存在的数据 - // 准备参数 - Long id = dbClient.getId(); - - // 调用 - clientService.deleteClient(id); - // 校验数据不存在了 - assertNull(clientMapper.selectById(id)); - } - - @Test - public void testDeleteClient_notExists() { - // 准备参数 - Long id = randomLongId(); - - // 调用, 并断言异常 - assertServiceException(() -> clientService.deleteClient(id), CLIENT_NOT_EXISTS); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetClientPage() { - // mock 数据 - ClientDO dbClient = randomPojo(ClientDO.class, o -> { // 等会查询到 - o.setCode(null); - o.setSimpleName(null); - o.setName(null); - o.setTelephone(null); - o.setStatus(null); - }); - clientMapper.insert(dbClient); - // 测试 code 不匹配 - clientMapper.insert(cloneIgnoreId(dbClient, o -> o.setCode(null))); - // 测试 simpleName 不匹配 - clientMapper.insert(cloneIgnoreId(dbClient, o -> o.setSimpleName(null))); - // 测试 name 不匹配 - clientMapper.insert(cloneIgnoreId(dbClient, o -> o.setName(null))); - // 测试 telephone 不匹配 - clientMapper.insert(cloneIgnoreId(dbClient, o -> o.setTelephone(null))); - // 测试 status 不匹配 - clientMapper.insert(cloneIgnoreId(dbClient, o -> o.setStatus(null))); - // 准备参数 - ClientPageReqVO reqVO = new ClientPageReqVO(); - reqVO.setCode(null); - reqVO.setSimpleName(null); - reqVO.setName(null); - reqVO.setTelephone(null); - reqVO.setStatus(null); - - // 调用 - PageResult pageResult = clientService.getClientPage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbClient, pageResult.getList().get(0)); - } - -} \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/client/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/client/index.ts deleted file mode 100644 index 758e43f2..00000000 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/client/index.ts +++ /dev/null @@ -1,42 +0,0 @@ -import request from '@/config/axios' - -export interface ClientVO { - id: number - code: string - simpleName: string - name: string - telephone: string - address: string - description: string - status: number -} - -// 查询客户分页 -export const getClientPage = async (params) => { - return await request.get({ url: `/heli/client/page`, params }) -} - -// 查询客户详情 -export const getClient = async (id: number) => { - return await request.get({ url: `/heli/client/get?id=` + id }) -} - -// 新增客户 -export const createClient = async (data: ClientVO) => { - return await request.post({ url: `/heli/client/create`, data }) -} - -// 修改客户 -export const updateClient = async (data: ClientVO) => { - return await request.put({ url: `/heli/client/update`, data }) -} - -// 删除客户 -export const deleteClient = async (id: number) => { - return await request.delete({ url: `/heli/client/delete?id=` + id }) -} - -// 导出客户 Excel -export const exportClient = async (params) => { - return await request.download({ url: `/heli/client/export-excel`, params }) -} \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/client/ClientForm.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/client/ClientForm.vue deleted file mode 100644 index 61ab093f..00000000 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/client/ClientForm.vue +++ /dev/null @@ -1,128 +0,0 @@ - - diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/client/index.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/client/index.vue deleted file mode 100644 index 65aba9b8..00000000 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/client/index.vue +++ /dev/null @@ -1,222 +0,0 @@ - - - diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/customer/index.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/customer/index.vue index aa55575a..8142704f 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/customer/index.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/customer/index.vue @@ -56,7 +56,6 @@ plain @click="handleExport" :loading="exportLoading" - v-hasPermi="['heli:customer:export']" > 导出 @@ -82,7 +81,7 @@ - + - +