From 5d631e77c24da3c5f611cfd873cb21b861d07503 Mon Sep 17 00:00:00 2001 From: caixiang <939387484@qq.com> Date: Wed, 22 Jun 2022 10:23:56 +0800 Subject: [PATCH] mark --- pom.xml | 3 ++- {yum-basic => ym-baisc}/pom.xml | 11 ++++++--- .../controller/ProductTypeController.java | 22 ++++++++--------- .../com/cnbm/basic/dto/ProductTypeDTO.java | 0 .../com/cnbm/basic/entity/ProductType.java | 0 .../cnbm/basic/excel/ProductTypeExcel.java | 0 .../cnbm/basic/mapper/ProductTypeMapper.java | 3 +-- .../basic/service/IProductTypeService.java | 3 +-- .../service/impl/ProductTypeServiceImpl.java | 3 +-- .../resources/mapper/ProductTypeMapper.xml | 2 +- ym-gateway/pom.xml | 2 +- .../java/com/cnbm/config/SwaggerConfig.java | 24 +++++++++++++++++++ ym-gateway/src/main/resources/application.yml | 4 ++-- 13 files changed, 51 insertions(+), 26 deletions(-) rename {yum-basic => ym-baisc}/pom.xml (80%) rename {yum-basic => ym-baisc}/src/main/java/com/cnbm/basic/controller/ProductTypeController.java (89%) rename {yum-basic => ym-baisc}/src/main/java/com/cnbm/basic/dto/ProductTypeDTO.java (100%) rename {yum-basic => ym-baisc}/src/main/java/com/cnbm/basic/entity/ProductType.java (100%) rename {yum-basic => ym-baisc}/src/main/java/com/cnbm/basic/excel/ProductTypeExcel.java (100%) rename {yum-basic => ym-baisc}/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java (99%) rename {yum-basic => ym-baisc}/src/main/java/com/cnbm/basic/service/IProductTypeService.java (99%) rename {yum-basic => ym-baisc}/src/main/java/com/cnbm/basic/service/impl/ProductTypeServiceImpl.java (99%) rename {yum-basic => ym-baisc}/src/main/resources/mapper/ProductTypeMapper.xml (70%) diff --git a/pom.xml b/pom.xml index 6cf38c7..73622b4 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,8 @@ ym-generator ym-gateway ym-barcode - yum-basic + ym-baisc + pom diff --git a/yum-basic/pom.xml b/ym-baisc/pom.xml similarity index 80% rename from yum-basic/pom.xml rename to ym-baisc/pom.xml index e17c042..404d2fd 100644 --- a/yum-basic/pom.xml +++ b/ym-baisc/pom.xml @@ -9,7 +9,7 @@ 4.0.0 - yum-basic + ym-baisc 8 @@ -18,12 +18,17 @@ com.cnbm - ym-common + ym-admin 1.0-SNAPSHOT + + + + + com.cnbm - ym-admin + ym-common 1.0-SNAPSHOT diff --git a/yum-basic/src/main/java/com/cnbm/basic/controller/ProductTypeController.java b/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductTypeController.java similarity index 89% rename from yum-basic/src/main/java/com/cnbm/basic/controller/ProductTypeController.java rename to ym-baisc/src/main/java/com/cnbm/basic/controller/ProductTypeController.java index d5a43f1..f9453e6 100644 --- a/yum-basic/src/main/java/com/cnbm/basic/controller/ProductTypeController.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductTypeController.java @@ -1,9 +1,6 @@ package com.cnbm.basic.controller; import com.cnbm.admin.annotation.LogOperation; -import com.cnbm.basic.dto.ProductTypeDTO; -import com.cnbm.basic.excel.ProductTypeExcel; -import com.cnbm.basic.service.IProductTypeService; import com.cnbm.common.constant.Constant; import com.cnbm.common.page.PageData; import com.cnbm.common.utils.ExcelUtils; @@ -13,13 +10,14 @@ import com.cnbm.common.validator.ValidatorUtils; import com.cnbm.common.validator.group.AddGroup; import com.cnbm.common.validator.group.DefaultGroup; import com.cnbm.common.validator.group.UpdateGroup; - +import com.cnbm.basic.dto.ProductTypeDTO; +import com.cnbm.basic.excel.ProductTypeExcel; +import com.cnbm.basic.service.IProductTypeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; - import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; @@ -36,7 +34,7 @@ import java.util.Map; * @since 2022-06-21 */ @RestController -@RequestMapping("/generator/productType") +@RequestMapping("/basic/productType") @Api(tags="产品类型 表") public class ProductTypeController { @Autowired @@ -50,7 +48,7 @@ public class ProductTypeController { @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") }) - @PreAuthorize("@ex.hasAuthority('generator:productType:page')") +// @PreAuthorize("@ex.hasAuthority('basic:productType:page')") public Result> page(@ApiIgnore @RequestParam Map params){ PageData page = productTypeService.page(params); @@ -59,7 +57,7 @@ public class ProductTypeController { @GetMapping("{id}") @ApiOperation("信息") - @PreAuthorize("@ex.hasAuthority('generator:productType:info')") +// @PreAuthorize("@ex.hasAuthority('basic:productType:info')") public Result get(@PathVariable("id") Long id){ ProductTypeDTO data = productTypeService.get(id); @@ -69,7 +67,7 @@ public class ProductTypeController { @PostMapping @ApiOperation("保存") @LogOperation("保存") - @PreAuthorize("@ex.hasAuthority('generator:productType:save')") +// @PreAuthorize("@ex.hasAuthority('basic:productType:save')") public Result save(@RequestBody ProductTypeDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); @@ -82,7 +80,7 @@ public class ProductTypeController { @PutMapping @ApiOperation("修改") @LogOperation("修改") - @PreAuthorize("@ex.hasAuthority('generator:productType:update')") +// @PreAuthorize("@ex.hasAuthority('basic:productType:update')") public Result update(@RequestBody ProductTypeDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); @@ -95,7 +93,7 @@ public class ProductTypeController { @DeleteMapping @ApiOperation("删除") @LogOperation("删除") - @PreAuthorize("@ex.hasAuthority('generator:productType:delete')") +// @PreAuthorize("@ex.hasAuthority('basic:productType:delete')") public Result delete(@RequestBody Long[] ids){ //效验数据 AssertUtils.isArrayEmpty(ids, "id"); @@ -108,7 +106,7 @@ public class ProductTypeController { @GetMapping("export") @ApiOperation("导出") @LogOperation("导出") - @PreAuthorize("@ex.hasAuthority('generator:productType:export')") +// @PreAuthorize("@ex.hasAuthority('basic:productType:export')") public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { List list = productTypeService.list(params); diff --git a/yum-basic/src/main/java/com/cnbm/basic/dto/ProductTypeDTO.java b/ym-baisc/src/main/java/com/cnbm/basic/dto/ProductTypeDTO.java similarity index 100% rename from yum-basic/src/main/java/com/cnbm/basic/dto/ProductTypeDTO.java rename to ym-baisc/src/main/java/com/cnbm/basic/dto/ProductTypeDTO.java diff --git a/yum-basic/src/main/java/com/cnbm/basic/entity/ProductType.java b/ym-baisc/src/main/java/com/cnbm/basic/entity/ProductType.java similarity index 100% rename from yum-basic/src/main/java/com/cnbm/basic/entity/ProductType.java rename to ym-baisc/src/main/java/com/cnbm/basic/entity/ProductType.java diff --git a/yum-basic/src/main/java/com/cnbm/basic/excel/ProductTypeExcel.java b/ym-baisc/src/main/java/com/cnbm/basic/excel/ProductTypeExcel.java similarity index 100% rename from yum-basic/src/main/java/com/cnbm/basic/excel/ProductTypeExcel.java rename to ym-baisc/src/main/java/com/cnbm/basic/excel/ProductTypeExcel.java diff --git a/yum-basic/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java b/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java similarity index 99% rename from yum-basic/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java rename to ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java index c7d3b61..3efd03e 100644 --- a/yum-basic/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java @@ -1,8 +1,7 @@ package com.cnbm.basic.mapper; - -import com.cnbm.basic.entity.ProductType; import com.cnbm.common.dao.BaseDao; +import com.cnbm.basic.entity.ProductType; import org.apache.ibatis.annotations.Mapper; /** diff --git a/yum-basic/src/main/java/com/cnbm/basic/service/IProductTypeService.java b/ym-baisc/src/main/java/com/cnbm/basic/service/IProductTypeService.java similarity index 99% rename from yum-basic/src/main/java/com/cnbm/basic/service/IProductTypeService.java rename to ym-baisc/src/main/java/com/cnbm/basic/service/IProductTypeService.java index 29ba702..b1eeba1 100644 --- a/yum-basic/src/main/java/com/cnbm/basic/service/IProductTypeService.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/service/IProductTypeService.java @@ -1,9 +1,8 @@ package com.cnbm.basic.service; - +import com.cnbm.common.service.CrudService; import com.cnbm.basic.dto.ProductTypeDTO; import com.cnbm.basic.entity.ProductType; -import com.cnbm.common.service.CrudService; /** * 产品类型 表 diff --git a/yum-basic/src/main/java/com/cnbm/basic/service/impl/ProductTypeServiceImpl.java b/ym-baisc/src/main/java/com/cnbm/basic/service/impl/ProductTypeServiceImpl.java similarity index 99% rename from yum-basic/src/main/java/com/cnbm/basic/service/impl/ProductTypeServiceImpl.java rename to ym-baisc/src/main/java/com/cnbm/basic/service/impl/ProductTypeServiceImpl.java index ac9b79f..bdd04c7 100644 --- a/yum-basic/src/main/java/com/cnbm/basic/service/impl/ProductTypeServiceImpl.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/service/impl/ProductTypeServiceImpl.java @@ -1,12 +1,11 @@ package com.cnbm.basic.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; - +import com.cnbm.common.service.impl.CrudServiceImpl; import com.cnbm.basic.dto.ProductTypeDTO; import com.cnbm.basic.entity.ProductType; import com.cnbm.basic.mapper.ProductTypeMapper; import com.cnbm.basic.service.IProductTypeService; -import com.cnbm.common.service.impl.CrudServiceImpl; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; diff --git a/yum-basic/src/main/resources/mapper/ProductTypeMapper.xml b/ym-baisc/src/main/resources/mapper/ProductTypeMapper.xml similarity index 70% rename from yum-basic/src/main/resources/mapper/ProductTypeMapper.xml rename to ym-baisc/src/main/resources/mapper/ProductTypeMapper.xml index 816a329..9dfb63c 100644 --- a/yum-basic/src/main/resources/mapper/ProductTypeMapper.xml +++ b/ym-baisc/src/main/resources/mapper/ProductTypeMapper.xml @@ -1,5 +1,5 @@ - + diff --git a/ym-gateway/pom.xml b/ym-gateway/pom.xml index 9a4f017..5cb171a 100644 --- a/ym-gateway/pom.xml +++ b/ym-gateway/pom.xml @@ -34,7 +34,7 @@ com.cnbm - ym-basic + ym-baisc 1.0-SNAPSHOT diff --git a/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java b/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java index 5ddb652..54af2be 100644 --- a/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java +++ b/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java @@ -54,6 +54,22 @@ public class SwaggerConfig { .securitySchemes(Arrays.asList(new ApiKey("token", "token", "header"))); } + @Bean + public Docket basicApi() { + return new Docket(DocumentationType.SWAGGER_2) + .groupName("ym-basic") + .apiInfo(apiInfos("basic", "基础资料模块")) + .useDefaultResponseMessages(true) + .forCodeGeneration(false) + .select() + .apis(RequestHandlerSelectors.basePackage("com.cnbm.basic")) + .paths(PathSelectors.any()) + .build() + .securityContexts(Arrays.asList(securityContext())) + // ApiKey的name需与SecurityReference的reference保持一致 + .securitySchemes(Arrays.asList(new ApiKey("token", "token", "header"))); + } + /** * 创建该API的基本信息(这些基本信息会展现在文档页面中) * 访问地址:http://ip:port/swagger-ui.html @@ -68,6 +84,14 @@ public class SwaggerConfig { .version(version) .build(); } + private ApiInfo apiInfos(String title, String desc) { + return new ApiInfoBuilder() + .title(title) + .description(desc) + .termsOfServiceUrl("https://www.baidu.com/") + .version("1.0") + .build(); + } private SecurityContext securityContext() { return SecurityContext.builder() diff --git a/ym-gateway/src/main/resources/application.yml b/ym-gateway/src/main/resources/application.yml index 7fd704b..b1897b1 100644 --- a/ym-gateway/src/main/resources/application.yml +++ b/ym-gateway/src/main/resources/application.yml @@ -7,14 +7,14 @@ server: min-spare: 30 port: 8080 servlet: - context-path: /ym-pass + context-path: /ym-spc session: cookie: http-only: true spring: application: - name: ym-pass + name: ym-spc # 环境 dev|test|prod profiles: active: dev