Commit 200f06fb94496a301df4fa36fc75206a20860dcc

Authored by yeqianyong
1 parent 73840bfb

楚江ERP-产品品种相关接口开发

1 1 alter table base_data_customer modify column mnemonic_code varchar(20) null;
2 2
  3 +-- 厂房信息
3 4 create table if not exists base_data_workshop (
4 5 id varchar(32) primary key comment 'ID',
5 6 code varchar(20) not null comment '厂房编号',
... ... @@ -7,26 +8,28 @@ create table if not exists base_data_workshop (
7 8 type varchar(20) not null comment '厂房类型',
8 9 description varchar(100) comment '描述',
9 10 create_by_id varchar(32) not null comment '创建人ID',
10   - create_by varchar(32) not null comment '创建人',
  11 + create_by varchar(20) not null comment '创建人',
11 12 update_by_id varchar(32) not null comment '更新人ID',
12   - update_by varchar(32) not null comment '更新人',
  13 + update_by varchar(20) not null comment '更新人',
13 14 create_time datetime default now() comment '创建时间',
14 15 update_time datetime default now() comment '更新时间'
15 16 );
16 17
  18 +-- 办事处/科办
17 19 create table if not exists base_data_office (
18 20 id varchar(32) primary key comment 'ID',
19 21 code varchar(20) not null comment '编号',
20 22 name varchar(50) not null comment '名称',
21 23 description varchar(100) comment '描述',
22 24 create_by_id varchar(32) not null comment '创建人ID',
23   - create_by varchar(32) not null comment '创建人',
  25 + create_by varchar(20) not null comment '创建人',
24 26 update_by_id varchar(32) not null comment '更新人ID',
25   - update_by varchar(32) not null comment '更新人',
  27 + update_by varchar(20) not null comment '更新人',
26 28 create_time datetime default now() comment '创建时间',
27 29 update_time datetime default now() comment '更新时间'
28 30 );
29 31
  32 +-- 类型数据
30 33 create table if not exists base_data_type (
31 34 id varchar(32) primary key comment 'ID',
32 35 code varchar(20) not null comment '编号',
... ... @@ -34,9 +37,23 @@ create table if not exists base_data_type (
34 37 description varchar(100) comment '描述',
35 38 type varchar(20) not null comment '类型:客户(CUSTOMER)',
36 39 create_by_id varchar(32) not null comment '创建人ID',
37   - create_by varchar(32) not null comment '创建人',
  40 + create_by varchar(20) not null comment '创建人',
38 41 update_by_id varchar(32) not null comment '更新人ID',
39   - update_by varchar(32) not null comment '更新人',
  42 + update_by varchar(20) not null comment '更新人',
  43 + create_time datetime default now() comment '创建时间',
  44 + update_time datetime default now() comment '更新时间'
  45 +);
  46 +
  47 +-- 产品品种
  48 +create table if not exists base_data_product_variety (
  49 + id varchar(32) primary key comment 'ID',
  50 + code varchar(20) not null comment '编号',
  51 + name varchar(50) not null comment '名称',
  52 + description varchar(100) comment '描述',
  53 + create_by_id varchar(32) not null comment '创建人ID',
  54 + create_by varchar(20) not null comment '创建人',
  55 + update_by_id varchar(32) not null comment '更新人ID',
  56 + update_by varchar(20) not null comment '更新人',
40 57 create_time datetime default now() comment '创建时间',
41 58 update_time datetime default now() comment '更新时间'
42 59 );
\ No newline at end of file
... ...
  1 +package com.lframework.xingyun.basedata.bo.product.variety;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import com.lframework.xingyun.basedata.entity.ProductVariety;
  5 +import com.lframework.starter.common.constants.StringPool;
  6 +import com.lframework.starter.web.core.bo.BaseBo;
  7 +import java.time.LocalDateTime;
  8 +import io.swagger.annotations.ApiModelProperty;
  9 +
  10 +import lombok.Data;
  11 +
  12 +/**
  13 + * <p>
  14 + * 产品品种 GetBo
  15 + * </p>
  16 + *
  17 + */
  18 +@Data
  19 +public class GetProductVarietyBo extends BaseBo<ProductVariety> {
  20 +
  21 + /**
  22 + * ID
  23 + */
  24 + @ApiModelProperty("ID")
  25 + private String id;
  26 +
  27 + /**
  28 + * 品种编号
  29 + */
  30 + @ApiModelProperty("品种编号")
  31 + private String code;
  32 +
  33 + /**
  34 + * 品种名称
  35 + */
  36 + @ApiModelProperty("品种名称")
  37 + private String name;
  38 +
  39 + /**
  40 + * 描述
  41 + */
  42 + @ApiModelProperty("描述")
  43 + private String description;
  44 +
  45 + /**
  46 + * 创建人
  47 + */
  48 + @ApiModelProperty("创建人")
  49 + private String createBy;
  50 +
  51 + /**
  52 + * 更新人
  53 + */
  54 + @ApiModelProperty("更新人")
  55 + private String updateBy;
  56 +
  57 + /**
  58 + * 创建时间
  59 + */
  60 + @ApiModelProperty("创建时间")
  61 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  62 + private LocalDateTime createTime;
  63 +
  64 + /**
  65 + * 更新时间
  66 + */
  67 + @ApiModelProperty("更新时间")
  68 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  69 + private LocalDateTime updateTime;
  70 +
  71 + public GetProductVarietyBo() {
  72 +
  73 + }
  74 +
  75 + public GetProductVarietyBo(ProductVariety dto) {
  76 + super(dto);
  77 + }
  78 +
  79 + @Override
  80 + public BaseBo<ProductVariety> convert(ProductVariety dto) {
  81 + return super.convert(dto);
  82 + }
  83 +}
... ...
  1 +package com.lframework.xingyun.basedata.controller;
  2 +
  3 +import com.lframework.starter.web.core.annotations.security.HasPermission;
  4 +import com.lframework.starter.web.core.controller.DefaultBaseController;
  5 +import com.lframework.xingyun.basedata.bo.product.variety.GetProductVarietyBo;
  6 +import com.lframework.xingyun.basedata.vo.product.variety.QueryProductVarietyVo;
  7 +import com.lframework.xingyun.basedata.service.product.ProductVarietyService;
  8 +import com.lframework.xingyun.basedata.vo.product.variety.CreateProductVarietyVo;
  9 +import com.lframework.xingyun.basedata.vo.product.variety.UpdateProductVarietyVo;
  10 +import com.lframework.xingyun.basedata.entity.ProductVariety;
  11 +import com.lframework.starter.web.core.utils.PageResultUtil;
  12 +import com.lframework.starter.web.core.components.resp.PageResult;
  13 +import com.lframework.starter.web.core.components.resp.InvokeResult;
  14 +
  15 +import javax.annotation.Resource;
  16 +import javax.validation.constraints.NotBlank;
  17 +import io.swagger.annotations.ApiImplicitParam;
  18 +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
  19 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  20 +import io.swagger.annotations.ApiOperation;
  21 +import com.lframework.starter.common.utils.CollectionUtil;
  22 +import io.swagger.annotations.Api;
  23 +import org.springframework.web.bind.annotation.DeleteMapping;
  24 +import org.springframework.validation.annotation.Validated;
  25 +import org.springframework.web.bind.annotation.*;
  26 +
  27 +import javax.validation.Valid;
  28 +import java.util.List;
  29 +import java.util.stream.Collectors;
  30 +
  31 +/**
  32 + * 产品品种 Controller
  33 + *
  34 + */
  35 +@Api(tags = "产品品种")
  36 +@Validated
  37 +@RestController
  38 +@RequestMapping("/baseData/product/variety")
  39 +public class ProductVarietyController extends DefaultBaseController {
  40 +
  41 +
  42 + @Resource
  43 + private ProductVarietyService productVarietyService;
  44 +
  45 +
  46 + /**
  47 + * 查询列表
  48 + */
  49 + @ApiOperation("查询列表")
  50 + @HasPermission({"base-data:variety:query"})
  51 + @GetMapping("/query")
  52 + public InvokeResult<PageResult<GetProductVarietyBo>> query(@Valid QueryProductVarietyVo vo) {
  53 + PageResult<ProductVariety> pageResult = productVarietyService.query(getPageIndex(vo), getPageSize(vo), vo);
  54 + List<ProductVariety> dataList = pageResult.getDatas();
  55 + List<GetProductVarietyBo> results = null;
  56 + if (!CollectionUtil.isEmpty(dataList)) {
  57 + results = dataList.stream().map(GetProductVarietyBo::new).collect(Collectors.toList());
  58 + }
  59 + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results));
  60 + }
  61 +
  62 + /**
  63 + * 根据ID查询
  64 + */
  65 + @ApiOperation("根据ID查询")
  66 + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
  67 + @HasPermission({"base-data:variety:query"})
  68 + @GetMapping
  69 + public InvokeResult<GetProductVarietyBo> get(@NotBlank(message = "id不能为空!") String id) {
  70 + ProductVariety data = productVarietyService.findById(id);
  71 + if (data == null) {
  72 + throw new DefaultClientException("产品品种不存在!");
  73 + }
  74 + GetProductVarietyBo result = new GetProductVarietyBo(data);
  75 +
  76 + return InvokeResultBuilder.success(result);
  77 + }
  78 +
  79 + /**
  80 + * 新增
  81 + */
  82 + @ApiOperation("新增")
  83 + @HasPermission({"base-data:variety:add"})
  84 + @PostMapping
  85 + public InvokeResult<Void> create(@Valid CreateProductVarietyVo vo) {
  86 + productVarietyService.create(vo);
  87 + return InvokeResultBuilder.success();
  88 + }
  89 +
  90 + /**
  91 + * 修改
  92 + */
  93 + @ApiOperation("修改")
  94 + @HasPermission({"base-data:variety:modify"})
  95 + @PutMapping
  96 + public InvokeResult<Void> update(@Valid UpdateProductVarietyVo vo) {
  97 + productVarietyService.update(vo);
  98 + return InvokeResultBuilder.success();
  99 + }
  100 +
  101 + /**
  102 + * 根据ID删除
  103 + */
  104 + @ApiOperation("根据ID删除")
  105 + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
  106 + @HasPermission({"base-data:variety:delete"})
  107 + @DeleteMapping
  108 + public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) {
  109 + productVarietyService.deleteById(id);
  110 + return InvokeResultBuilder.success();
  111 + }
  112 +}
