mark
This commit is contained in:
parent
76b37443f9
commit
0806c22316
2
pom.xml
2
pom.xml
@ -13,7 +13,7 @@
|
||||
<module>ym-generator</module>
|
||||
<module>ym-gateway</module>
|
||||
<module>ym-barcode</module>
|
||||
<module>ym-basic</module>
|
||||
<module>yum-basic</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
@ -32,11 +32,6 @@
|
||||
<artifactId>ym-barcode</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cnbm</groupId>
|
||||
<artifactId>ym-basic</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -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
|
||||
|
@ -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){
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -9,11 +9,22 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ym-basic</artifactId>
|
||||
<artifactId>yum-basic</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.cnbm</groupId>
|
||||
<artifactId>ym-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cnbm</groupId>
|
||||
<artifactId>ym-admin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -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<PageData<ProductTypeDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
PageData<ProductTypeDTO> page = productTypeService.page(params);
|
||||
|
||||
return new Result<PageData<ProductTypeDTO>>().ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@ApiOperation("信息")
|
||||
@PreAuthorize("@ex.hasAuthority('generator:productType:info')")
|
||||
public Result<ProductTypeDTO> get(@PathVariable("id") Long id){
|
||||
ProductTypeDTO data = productTypeService.get(id);
|
||||
|
||||
return new Result<ProductTypeDTO>().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<String, Object> params, HttpServletResponse response) throws Exception {
|
||||
List<ProductTypeDTO> list = productTypeService.list(params);
|
||||
|
||||
ExcelUtils.exportExcelToTarget(response, null, list, ProductTypeExcel.class);
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品类型 表
|
||||
* </p>
|
||||
*
|
||||
* @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;
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<ProductType> {
|
||||
|
||||
}
|
@ -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<ProductType, ProductTypeDTO> {
|
||||
|
||||
}
|
@ -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<ProductTypeMapper, ProductType, ProductTypeDTO> implements IProductTypeService {
|
||||
|
||||
@Override
|
||||
public QueryWrapper<ProductType> getWrapper(Map<String, Object> params){
|
||||
String id = (String)params.get("id");
|
||||
|
||||
QueryWrapper<ProductType> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +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>
|
Caricamento…
Fai riferimento in un nuovo problema
Block a user