diff --git a/pom.xml b/pom.xml index 5cb407c..6cf38c7 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ ym-generator ym-gateway ym-barcode - ym-basic + yum-basic pom diff --git a/ym-gateway/pom.xml b/ym-gateway/pom.xml index 2d44c76..e7e1a31 100644 --- a/ym-gateway/pom.xml +++ b/ym-gateway/pom.xml @@ -32,11 +32,6 @@ ym-barcode 1.0-SNAPSHOT - - com.cnbm - ym-basic - 1.0-SNAPSHOT - \ No newline at end of file diff --git a/ym-gateway/src/main/resources/application-dev.yml b/ym-gateway/src/main/resources/application-dev.yml index 609c59e..7d20303 100644 --- a/ym-gateway/src/main/resources/application-dev.yml +++ b/ym-gateway/src/main/resources/application-dev.yml @@ -2,7 +2,7 @@ spring: datasource: #MySQL driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://mysql.picaiba.com:30307/ym_pass?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true + url: jdbc:mysql://mysql.picaiba.com:30307/spc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true username: root password: 1qaz@WSX3edc$RFV # #Oracle diff --git a/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java b/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java index c4d11fc..32f792d 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java +++ b/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java @@ -27,7 +27,7 @@ public class CodeGenerator { @Test public void test(){ - mybatisPlusGenerator(new String[]{"sys_user"}); + mybatisPlusGenerator(new String[]{"product_type"}); } public static void mybatisPlusGenerator(String[] include){ diff --git a/ym-generator/src/main/java/com/cnbm/generator/config/DataConfig.java b/ym-generator/src/main/java/com/cnbm/generator/config/DataConfig.java index 6258ed3..fc9d683 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/config/DataConfig.java +++ b/ym-generator/src/main/java/com/cnbm/generator/config/DataConfig.java @@ -10,7 +10,7 @@ import java.nio.file.Paths; * @Version 1.0 */ public class DataConfig { - public static final String url = "jdbc:mysql://mysql.picaiba.com:30307/ym_pass?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true"; + public static final String url = "jdbc:mysql://mysql.picaiba.com:30307/spc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true"; public static final String username = "root"; public static final String password = "1qaz@WSX3edc$RFV"; } diff --git a/ym-basic/pom.xml b/yum-basic/pom.xml similarity index 58% rename from ym-basic/pom.xml rename to yum-basic/pom.xml index e6ea20b..e17c042 100644 --- a/ym-basic/pom.xml +++ b/yum-basic/pom.xml @@ -9,11 +9,22 @@ 4.0.0 - ym-basic + yum-basic 8 8 - + + + com.cnbm + ym-common + 1.0-SNAPSHOT + + + com.cnbm + ym-admin + 1.0-SNAPSHOT + + \ No newline at end of file diff --git a/yum-basic/src/main/java/com/cnbm/basic/controller/ProductTypeController.java b/yum-basic/src/main/java/com/cnbm/basic/controller/ProductTypeController.java new file mode 100644 index 0000000..d5a43f1 --- /dev/null +++ b/yum-basic/src/main/java/com/cnbm/basic/controller/ProductTypeController.java @@ -0,0 +1,118 @@ +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; +import com.cnbm.common.utils.Result; +import com.cnbm.common.validator.AssertUtils; +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 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; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 产品类型 表 前端控制器 + * + * @author why + * @since 2022-06-21 + */ +@RestController +@RequestMapping("/generator/productType") +@Api(tags="产品类型 表") +public class ProductTypeController { + @Autowired + private IProductTypeService productTypeService; + + @GetMapping("page") + @ApiOperation("分页") + @ApiImplicitParams({ + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , + @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')") + public Result> page(@ApiIgnore @RequestParam Map params){ + PageData page = productTypeService.page(params); + + return new Result>().ok(page); + } + + @GetMapping("{id}") + @ApiOperation("信息") + @PreAuthorize("@ex.hasAuthority('generator:productType:info')") + public Result get(@PathVariable("id") Long id){ + ProductTypeDTO data = productTypeService.get(id); + + return new Result().ok(data); + } + + @PostMapping + @ApiOperation("保存") + @LogOperation("保存") + @PreAuthorize("@ex.hasAuthority('generator:productType:save')") + public Result save(@RequestBody ProductTypeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + + productTypeService.save(dto); + + return new Result(); + } + + @PutMapping + @ApiOperation("修改") + @LogOperation("修改") + @PreAuthorize("@ex.hasAuthority('generator:productType:update')") + public Result update(@RequestBody ProductTypeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + + productTypeService.update(dto); + + return new Result(); + } + + @DeleteMapping + @ApiOperation("删除") + @LogOperation("删除") + @PreAuthorize("@ex.hasAuthority('generator:productType:delete')") + public Result delete(@RequestBody Long[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + + productTypeService.delete(ids); + + return new Result(); + } + + @GetMapping("export") + @ApiOperation("导出") + @LogOperation("导出") + @PreAuthorize("@ex.hasAuthority('generator:productType:export')") + public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { + List list = productTypeService.list(params); + + ExcelUtils.exportExcelToTarget(response, null, list, ProductTypeExcel.class); + } + +} \ No newline at end of file diff --git a/yum-basic/src/main/java/com/cnbm/basic/dto/ProductTypeDTO.java b/yum-basic/src/main/java/com/cnbm/basic/dto/ProductTypeDTO.java new file mode 100644 index 0000000..1949394 --- /dev/null +++ b/yum-basic/src/main/java/com/cnbm/basic/dto/ProductTypeDTO.java @@ -0,0 +1,67 @@ +package com.cnbm.basic.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + + +/** + * 产品类型 表 + * + * @author why + * @since 2022-06-21 + */ +@Data +@ApiModel(value = "产品类型 表DTO对象") +public class ProductTypeDTO implements Serializable { + private static final long serialVersionUID = 1L; + + + + @ApiModelProperty(value = "ID") + private BigDecimal id; + + @ApiModelProperty(value = "产品类型 名") + private String name; + + @ApiModelProperty(value = "产品类型 编码") + private String code; + + @ApiModelProperty(value = "描述") + private String desc; + + @ApiModelProperty(value = "1 可用,0 不可用") + private BigDecimal status; + + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "删除标志,是否有效:1 可用 0不可用") + private BigDecimal valid; + + @ApiModelProperty(value = "创建人") + private BigDecimal creatorId; + + @ApiModelProperty(value = "创建人姓名") + private String creatorName; + + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; + + @ApiModelProperty(value = "更新人") + private BigDecimal updaterId; + + @ApiModelProperty(value = "更新人姓名") + private String updaterName; + + @ApiModelProperty(value = "更新时间") + private LocalDateTime updateTime; + + @ApiModelProperty(value = "版本号") + private BigDecimal version; + +} \ No newline at end of file diff --git a/yum-basic/src/main/java/com/cnbm/basic/entity/ProductType.java b/yum-basic/src/main/java/com/cnbm/basic/entity/ProductType.java new file mode 100644 index 0000000..0c40a90 --- /dev/null +++ b/yum-basic/src/main/java/com/cnbm/basic/entity/ProductType.java @@ -0,0 +1,70 @@ +package com.cnbm.basic.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 产品类型 表 + *