... ...
  1 +package com.lframework.xingyun.basedata.entity;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.TableName;
  4 +import com.lframework.starter.web.core.dto.BaseDto;
  5 +import java.time.LocalDateTime;
  6 +import com.baomidou.mybatisplus.annotation.FieldFill;
  7 +import com.lframework.starter.web.core.entity.BaseEntity;
  8 +import com.baomidou.mybatisplus.annotation.TableField;
  9 +import lombok.Data;
  10 +
  11 +/**
  12 + * <p>
  13 + * 产品品种
  14 + * </p>
  15 + *
  16 + */
  17 +@Data
  18 +@TableName("base_data_product_variety")
  19 +public class ProductVariety extends BaseEntity implements BaseDto {
  20 +
  21 + private static final long serialVersionUID = 1L;
  22 +
  23 + public static final String CACHE_NAME = "ProductVariety";
  24 +
  25 + /**
  26 + * ID
  27 + */
  28 + private String id;
  29 +
  30 + /**
  31 + * 品种编号
  32 + */
  33 + private String code;
  34 +
  35 + /**
  36 + * 品种名称
  37 + */
  38 + private String name;
  39 +
  40 + /**
  41 + * 描述
  42 + */
  43 + private String description;
  44 +
  45 + /**
  46 + * 创建人ID
  47 + */
  48 + @TableField(fill = FieldFill.INSERT)
  49 + private String createById;
  50 +
  51 + /**
  52 + * 创建人
  53 + */
  54 + @TableField(fill = FieldFill.INSERT)
  55 + private String createBy;
  56 +
  57 + /**
  58 + * 更新人ID
  59 + */
  60 + @TableField(fill = FieldFill.INSERT_UPDATE)
  61 + private String updateById;
  62 +
  63 + /**
  64 + * 更新人
  65 + */
  66 + @TableField(fill = FieldFill.INSERT_UPDATE)
  67 + private String updateBy;
  68 +
  69 + /**
  70 + * 创建时间
  71 + */
  72 + @TableField(fill = FieldFill.INSERT)
  73 + private LocalDateTime createTime;
  74 +
  75 + /**
  76 + * 更新时间
  77 + */
  78 + @TableField(fill = FieldFill.INSERT_UPDATE)
  79 + private LocalDateTime updateTime;
  80 +
  81 +}
