Showing
12 changed files
with
558 additions
and
0 deletions
| @@ -1857,3 +1857,15 @@ CREATE TABLE `procurement_supplier_quotation_deal` | @@ -1857,3 +1857,15 @@ CREATE TABLE `procurement_supplier_quotation_deal` | ||
| 1857 | KEY `idx_psqd_principal_id` (`principal_id`), | 1857 | KEY `idx_psqd_principal_id` (`principal_id`), |
| 1858 | KEY `idx_psqd_create_time` (`create_time`) | 1858 | KEY `idx_psqd_create_time` (`create_time`) |
| 1859 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='供应商报价成交表'; | 1859 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='供应商报价成交表'; |
| 1860 | + | ||
| 1861 | +create table if not exists base_data_company_short | ||
| 1862 | +( | ||
| 1863 | + id varchar(32) primary key comment 'ID', | ||
| 1864 | + company_name varchar(200) not null comment '公司名称', | ||
| 1865 | + short_name varchar(100) not null comment '公司简称', | ||
| 1866 | + create_by_id varchar(32) not null comment '创建人ID', | ||
| 1867 | + update_by_id varchar(32) not null comment '更新人ID', | ||
| 1868 | + create_time datetime default now() comment '创建时间', | ||
| 1869 | + update_time datetime default now() comment '更新时间', | ||
| 1870 | + unique key uk_bd_company_short_company_name (company_name) | ||
| 1871 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='公司简称'; |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/company/GetCompanyShortBo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.bo.company; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import com.lframework.starter.common.constants.StringPool; | ||
| 5 | +import com.lframework.starter.web.core.bo.BaseBo; | ||
| 6 | +import com.lframework.xingyun.basedata.entity.CompanyShort; | ||
| 7 | +import io.swagger.annotations.ApiModelProperty; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +@Data | ||
| 12 | +public class GetCompanyShortBo extends BaseBo<CompanyShort> { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * ID | ||
| 16 | + */ | ||
| 17 | + @ApiModelProperty("ID") | ||
| 18 | + private String id; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 公司名称 | ||
| 22 | + */ | ||
| 23 | + @ApiModelProperty("公司名称") | ||
| 24 | + private String companyName; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 公司简称 | ||
| 28 | + */ | ||
| 29 | + @ApiModelProperty("公司简称") | ||
| 30 | + private String shortName; | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 创建时间 | ||
| 34 | + */ | ||
| 35 | + @ApiModelProperty("创建时间") | ||
| 36 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | ||
| 37 | + private LocalDateTime createTime; | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 更新时间 | ||
| 41 | + */ | ||
| 42 | + @ApiModelProperty("更新时间") | ||
| 43 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | ||
| 44 | + private LocalDateTime updateTime; | ||
| 45 | + | ||
| 46 | + public GetCompanyShortBo() { | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + public GetCompanyShortBo(CompanyShort dto) { | ||
| 50 | + super(dto); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + protected void afterInit(CompanyShort dto) { | ||
| 55 | + } | ||
| 56 | +} | ||
| 57 | + |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/company/QueryCompanyShortBo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.bo.company; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import com.lframework.starter.common.constants.StringPool; | ||
| 5 | +import com.lframework.starter.web.core.bo.BaseBo; | ||
| 6 | +import com.lframework.xingyun.basedata.entity.CompanyShort; | ||
| 7 | +import io.swagger.annotations.ApiModelProperty; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +@Data | ||
| 12 | +public class QueryCompanyShortBo extends BaseBo<CompanyShort> { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * ID | ||
| 16 | + */ | ||
| 17 | + @ApiModelProperty("ID") | ||
| 18 | + private String id; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 公司名称 | ||
| 22 | + */ | ||
| 23 | + @ApiModelProperty("公司名称") | ||
| 24 | + private String companyName; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 公司简称 | ||
| 28 | + */ | ||
| 29 | + @ApiModelProperty("公司简称") | ||
| 30 | + private String shortName; | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 创建时间 | ||
| 34 | + */ | ||
| 35 | + @ApiModelProperty("创建时间") | ||
| 36 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | ||
| 37 | + private LocalDateTime createTime; | ||
| 38 | + | ||
| 39 | + public QueryCompanyShortBo() { | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public QueryCompanyShortBo(CompanyShort dto) { | ||
| 43 | + super(dto); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @Override | ||
| 47 | + protected void afterInit(CompanyShort dto) { | ||
| 48 | + } | ||
| 49 | +} | ||
| 50 | + |
| 1 | +package com.lframework.xingyun.basedata.controller; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | ||
| 4 | +import com.lframework.starter.common.utils.CollectionUtil; | ||
| 5 | +import com.lframework.starter.web.core.annotations.security.HasPermission; | ||
| 6 | +import com.lframework.starter.web.core.components.resp.InvokeResult; | ||
| 7 | +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; | ||
| 8 | +import com.lframework.starter.web.core.components.resp.PageResult; | ||
| 9 | +import com.lframework.starter.web.core.controller.DefaultBaseController; | ||
| 10 | +import com.lframework.starter.web.core.utils.PageResultUtil; | ||
| 11 | +import com.lframework.xingyun.basedata.bo.company.GetCompanyShortBo; | ||
| 12 | +import com.lframework.xingyun.basedata.bo.company.QueryCompanyShortBo; | ||
| 13 | +import com.lframework.xingyun.basedata.entity.CompanyShort; | ||
| 14 | +import com.lframework.xingyun.basedata.service.company.CompanyShortService; | ||
| 15 | +import com.lframework.xingyun.basedata.vo.company.CreateCompanyShortVo; | ||
| 16 | +import com.lframework.xingyun.basedata.vo.company.QueryCompanyShortVo; | ||
| 17 | +import com.lframework.xingyun.basedata.vo.company.UpdateCompanyShortVo; | ||
| 18 | +import io.swagger.annotations.Api; | ||
| 19 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 20 | +import io.swagger.annotations.ApiOperation; | ||
| 21 | +import java.util.List; | ||
| 22 | +import java.util.stream.Collectors; | ||
| 23 | +import javax.annotation.Resource; | ||
| 24 | +import javax.validation.Valid; | ||
| 25 | +import javax.validation.constraints.NotBlank; | ||
| 26 | +import org.springframework.validation.annotation.Validated; | ||
| 27 | +import org.springframework.web.bind.annotation.*; | ||
| 28 | + | ||
| 29 | +@Api(tags = "公司简称") | ||
| 30 | +@Validated | ||
| 31 | +@RestController | ||
| 32 | +@RequestMapping("/basedata/company/short") | ||
| 33 | +public class CompanyShortController extends DefaultBaseController { | ||
| 34 | + | ||
| 35 | + @Resource | ||
| 36 | + private CompanyShortService companyShortService; | ||
| 37 | + | ||
| 38 | + @ApiOperation("公司简称列表") | ||
| 39 | + @HasPermission({"base-data:company-short:query"}) | ||
| 40 | + @GetMapping("/query") | ||
| 41 | + public InvokeResult<PageResult<QueryCompanyShortBo>> query(@Valid QueryCompanyShortVo vo) { | ||
| 42 | + | ||
| 43 | + PageResult<CompanyShort> pageResult = companyShortService.query(getPageIndex(vo), | ||
| 44 | + getPageSize(vo), vo); | ||
| 45 | + | ||
| 46 | + List<CompanyShort> datas = pageResult.getDatas(); | ||
| 47 | + List<QueryCompanyShortBo> results = null; | ||
| 48 | + | ||
| 49 | + if (!CollectionUtil.isEmpty(datas)) { | ||
| 50 | + results = datas.stream().map(QueryCompanyShortBo::new).collect(Collectors.toList()); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @ApiOperation("查询公司简称") | ||
| 57 | + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) | ||
| 58 | + @HasPermission({"base-data:company-short:query"}) | ||
| 59 | + @GetMapping | ||
| 60 | + public InvokeResult<GetCompanyShortBo> get(@NotBlank(message = "ID不能为空!") String id) { | ||
| 61 | + | ||
| 62 | + CompanyShort data = companyShortService.findById(id); | ||
| 63 | + if (data == null) { | ||
| 64 | + throw new DefaultClientException("公司简称不存在!"); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + return InvokeResultBuilder.success(new GetCompanyShortBo(data)); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @ApiOperation("新增公司简称") | ||
| 71 | + @HasPermission({"base-data:company-short:add"}) | ||
| 72 | + @PostMapping | ||
| 73 | + public InvokeResult<Void> create(@Valid @RequestBody CreateCompanyShortVo vo) { | ||
| 74 | + | ||
| 75 | + companyShortService.create(vo); | ||
| 76 | + return InvokeResultBuilder.success(); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + @ApiOperation("修改公司简称") | ||
| 80 | + @HasPermission({"base-data:company-short:modify"}) | ||
| 81 | + @PutMapping | ||
| 82 | + public InvokeResult<Void> update(@Valid @RequestBody UpdateCompanyShortVo vo) { | ||
| 83 | + | ||
| 84 | + companyShortService.update(vo); | ||
| 85 | + return InvokeResultBuilder.success(); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + @ApiOperation("删除公司简称") | ||
| 89 | + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) | ||
| 90 | + @HasPermission({"base-data:company-short:delete"}) | ||
| 91 | + @DeleteMapping | ||
| 92 | + public InvokeResult<Void> deleteById(@NotBlank(message = "ID不能为空!") String id) { | ||
| 93 | + | ||
| 94 | + companyShortService.deleteById(id); | ||
| 95 | + return InvokeResultBuilder.success(); | ||
| 96 | + } | ||
| 97 | +} | ||
| 98 | + |
| 1 | +package com.lframework.xingyun.basedata.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import com.lframework.starter.web.core.dto.BaseDto; | ||
| 7 | +import com.lframework.starter.web.core.entity.BaseEntity; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * <p> | ||
| 13 | + * 公司简称 | ||
| 14 | + * </p> | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | +@Data | ||
| 18 | +@TableName("base_data_company_short") | ||
| 19 | +public class CompanyShort extends BaseEntity implements BaseDto { | ||
| 20 | + | ||
| 21 | + private static final long serialVersionUID = 1L; | ||
| 22 | + | ||
| 23 | + public static final String CACHE_NAME = "CompanyShort"; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * ID | ||
| 27 | + */ | ||
| 28 | + private String id; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 公司名称 | ||
| 32 | + */ | ||
| 33 | + private String companyName; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 公司简称 | ||
| 37 | + */ | ||
| 38 | + private String shortName; | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 创建人ID | ||
| 42 | + */ | ||
| 43 | + @TableField(fill = FieldFill.INSERT) | ||
| 44 | + private String createById; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 更新人ID | ||
| 48 | + */ | ||
| 49 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 50 | + private String updateById; | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 创建时间 | ||
| 54 | + */ | ||
| 55 | + @TableField(fill = FieldFill.INSERT) | ||
| 56 | + private LocalDateTime createTime; | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * 更新时间 | ||
| 60 | + */ | ||
| 61 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 62 | + private LocalDateTime updateTime; | ||
| 63 | +} | ||
| 64 | + |
| 1 | +package com.lframework.xingyun.basedata.impl.company; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
| 4 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||
| 5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
| 6 | +import com.github.pagehelper.PageInfo; | ||
| 7 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | ||
| 8 | +import com.lframework.starter.common.utils.Assert; | ||
| 9 | +import com.lframework.starter.common.utils.ObjectUtil; | ||
| 10 | +import com.lframework.starter.common.utils.StringUtil; | ||
| 11 | +import com.lframework.starter.web.core.annotations.oplog.OpLog; | ||
| 12 | +import com.lframework.starter.web.core.components.resp.PageResult; | ||
| 13 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | ||
| 14 | +import com.lframework.starter.web.core.utils.IdUtil; | ||
| 15 | +import com.lframework.starter.web.core.utils.OpLogUtil; | ||
| 16 | +import com.lframework.starter.web.core.utils.PageHelperUtil; | ||
| 17 | +import com.lframework.starter.web.core.utils.PageResultUtil; | ||
| 18 | +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | ||
| 19 | +import com.lframework.xingyun.basedata.entity.CompanyShort; | ||
| 20 | +import com.lframework.xingyun.basedata.mappers.CompanyShortMapper; | ||
| 21 | +import com.lframework.xingyun.basedata.service.company.CompanyShortService; | ||
| 22 | +import com.lframework.xingyun.basedata.vo.company.CreateCompanyShortVo; | ||
| 23 | +import com.lframework.xingyun.basedata.vo.company.QueryCompanyShortVo; | ||
| 24 | +import com.lframework.xingyun.basedata.vo.company.UpdateCompanyShortVo; | ||
| 25 | +import java.util.List; | ||
| 26 | +import org.springframework.stereotype.Service; | ||
| 27 | +import org.springframework.transaction.annotation.Transactional; | ||
| 28 | + | ||
| 29 | +@Service | ||
| 30 | +public class CompanyShortServiceImpl extends BaseMpServiceImpl<CompanyShortMapper, CompanyShort> | ||
| 31 | + implements CompanyShortService { | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + public PageResult<CompanyShort> query(Integer pageIndex, Integer pageSize, QueryCompanyShortVo vo) { | ||
| 35 | + | ||
| 36 | + Assert.greaterThanZero(pageIndex); | ||
| 37 | + Assert.greaterThanZero(pageSize); | ||
| 38 | + | ||
| 39 | + PageHelperUtil.startPage(pageIndex, pageSize); | ||
| 40 | + List<CompanyShort> datas = this.query(vo); | ||
| 41 | + | ||
| 42 | + return PageResultUtil.convert(new PageInfo<>(datas)); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @Override | ||
| 46 | + public List<CompanyShort> query(QueryCompanyShortVo vo) { | ||
| 47 | + | ||
| 48 | + return getBaseMapper().query(vo); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @Override | ||
| 52 | + public CompanyShort findById(String id) { | ||
| 53 | + | ||
| 54 | + return getBaseMapper().selectById(id); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @OpLog(type = OtherOpLogType.class, name = "新增公司简称,ID:{}", params = {"#id"}) | ||
| 58 | + @Transactional(rollbackFor = Exception.class) | ||
| 59 | + @Override | ||
| 60 | + public String create(CreateCompanyShortVo vo) { | ||
| 61 | + | ||
| 62 | + CompanyShort exist = getByCompanyName(vo.getCompanyName()); | ||
| 63 | + if (!ObjectUtil.isNull(exist)) { | ||
| 64 | + throw new DefaultClientException("公司名称已存在简称,请勿重复添加!"); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + CompanyShort data = new CompanyShort(); | ||
| 68 | + data.setId(IdUtil.getId()); | ||
| 69 | + data.setCompanyName(vo.getCompanyName()); | ||
| 70 | + data.setShortName(vo.getShortName()); | ||
| 71 | + | ||
| 72 | + getBaseMapper().insert(data); | ||
| 73 | + | ||
| 74 | + OpLogUtil.setVariable("id", data.getId()); | ||
| 75 | + OpLogUtil.setExtra(vo); | ||
| 76 | + | ||
| 77 | + return data.getId(); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @OpLog(type = OtherOpLogType.class, name = "修改公司简称,ID:{}", params = {"#id"}) | ||
| 81 | + @Transactional(rollbackFor = Exception.class) | ||
| 82 | + @Override | ||
| 83 | + public void update(UpdateCompanyShortVo vo) { | ||
| 84 | + | ||
| 85 | + CompanyShort data = getBaseMapper().selectById(vo.getId()); | ||
| 86 | + if (ObjectUtil.isNull(data)) { | ||
| 87 | + throw new DefaultClientException("公司简称不存在!"); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + CompanyShort exist = getByCompanyName(vo.getCompanyName()); | ||
| 91 | + if (!ObjectUtil.isNull(exist) && !vo.getId().equals(exist.getId())) { | ||
| 92 | + throw new DefaultClientException("公司名称已存在简称,请勿重复添加!"); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + LambdaUpdateWrapper<CompanyShort> updateWrapper = Wrappers.lambdaUpdate(CompanyShort.class) | ||
| 96 | + .set(CompanyShort::getCompanyName, vo.getCompanyName()) | ||
| 97 | + .set(CompanyShort::getShortName, vo.getShortName()) | ||
| 98 | + .eq(CompanyShort::getId, vo.getId()); | ||
| 99 | + getBaseMapper().update(updateWrapper); | ||
| 100 | + | ||
| 101 | + OpLogUtil.setVariable("id", data.getId()); | ||
| 102 | + OpLogUtil.setExtra(vo); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + @OpLog(type = OtherOpLogType.class, name = "删除公司简称,ID:{}", params = {"#id"}) | ||
| 106 | + @Transactional(rollbackFor = Exception.class) | ||
| 107 | + @Override | ||
| 108 | + public void deleteById(String id) { | ||
| 109 | + | ||
| 110 | + getBaseMapper().deleteById(id); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + private CompanyShort getByCompanyName(String companyName) { | ||
| 114 | + | ||
| 115 | + if (StringUtil.isBlank(companyName)) { | ||
| 116 | + return null; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + LambdaQueryWrapper<CompanyShort> queryWrapper = Wrappers.lambdaQuery(CompanyShort.class) | ||
| 120 | + .eq(CompanyShort::getCompanyName, companyName); | ||
| 121 | + | ||
| 122 | + return getBaseMapper().selectOne(queryWrapper); | ||
| 123 | + } | ||
| 124 | +} | ||
| 125 | + |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/CompanyShortMapper.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.mappers; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | ||
| 4 | +import com.lframework.xingyun.basedata.entity.CompanyShort; | ||
| 5 | +import com.lframework.xingyun.basedata.vo.company.QueryCompanyShortVo; | ||
| 6 | +import java.util.List; | ||
| 7 | +import org.apache.ibatis.annotations.Param; | ||
| 8 | + | ||
| 9 | +public interface CompanyShortMapper extends BaseMapper<CompanyShort> { | ||
| 10 | + | ||
| 11 | + List<CompanyShort> query(@Param("vo") QueryCompanyShortVo vo); | ||
| 12 | +} | ||
| 13 | + |
| 1 | +package com.lframework.xingyun.basedata.service.company; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.components.resp.PageResult; | ||
| 4 | +import com.lframework.starter.web.core.service.BaseMpService; | ||
| 5 | +import com.lframework.xingyun.basedata.entity.CompanyShort; | ||
| 6 | +import com.lframework.xingyun.basedata.vo.company.CreateCompanyShortVo; | ||
| 7 | +import com.lframework.xingyun.basedata.vo.company.QueryCompanyShortVo; | ||
| 8 | +import com.lframework.xingyun.basedata.vo.company.UpdateCompanyShortVo; | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +public interface CompanyShortService extends BaseMpService<CompanyShort> { | ||
| 12 | + | ||
| 13 | + PageResult<CompanyShort> query(Integer pageIndex, Integer pageSize, QueryCompanyShortVo vo); | ||
| 14 | + | ||
| 15 | + List<CompanyShort> query(QueryCompanyShortVo vo); | ||
| 16 | + | ||
| 17 | + CompanyShort findById(String id); | ||
| 18 | + | ||
| 19 | + String create(CreateCompanyShortVo vo); | ||
| 20 | + | ||
| 21 | + void update(UpdateCompanyShortVo vo); | ||
| 22 | + | ||
| 23 | + void deleteById(String id); | ||
| 24 | +} | ||
| 25 | + |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/company/CreateCompanyShortVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.vo.company; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | +import java.io.Serializable; | ||
| 6 | +import javax.validation.constraints.NotBlank; | ||
| 7 | +import lombok.Data; | ||
| 8 | +import org.hibernate.validator.constraints.Length; | ||
| 9 | + | ||
| 10 | +@Data | ||
| 11 | +public class CreateCompanyShortVo implements BaseVo, Serializable { | ||
| 12 | + | ||
| 13 | + private static final long serialVersionUID = 1L; | ||
| 14 | + | ||
| 15 | + @ApiModelProperty(value = "公司名称", required = true) | ||
| 16 | + @NotBlank(message = "公司名称不能为空!") | ||
| 17 | + @Length(max = 200, message = "公司名称最多允许200个字符!") | ||
| 18 | + private String companyName; | ||
| 19 | + | ||
| 20 | + @ApiModelProperty(value = "公司简称", required = true) | ||
| 21 | + @NotBlank(message = "公司简称不能为空!") | ||
| 22 | + @Length(max = 100, message = "公司简称最多允许100个字符!") | ||
| 23 | + private String shortName; | ||
| 24 | +} | ||
| 25 | + |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/company/QueryCompanyShortVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.vo.company; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 4 | +import com.lframework.starter.web.core.vo.PageVo; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import java.io.Serializable; | ||
| 7 | +import lombok.Data; | ||
| 8 | + | ||
| 9 | +@Data | ||
| 10 | +public class QueryCompanyShortVo extends PageVo implements BaseVo, Serializable { | ||
| 11 | + | ||
| 12 | + private static final long serialVersionUID = 1L; | ||
| 13 | + | ||
| 14 | + @ApiModelProperty("公司名称") | ||
| 15 | + private String companyName; | ||
| 16 | + | ||
| 17 | + @ApiModelProperty("公司简称") | ||
| 18 | + private String shortName; | ||
| 19 | +} | ||
| 20 | + |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/company/UpdateCompanyShortVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.vo.company; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | +import java.io.Serializable; | ||
| 6 | +import javax.validation.constraints.NotBlank; | ||
| 7 | +import lombok.Data; | ||
| 8 | +import org.hibernate.validator.constraints.Length; | ||
| 9 | + | ||
| 10 | +@Data | ||
| 11 | +public class UpdateCompanyShortVo implements BaseVo, Serializable { | ||
| 12 | + | ||
| 13 | + private static final long serialVersionUID = 1L; | ||
| 14 | + | ||
| 15 | + @ApiModelProperty(value = "ID", required = true) | ||
| 16 | + @NotBlank(message = "ID不能为空!") | ||
| 17 | + private String id; | ||
| 18 | + | ||
| 19 | + @ApiModelProperty(value = "公司名称", required = true) | ||
| 20 | + @NotBlank(message = "公司名称不能为空!") | ||
| 21 | + @Length(max = 200, message = "公司名称最多允许200个字符!") | ||
| 22 | + private String companyName; | ||
| 23 | + | ||
| 24 | + @ApiModelProperty(value = "公司简称", required = true) | ||
| 25 | + @NotBlank(message = "公司简称不能为空!") | ||
| 26 | + @Length(max = 100, message = "公司简称最多允许100个字符!") | ||
| 27 | + private String shortName; | ||
| 28 | +} | ||
| 29 | + |
| 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.CompanyShortMapper"> | ||
| 4 | + | ||
| 5 | + <resultMap id="CompanyShort" type="com.lframework.xingyun.basedata.entity.CompanyShort"> | ||
| 6 | + <id column="id" property="id"/> | ||
| 7 | + <result column="company_name" property="companyName"/> | ||
| 8 | + <result column="short_name" property="shortName"/> | ||
| 9 | + <result column="create_by_id" property="createById"/> | ||
| 10 | + <result column="update_by_id" property="updateById"/> | ||
| 11 | + <result column="create_time" property="createTime"/> | ||
| 12 | + <result column="update_time" property="updateTime"/> | ||
| 13 | + </resultMap> | ||
| 14 | + | ||
| 15 | + <sql id="CompanyShortSql"> | ||
| 16 | + SELECT | ||
| 17 | + tb.id, | ||
| 18 | + tb.company_name, | ||
| 19 | + tb.short_name, | ||
| 20 | + tb.create_by_id, | ||
| 21 | + tb.update_by_id, | ||
| 22 | + tb.create_time, | ||
| 23 | + tb.update_time | ||
| 24 | + FROM base_data_company_short tb | ||
| 25 | + </sql> | ||
| 26 | + | ||
| 27 | + <select id="query" resultMap="CompanyShort"> | ||
| 28 | + <include refid="CompanyShortSql"/> | ||
| 29 | + <where> | ||
| 30 | + <if test="vo.companyName != null and vo.companyName != ''"> | ||
| 31 | + AND tb.company_name LIKE CONCAT('%', #{vo.companyName}, '%') | ||
| 32 | + </if> | ||
| 33 | + <if test="vo.shortName != null and vo.shortName != ''"> | ||
| 34 | + AND tb.short_name LIKE CONCAT('%', #{vo.shortName}, '%') | ||
| 35 | + </if> | ||
| 36 | + </where> | ||
| 37 | + ORDER BY tb.create_time DESC, tb.id DESC | ||
| 38 | + </select> | ||
| 39 | +</mapper> | ||
| 40 | + |