+ * + * @author why + * @since 2022-06-21 + */ +@Data +@TableName("product_type") +@ApiModel(value = "ProductType对象", description = "产品类型 表") +public class ProductType implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private BigDecimal id; + + @ApiModelProperty("产品类型 名") + private String name; + + @ApiModelProperty("产品类型 编码") + private String code; + + @ApiModelProperty("描述") + private String desc; + + @ApiModelProperty("1 可用,0 不可用") + private BigDecimal status; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("删除标志,是否有效:1 可用 0不可用") + private BigDecimal valid; + + @ApiModelProperty("创建人") + private BigDecimal creatorId; + + @ApiModelProperty("创建人姓名") + private String creatorName; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + @ApiModelProperty("更新人") + private BigDecimal updaterId; + + @ApiModelProperty("更新人姓名") + private String updaterName; + + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; + + @ApiModelProperty("版本号") + private BigDecimal version; + + +} diff --git a/yum-basic/src/main/java/com/cnbm/basic/excel/ProductTypeExcel.java b/yum-basic/src/main/java/com/cnbm/basic/excel/ProductTypeExcel.java new file mode 100644 index 0000000..5115240 --- /dev/null +++ b/yum-basic/src/main/java/com/cnbm/basic/excel/ProductTypeExcel.java @@ -0,0 +1,46 @@ +package com.cnbm.basic.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 产品类型 表 + * + * @author why + * @since 2022-06-21 + */ +@Data +public class ProductTypeExcel { + @Excel(name = "ID") + private BigDecimal id; + @Excel(name = "产品类型 名") + private String name; + @Excel(name = "产品类型 编码") + private String code; + @Excel(name = "描述") + private String desc; + @Excel(name = "1 可用,0 不可用") + private BigDecimal status; + @Excel(name = "备注") + private String remark; + @Excel(name = "删除标志,是否有效:1 可用 0不可用") + private BigDecimal valid; + @Excel(name = "创建人") + private BigDecimal creatorId; + @Excel(name = "创建人姓名") + private String creatorName; + @Excel(name = "创建时间") + private LocalDateTime createTime; + @Excel(name = "更新人") + private BigDecimal updaterId; + @Excel(name = "更新人姓名") + private String updaterName; + @Excel(name = "更新时间") + private LocalDateTime updateTime; + @Excel(name = "版本号") + private BigDecimal version; + +} \ No newline at end of file diff --git a/yum-basic/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java b/yum-basic/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java new file mode 100644 index 0000000..c7d3b61 --- /dev/null +++ b/yum-basic/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java @@ -0,0 +1,17 @@ +package com.cnbm.basic.mapper; + + +import com.cnbm.basic.entity.ProductType; +import com.cnbm.common.dao.BaseDao; +import org.apache.ibatis.annotations.Mapper; + +/** + * 产品类型 表 + * + * @author why + * @since 2022-06-21 + */ +@Mapper +public interface ProductTypeMapper extends BaseDao { + +} \ No newline at end of file diff --git a/yum-basic/src/main/java/com/cnbm/basic/service/IProductTypeService.java b/yum-basic/src/main/java/com/cnbm/basic/service/IProductTypeService.java new file mode 100644 index 0000000..29ba702 --- /dev/null +++ b/yum-basic/src/main/java/com/cnbm/basic/service/IProductTypeService.java @@ -0,0 +1,16 @@ +package com.cnbm.basic.service; + + +import com.cnbm.basic.dto.ProductTypeDTO; +import com.cnbm.basic.entity.ProductType; +import com.cnbm.common.service.CrudService; + +/** + * 产品类型 表 + * + * @author why + * @since 2022-06-21 + */ +public interface IProductTypeService extends CrudService { + +} \ No newline at end of file diff --git a/yum-basic/src/main/java/com/cnbm/basic/service/impl/ProductTypeServiceImpl.java b/yum-basic/src/main/java/com/cnbm/basic/service/impl/ProductTypeServiceImpl.java new file mode 100644 index 0000000..ac9b79f --- /dev/null +++ b/yum-basic/src/main/java/com/cnbm/basic/service/impl/ProductTypeServiceImpl.java @@ -0,0 +1,35 @@ +package com.cnbm.basic.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; + +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; + +import java.util.Map; + +/** + * 产品类型 表 + * + * @author why + * @since 2022-06-21 + */ +@Service +public class ProductTypeServiceImpl extends CrudServiceImpl implements IProductTypeService { + + @Override + public QueryWrapper getWrapper(Map params){ + String id = (String)params.get("id"); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), "id", id); + + return wrapper; + } + + +} \ No newline at end of file diff --git a/yum-basic/src/main/resources/mapper/ProductTypeMapper.xml b/yum-basic/src/main/resources/mapper/ProductTypeMapper.xml new file mode 100644 index 0000000..816a329 --- /dev/null +++ b/yum-basic/src/main/resources/mapper/ProductTypeMapper.xml @@ -0,0 +1,5 @@ + + + + +