... ...
  1 +package com.lframework.xingyun.basedata.impl.product;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.github.pagehelper.PageInfo;
  6 +import com.lframework.xingyun.basedata.entity.ProductVariety;
  7 +import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
  8 +import com.lframework.starter.web.core.utils.PageResultUtil;
  9 +import com.lframework.starter.web.core.components.resp.PageResult;
  10 +import com.lframework.starter.web.core.utils.OpLogUtil;
  11 +import com.lframework.starter.common.utils.StringUtil;
  12 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  13 +import com.lframework.starter.web.core.utils.IdUtil;
  14 +import com.lframework.starter.common.utils.ObjectUtil;
  15 +import com.lframework.starter.web.core.annotations.oplog.OpLog;
  16 +import com.lframework.starter.web.core.utils.PageHelperUtil;
  17 +import com.lframework.starter.common.utils.Assert;
  18 +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
  19 +import org.springframework.transaction.annotation.Transactional;
  20 +import com.lframework.xingyun.basedata.mappers.ProductVarietyMapper;
  21 +import com.lframework.xingyun.basedata.service.product.ProductVarietyService;
  22 +import com.lframework.xingyun.basedata.vo.product.variety.CreateProductVarietyVo;
  23 +import com.lframework.xingyun.basedata.vo.product.variety.QueryProductVarietyVo;
  24 +import com.lframework.xingyun.basedata.vo.product.variety.UpdateProductVarietyVo;
  25 +import org.springframework.stereotype.Service;
  26 +
  27 +import java.util.List;
  28 +
  29 +@Service
  30 +public class ProductVarietyServiceImpl extends BaseMpServiceImpl<ProductVarietyMapper, ProductVariety> implements ProductVarietyService {
  31 +
  32 + @Override
  33 + public PageResult<ProductVariety> query(Integer pageIndex, Integer pageSize, QueryProductVarietyVo vo) {
  34 + Assert.greaterThanZero(pageIndex);
  35 + Assert.greaterThanZero(pageSize);
  36 +
  37 + PageHelperUtil.startPage(pageIndex, pageSize);
  38 + List<ProductVariety> dataList = this.query(vo);
  39 +
  40 + return PageResultUtil.convert(new PageInfo<>(dataList));
  41 + }
  42 +
  43 + @Override
  44 + public List<ProductVariety> query(QueryProductVarietyVo vo) {
  45 + return getBaseMapper().query(vo);
  46 + }
  47 +
  48 + @Override
  49 + public ProductVariety findById(String id) {
  50 + return getBaseMapper().selectById(id);
  51 + }
  52 +
  53 + @OpLog(type = OtherOpLogType.class, name = "新增产品品种,ID:{}", params = {"#id"})
  54 + @Transactional(rollbackFor = Exception.class)
  55 + @Override
  56 + public String create(CreateProductVarietyVo vo) {
  57 + ProductVariety data = new ProductVariety();
  58 + data.setId(IdUtil.getId());
  59 + data.setCode(vo.getCode());
  60 + data.setName(vo.getName());
  61 + if (!StringUtil.isBlank(vo.getDescription())) {
  62 + data.setDescription(vo.getDescription());
  63 + }
  64 + getBaseMapper().insert(data);
  65 +
  66 + OpLogUtil.setVariable("id", data.getId());
  67 + OpLogUtil.setExtra(vo);
  68 + return data.getId();
  69 + }
  70 +
  71 + @OpLog(type = OtherOpLogType.class, name = "修改产品品种,ID:{}", params = {"#id"})
  72 + @Transactional(rollbackFor = Exception.class)
  73 + @Override
  74 + public void update(UpdateProductVarietyVo vo) {
  75 + ProductVariety data = getBaseMapper().selectById(vo.getId());
  76 + if (ObjectUtil.isNull(data)) {
  77 + throw new DefaultClientException("产品品种不存在!");
  78 + }
  79 + LambdaUpdateWrapper<ProductVariety> updateWrapper = Wrappers.lambdaUpdate(ProductVariety.class)
  80 + .set(ProductVariety::getCode, data.getCode())
  81 + .set(ProductVariety::getName, vo.getName())
  82 + .set(ProductVariety::getDescription, StringUtil.isBlank(vo.getDescription()) ? null : vo.getDescription())
  83 + .eq(ProductVariety::getId, vo.getId());
  84 + getBaseMapper().update(updateWrapper);
  85 +
  86 + OpLogUtil.setVariable("id", data.getId());
  87 + OpLogUtil.setExtra(vo);
  88 + }
  89 +
  90 + @OpLog(type = OtherOpLogType.class, name = "删除产品品种,ID:{}", params = {"#id"})
  91 + @Transactional(rollbackFor = Exception.class)
  92 + @Override
  93 + public void deleteById(String id) {
  94 + getBaseMapper().deleteById(id);
  95 + }
  96 +}
