This commit is contained in:
caixiang 2022-06-22 10:23:56 +08:00
rodzic 3b7b592a16
commit 5d631e77c2
13 zmienionych plików z 51 dodań i 26 usunięć

Wyświetl plik

@ -13,7 +13,8 @@
<module>ym-generator</module>
<module>ym-gateway</module>
<module>ym-barcode</module>
<module>yum-basic</module>
<module>ym-baisc</module>
</modules>
<packaging>pom</packaging>

Wyświetl plik

@ -9,7 +9,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yum-basic</artifactId>
<artifactId>ym-baisc</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
@ -18,12 +18,17 @@
<dependencies>
<dependency>
<groupId>com.cnbm</groupId>
<artifactId>ym-common</artifactId>
<artifactId>ym-admin</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.cnbm</groupId>-->
<!-- <artifactId>ym-gateway</artifactId>-->
<!-- <version>1.0-SNAPSHOT</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.cnbm</groupId>
<artifactId>ym-admin</artifactId>
<artifactId>ym-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>

Wyświetl plik

@ -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<PageData<ProductTypeDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<ProductTypeDTO> 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<ProductTypeDTO> 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<String, Object> params, HttpServletResponse response) throws Exception {
List<ProductTypeDTO> list = productTypeService.list(params);

Wyświetl plik

@ -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;
/**

Wyświetl plik

@ -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;
/**
* 产品类型

Wyświetl plik

@ -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;

Wyświetl plik

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.generator.mapper.ProductTypeMapper">
<mapper namespace="com.cnbm.basic.mapper.ProductTypeMapper">
</mapper>

Wyświetl plik

@ -34,7 +34,7 @@
</dependency>
<dependency>
<groupId>com.cnbm</groupId>
<artifactId>ym-basic</artifactId>
<artifactId>ym-baisc</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>

Wyświetl plik

@ -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()

Wyświetl plik

@ -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