Showing
11 changed files
with
638 additions
and
0 deletions
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/office/GetOfficeBo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.bo.office; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import com.lframework.xingyun.basedata.entity.Office; | ||
| 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 GetOfficeBo extends BaseBo<Office> { | ||
| 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 GetOfficeBo() { | ||
| 72 | + | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public GetOfficeBo(Office dto) { | ||
| 76 | + | ||
| 77 | + super(dto); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @Override | ||
| 81 | + public BaseBo<Office> convert(Office dto) { | ||
| 82 | + return super.convert(dto); | ||
| 83 | + } | ||
| 84 | +} |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/OfficeController.java
0 → 100644
| 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.office.GetOfficeBo; | ||
| 6 | +import com.lframework.xingyun.basedata.vo.office.QueryOfficeVo; | ||
| 7 | +import com.lframework.xingyun.basedata.service.office.OfficeService; | ||
| 8 | +import com.lframework.xingyun.basedata.vo.office.CreateOfficeVo; | ||
| 9 | +import com.lframework.xingyun.basedata.vo.office.UpdateOfficeVo; | ||
| 10 | +import com.lframework.xingyun.basedata.entity.Office; | ||
| 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/office") | ||
| 39 | +public class OfficeController extends DefaultBaseController { | ||
| 40 | + | ||
| 41 | + @Resource | ||
| 42 | + private OfficeService officeService; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 查询列表 | ||
| 46 | + */ | ||
| 47 | + @ApiOperation("查询列表") | ||
| 48 | + @HasPermission({"base-data:office:query"}) | ||
| 49 | + @GetMapping("/query") | ||
| 50 | + public InvokeResult<PageResult<GetOfficeBo>> query(@Valid QueryOfficeVo vo) { | ||
| 51 | + PageResult<Office> pageResult = officeService.query(getPageIndex(vo), getPageSize(vo), vo); | ||
| 52 | + | ||
| 53 | + List<Office> dataList = pageResult.getDatas(); | ||
| 54 | + List<GetOfficeBo> results = null; | ||
| 55 | + if (!CollectionUtil.isEmpty(dataList)) { | ||
| 56 | + results = dataList.stream().map(GetOfficeBo::new).collect(Collectors.toList()); | ||
| 57 | + } | ||
| 58 | + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 根据ID查询 | ||
| 63 | + */ | ||
| 64 | + @ApiOperation("根据ID查询") | ||
| 65 | + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | ||
| 66 | + @HasPermission({"base-data:office:query"}) | ||
| 67 | + @GetMapping | ||
| 68 | + public InvokeResult<GetOfficeBo> get(@NotBlank(message = "id不能为空!") String id) { | ||
| 69 | + Office data = officeService.findById(id); | ||
| 70 | + if (data == null) { | ||
| 71 | + throw new DefaultClientException("办事处/科办不存在!"); | ||
| 72 | + } | ||
| 73 | + GetOfficeBo result = new GetOfficeBo(data); | ||
| 74 | + | ||
| 75 | + return InvokeResultBuilder.success(result); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 新增 | ||
| 80 | + */ | ||
| 81 | + @ApiOperation("新增") | ||
| 82 | + @HasPermission({"base-data:office:add"}) | ||
| 83 | + @PostMapping | ||
| 84 | + public InvokeResult<Void> create(@Valid CreateOfficeVo vo) { | ||
| 85 | + officeService.create(vo); | ||
| 86 | + return InvokeResultBuilder.success(); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 修改 | ||
| 91 | + */ | ||
| 92 | + @ApiOperation("修改") | ||
| 93 | + @HasPermission({"base-data:office:modify"}) | ||
| 94 | + @PutMapping | ||
| 95 | + public InvokeResult<Void> update(@Valid UpdateOfficeVo vo) { | ||
| 96 | + officeService.update(vo); | ||
| 97 | + return InvokeResultBuilder.success(); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + /** | ||
| 101 | + * 根据ID删除 | ||
| 102 | + */ | ||
| 103 | + @ApiOperation("根据ID删除") | ||
| 104 | + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | ||
| 105 | + @HasPermission({"base-data:office:delete"}) | ||
| 106 | + @DeleteMapping | ||
| 107 | + public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) { | ||
| 108 | + officeService.deleteById(id); | ||
| 109 | + return InvokeResultBuilder.success(); | ||
| 110 | + } | ||
| 111 | +} |
| 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_office") | ||
| 19 | +public class Office extends BaseEntity implements BaseDto { | ||
| 20 | + | ||
| 21 | + private static final long serialVersionUID = 1L; | ||
| 22 | + | ||
| 23 | + public static final String CACHE_NAME = "Office"; | ||
| 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 | +} |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/office/OfficeServiceImpl.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.impl.office; | ||
| 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.Office; | ||
| 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.OfficeMapper; | ||
| 21 | +import com.lframework.xingyun.basedata.service.office.OfficeService; | ||
| 22 | +import com.lframework.xingyun.basedata.vo.office.CreateOfficeVo; | ||
| 23 | +import com.lframework.xingyun.basedata.vo.office.QueryOfficeVo; | ||
| 24 | +import com.lframework.xingyun.basedata.vo.office.UpdateOfficeVo; | ||
| 25 | +import org.springframework.stereotype.Service; | ||
| 26 | + | ||
| 27 | +import java.util.List; | ||
| 28 | + | ||
| 29 | +@Service | ||
| 30 | +public class OfficeServiceImpl extends BaseMpServiceImpl<OfficeMapper, Office> implements OfficeService { | ||
| 31 | + | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 分页查询 | ||
| 35 | + * | ||
| 36 | + * @param pageIndex 页码 | ||
| 37 | + * @param pageSize 分页大小 | ||
| 38 | + * @param vo 查询条件 | ||
| 39 | + * @return PageResult<Office> | ||
| 40 | + */ | ||
| 41 | + @Override | ||
| 42 | + public PageResult<Office> query(Integer pageIndex, Integer pageSize, QueryOfficeVo vo) { | ||
| 43 | + Assert.greaterThanZero(pageIndex); | ||
| 44 | + Assert.greaterThanZero(pageSize); | ||
| 45 | + | ||
| 46 | + PageHelperUtil.startPage(pageIndex, pageSize); | ||
| 47 | + List<Office> dataList = this.query(vo); | ||
| 48 | + return PageResultUtil.convert(new PageInfo<>(dataList)); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * 根据条件查询 | ||
| 53 | + * | ||
| 54 | + * @param vo 查询条件 | ||
| 55 | + * @return List<Office> | ||
| 56 | + */ | ||
| 57 | + @Override | ||
| 58 | + public List<Office> query(QueryOfficeVo vo) { | ||
| 59 | + return getBaseMapper().query(vo); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 根据主键ID查询 | ||
| 64 | + * | ||
| 65 | + * @param id 主键ID | ||
| 66 | + * @return Office | ||
| 67 | + */ | ||
| 68 | + @Override | ||
| 69 | + public Office findById(String id) { | ||
| 70 | + return getBaseMapper().selectById(id); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * 新增 | ||
| 75 | + * | ||
| 76 | + * @param vo 数据实体 | ||
| 77 | + * @return String | ||
| 78 | + */ | ||
| 79 | + @OpLog(type = OtherOpLogType.class, name = "新增办事处/科办,ID:{}", params = {"#id"}) | ||
| 80 | + @Transactional(rollbackFor = Exception.class) | ||
| 81 | + @Override | ||
| 82 | + public String create(CreateOfficeVo vo) { | ||
| 83 | + Office data = new Office(); | ||
| 84 | + data.setId(IdUtil.getId()); | ||
| 85 | + data.setCode(vo.getCode()); | ||
| 86 | + data.setName(vo.getName()); | ||
| 87 | + if (!StringUtil.isBlank(vo.getDescription())) { | ||
| 88 | + data.setDescription(vo.getDescription()); | ||
| 89 | + } | ||
| 90 | + getBaseMapper().insert(data); | ||
| 91 | + OpLogUtil.setVariable("id", data.getId()); | ||
| 92 | + OpLogUtil.setExtra(vo); | ||
| 93 | + | ||
| 94 | + return data.getId(); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * 修改 | ||
| 99 | + * | ||
| 100 | + * @param vo 数据实体 | ||
| 101 | + */ | ||
| 102 | + @OpLog(type = OtherOpLogType.class, name = "修改办事处/科办,ID:{}", params = {"#id"}) | ||
| 103 | + @Transactional(rollbackFor = Exception.class) | ||
| 104 | + @Override | ||
| 105 | + public void update(UpdateOfficeVo vo) { | ||
| 106 | + Office data = getBaseMapper().selectById(vo.getId()); | ||
| 107 | + if (ObjectUtil.isNull(data)) { | ||
| 108 | + throw new DefaultClientException("办事处/科办不存在!"); | ||
| 109 | + } | ||
| 110 | + LambdaUpdateWrapper<Office> updateWrapper = Wrappers.lambdaUpdate(Office.class) | ||
| 111 | + .set(Office::getCode, data.getCode()) | ||
| 112 | + .set(Office::getName, vo.getName()) | ||
| 113 | + .set(Office::getDescription, StringUtil.isBlank(vo.getDescription()) ? null : vo.getDescription()) | ||
| 114 | + .eq(Office::getId, vo.getId()); | ||
| 115 | + getBaseMapper().update(updateWrapper); | ||
| 116 | + OpLogUtil.setVariable("id", data.getId()); | ||
| 117 | + OpLogUtil.setExtra(vo); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + /** | ||
| 121 | + * 删除 | ||
| 122 | + * | ||
| 123 | + * @param id 主键ID | ||
| 124 | + */ | ||
| 125 | + @OpLog(type = OtherOpLogType.class, name = "删除办事处/科办,ID:{}", params = {"#id"}) | ||
| 126 | + @Transactional(rollbackFor = Exception.class) | ||
| 127 | + @Override | ||
| 128 | + public void deleteById(String id) { | ||
| 129 | + getBaseMapper().deleteById(id); | ||
| 130 | + } | ||
| 131 | +} |
| @@ -108,6 +108,7 @@ public class WorkshopServiceImpl extends BaseMpServiceImpl<WorkshopMapper, Works | @@ -108,6 +108,7 @@ public class WorkshopServiceImpl extends BaseMpServiceImpl<WorkshopMapper, Works | ||
| 108 | LambdaUpdateWrapper<Workshop> updateWrapper = Wrappers.lambdaUpdate(Workshop.class) | 108 | LambdaUpdateWrapper<Workshop> updateWrapper = Wrappers.lambdaUpdate(Workshop.class) |
| 109 | .set(Workshop::getCode, data.getCode()) | 109 | .set(Workshop::getCode, data.getCode()) |
| 110 | .set(Workshop::getName, vo.getName()) | 110 | .set(Workshop::getName, vo.getName()) |
| 111 | + .set(Workshop::getDescription, vo.getDescription()) | ||
| 111 | .set(Workshop::getType, EnumUtil.getByCode(WorkshopType.class, data.getType())) | 112 | .set(Workshop::getType, EnumUtil.getByCode(WorkshopType.class, data.getType())) |
| 112 | .eq(Workshop::getId, vo.getId()); | 113 | .eq(Workshop::getId, vo.getId()); |
| 113 | getBaseMapper().update(updateWrapper); | 114 | getBaseMapper().update(updateWrapper); |
| 1 | +package com.lframework.xingyun.basedata.mappers; | ||
| 2 | + | ||
| 3 | +import com.lframework.xingyun.basedata.entity.Office; | ||
| 4 | +import com.lframework.starter.web.core.mapper.BaseMapper; | ||
| 5 | +import com.lframework.xingyun.basedata.vo.office.QueryOfficeVo; | ||
| 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 OfficeMapper extends BaseMapper<Office> { | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 查询列表 | ||
| 20 | + * | ||
| 21 | + * @param vo 查询参数 | ||
| 22 | + * @return List<Office> | ||
| 23 | + */ | ||
| 24 | + List<Office> query(@Param("vo") QueryOfficeVo vo); | ||
| 25 | +} |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/office/OfficeService.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.service.office; | ||
| 2 | + | ||
| 3 | +import com.lframework.xingyun.basedata.vo.office.CreateOfficeVo; | ||
| 4 | +import com.lframework.xingyun.basedata.vo.office.QueryOfficeVo; | ||
| 5 | +import com.lframework.xingyun.basedata.vo.office.UpdateOfficeVo; | ||
| 6 | +import com.lframework.xingyun.basedata.entity.Office; | ||
| 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 OfficeService extends BaseMpService<Office> { | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 查询列表 | ||
| 18 | + * | ||
| 19 | + * @return PageResult<Office> | ||
| 20 | + */ | ||
| 21 | + PageResult<Office> query(Integer pageIndex, Integer pageSize, QueryOfficeVo vo); | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 查询列表 | ||
| 25 | + * | ||
| 26 | + * @param vo 查询条件 | ||
| 27 | + * @return List<Office> | ||
| 28 | + */ | ||
| 29 | + List<Office> query(QueryOfficeVo vo); | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 根据ID查询 | ||
| 33 | + * | ||
| 34 | + * @param id 主键ID | ||
| 35 | + * @return Office | ||
| 36 | + */ | ||
| 37 | + Office findById(String id); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 创建 | ||
| 41 | + * | ||
| 42 | + * @param vo 数据实体 | ||
| 43 | + * @return String | ||
| 44 | + */ | ||
| 45 | + String create(CreateOfficeVo vo); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 修改 | ||
| 49 | + * | ||
| 50 | + * @param vo 数据实体 | ||
| 51 | + */ | ||
| 52 | + void update(UpdateOfficeVo vo); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 根据ID删除 | ||
| 56 | + * | ||
| 57 | + * @param id 主键ID | ||
| 58 | + */ | ||
| 59 | + void deleteById(String id); | ||
| 60 | +} |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/office/CreateOfficeVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.vo.office; | ||
| 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 CreateOfficeVo 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 | +} |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/office/QueryOfficeVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.vo.office; | ||
| 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 | +import java.io.Serializable; | ||
| 8 | + | ||
| 9 | +@Data | ||
| 10 | +public class QueryOfficeVo extends PageVo implements BaseVo, Serializable { | ||
| 11 | + | ||
| 12 | + private static final long serialVersionUID = 1L; | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 编号 | ||
| 16 | + */ | ||
| 17 | + @ApiModelProperty("编号") | ||
| 18 | + private String code; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 名称 | ||
| 22 | + */ | ||
| 23 | + @ApiModelProperty("名称") | ||
| 24 | + private String name; | ||
| 25 | + | ||
| 26 | +} |
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/office/UpdateOfficeVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.vo.office; | ||
| 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 UpdateOfficeVo 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.OfficeMapper"> | ||
| 4 | + | ||
| 5 | + <resultMap id="Office" type="com.lframework.xingyun.basedata.entity.Office"> | ||
| 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="Office_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_office AS tb | ||
| 31 | + </sql> | ||
| 32 | + | ||
| 33 | + <select id="query" resultMap="Office"> | ||
| 34 | + <include refid="Office_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> |