... ...
... ... @@ -86,6 +86,7 @@ public class WorkshopServiceImpl extends BaseMpServiceImpl<WorkshopMapper, Works
86 86 data.setId(IdUtil.getId());
87 87 data.setCode(vo.getCode());
88 88 data.setName(vo.getName());
  89 + data.setDescription(vo.getDescription());
89 90 data.setType(EnumUtil.getByCode(WorkshopType.class, vo.getType()));
90 91
91 92 getBaseMapper().insert(data);
... ...
  1 +package com.lframework.xingyun.basedata.mappers;
  2 +
  3 +import com.lframework.xingyun.basedata.entity.ProductVariety;
  4 +import com.lframework.starter.web.core.mapper.BaseMapper;
  5 +import com.lframework.xingyun.basedata.vo.product.variety.QueryProductVarietyVo;
  6 +import org.apache.ibatis.annotations.Param;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * <p>
  12 + * 产品品种 Mapper 接口
  13 + * </p>
  14 + *
  15 + */
  16 +public interface ProductVarietyMapper extends BaseMapper<ProductVariety> {
  17 +
  18 + /**
  19 + * 查询列表
  20 + * @param vo
  21 + * @return
  22 + */
  23 + List<ProductVariety> query(@Param("vo") QueryProductVarietyVo vo);
  24 +}
... ...
  1 +package com.lframework.xingyun.basedata.service.product;
  2 +
  3 +import com.lframework.xingyun.basedata.vo.product.variety.CreateProductVarietyVo;
  4 +import com.lframework.xingyun.basedata.vo.product.variety.QueryProductVarietyVo;
  5 +import com.lframework.xingyun.basedata.vo.product.variety.UpdateProductVarietyVo;
  6 +import com.lframework.xingyun.basedata.entity.ProductVariety;
  7 +import com.lframework.starter.web.core.service.BaseMpService;
  8 +import com.lframework.starter.web.core.components.resp.PageResult;
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * 产品品种 Service
  13 + */
  14 +public interface ProductVarietyService extends BaseMpService<ProductVariety> {
  15 +
  16 + /**
  17 + * 分页查询
  18 + *
  19 + * @return PageResult<ProductVariety>
  20 + */
  21 + PageResult<ProductVariety> query(Integer pageIndex, Integer pageSize, QueryProductVarietyVo vo);
  22 +
  23 + /**
  24 + * 查询列表
  25 + *
  26 + * @param vo 查询条件
  27 + * @return List<ProductVariety>
  28 + */
  29 + List<ProductVariety> query(QueryProductVarietyVo vo);
  30 +
  31 + /**
  32 + * 根据ID查询
  33 + *
  34 + * @param id 主键ID
  35 + * @return ProductVariety
  36 + */
  37 + ProductVariety findById(String id);
  38 +
  39 + /**
  40 + * 新增
  41 + *
  42 + * @param vo 数据实体
  43 + * @return String
  44 + */
  45 + String create(CreateProductVarietyVo vo);
  46 +
  47 + /**
  48 + * 修改
  49 + *
  50 + * @param vo 数据实体
  51 + */
  52 + void update(UpdateProductVarietyVo vo);
  53 +
  54 + /**
  55 + * 根据ID删除
  56 + *
  57 + * @param id 主键ID
  58 + */
  59 + void deleteById(String id);
  60 +}
... ...
  1 +package com.lframework.xingyun.basedata.vo.product.variety;
  2 +
  3 +import javax.validation.constraints.NotBlank;
  4 +import com.lframework.starter.web.core.vo.BaseVo;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import org.hibernate.validator.constraints.Length;
  7 +import java.io.Serializable;
  8 +import lombok.Data;
  9 +
  10 +@Data
  11 +public class CreateProductVarietyVo implements BaseVo, Serializable {
  12 +
  13 + private static final long serialVersionUID = 1L;
  14 +
  15 + /**
  16 + * 品种编号
  17 + */
  18 + @ApiModelProperty(value = "品种编号", required = true)
  19 + @NotBlank(message = "请输入品种编号!")
  20 + @Length(message = "品种编号最多允许20个字符!")
  21 + private String code;
  22 +
  23 + /**
  24 + * 品种名称
  25 + */
  26 + @ApiModelProperty(value = "品种名称", required = true)
  27 + @NotBlank(message = "请输入品种名称!")
  28 + @Length(message = "品种名称最多允许50个字符!")
  29 + private String name;
  30 +
  31 + /**
  32 + * 描述
  33 + */
  34 + @ApiModelProperty("描述")
  35 + @Length(message = "描述最多允许100个字符!")
  36 + private String description;
  37 +
  38 +}
... ...
  1 +package com.lframework.xingyun.basedata.vo.product.variety;
  2 +
  3 +import lombok.Data;
  4 +import com.lframework.starter.web.core.vo.PageVo;
  5 +import com.lframework.starter.web.core.vo.BaseVo;
  6 +import io.swagger.annotations.ApiModelProperty;
  7 +
  8 +import java.io.Serializable;
  9 +
  10 +@Data
  11 +public class QueryProductVarietyVo extends PageVo implements BaseVo, Serializable {
  12 +
  13 + private static final long serialVersionUID = 1L;
  14 +
  15 + /**
  16 + * 品种编号
  17 + */
  18 + @ApiModelProperty("品种编号")
  19 + private String code;
  20 +
  21 + /**
  22 + * 品种名称
  23 + */
  24 + @ApiModelProperty("品种名称")
  25 + private String name;
  26 +
  27 +}
... ...
  1 +package com.lframework.xingyun.basedata.vo.product.variety;
  2 +
  3 +import lombok.Data;
  4 +import javax.validation.constraints.NotBlank;
  5 +import com.lframework.starter.web.core.vo.BaseVo;
  6 +import io.swagger.annotations.ApiModelProperty;
  7 +import org.hibernate.validator.constraints.Length;
  8 +import java.io.Serializable;
  9 +
  10 +@Data
  11 +public class UpdateProductVarietyVo implements BaseVo, Serializable {
  12 +
  13 + private static final long serialVersionUID = 1L;
  14 +
  15 + /**
  16 + * ID
  17 + */
  18 + @ApiModelProperty(value = "ID", required = true)
  19 + @NotBlank(message = "id不能为空!")
  20 + private String id;
  21 +
  22 + /**
  23 + * 品种名称
  24 + */
  25 + @ApiModelProperty(value = "品种名称", required = true)
  26 + @NotBlank(message = "请输入品种名称!")
  27 + @Length(message = "品种名称最多允许50个字符!")
  28 + private String name;
  29 +
  30 + /**
  31 + * 描述
  32 + */
  33 + @ApiModelProperty("描述")
  34 + @Length(message = "描述最多允许100个字符!")
  35 + private String description;
  36 +
  37 +}
... ...
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.lframework.xingyun.basedata.mappers.ProductVarietyMapper">
  4 +
  5 + <resultMap id="ProductVariety" type="com.lframework.xingyun.basedata.entity.ProductVariety">
  6 + <id column="id" property="id"/>
  7 + <result column="code" property="code"/>
  8 + <result column="name" property="name"/>
  9 + <result column="description" property="description"/>
  10 + <result column="create_by_id" property="createById"/>
  11 + <result column="create_by" property="createBy"/>
  12 + <result column="update_by_id" property="updateById"/>
  13 + <result column="update_by" property="updateBy"/>
  14 + <result column="create_time" property="createTime"/>
  15 + <result column="update_time" property="updateTime"/>
  16 + </resultMap>
  17 +
  18 + <sql id="ProductVariety_sql">
  19 + SELECT
  20 + tb.id,
  21 + tb.code,
  22 + tb.name,
  23 + tb.description,
  24 + tb.create_by_id,
  25 + tb.create_by,
  26 + tb.update_by_id,
  27 + tb.update_by,
  28 + tb.create_time,
  29 + tb.update_time
  30 + FROM base_data_product_variety AS tb
  31 + </sql>
  32 +
  33 + <select id="query" resultMap="ProductVariety">
  34 + <include refid="ProductVariety_sql"/>
  35 + <where>
  36 + <if test="vo.code != null and vo.code != ''">
  37 + AND tb.code LIKE CONCAT('%', #{vo.code}, '%')
  38 + </if>
  39 + <if test="vo.name != null and vo.name != ''">
  40 + AND tb.name LIKE CONCAT('%', #{vo.name}, '%')
  41 + </if>
  42 + </where>
  43 + </select>
  44 +</mapper>
... ...