分段查询
parent
36030c1466
commit
b012279858
@ -0,0 +1,72 @@
|
||||
package com.docus.server.api.segmentation;
|
||||
|
||||
import com.docus.server.dto.segmentation.zdassort.AddZdAssortDTO;
|
||||
import com.docus.server.dto.segmentation.zdassort.EditZdAssortDTO;
|
||||
import com.docus.server.dto.segmentation.zdassort.DeleteZdAssortDTO;
|
||||
import com.docus.server.vo.segmentation.zdassort.ZdAssortVO;
|
||||
import com.docus.server.entity.segmentation.ZdAssort;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import com.docus.infrastructure.web.request.SearchDTO;
|
||||
import com.docus.infrastructure.web.response.PageResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 病案分类 API
|
||||
*
|
||||
* @author AutoGenerator
|
||||
* @since 2023-08-30
|
||||
*/
|
||||
@FeignClient(value = "docus-segmentation", contextId = "docus-segmentation.ZdAssortApi")
|
||||
@RequestMapping("/zdAssort")
|
||||
public interface ZdAssortApi {
|
||||
|
||||
/**
|
||||
* 按主键查询
|
||||
* @param id 主键id
|
||||
* @return 实体
|
||||
*/
|
||||
@GetMapping("/find/{id}")
|
||||
ZdAssortVO findById(@PathVariable(value = "id") Long id);
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
* @return 实体
|
||||
*/
|
||||
@GetMapping("/findAll")
|
||||
List<ZdAssortVO> findAll();
|
||||
|
||||
/**
|
||||
* 关键字搜索
|
||||
* @param searchDTO 搜索参数
|
||||
* @return 分页列表
|
||||
*/
|
||||
@PostMapping("/search")
|
||||
PageResult<ZdAssortVO> search(@RequestBody SearchDTO searchDTO);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param addZdAssortDTO 新增参数
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
void add(@RequestBody AddZdAssortDTO addZdAssortDTO);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param editZdAssortDTO 编辑参数
|
||||
*/
|
||||
@PutMapping("/edit")
|
||||
void edit(@RequestBody EditZdAssortDTO editZdAssortDTO);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param deleteZdAssortDTO 删除参数
|
||||
* @return 成功或失败
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
int delete(@RequestBody DeleteZdAssortDTO deleteZdAssortDTO);
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.docus.server.dto.segmentation.zdassort;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import com.docus.server.enums.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 病案分类 DeleteDTO
|
||||
*
|
||||
* @author AutoGenerator
|
||||
* @since 2023-08-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value="DeleteZdAssortDTO对象", description="病案分类")
|
||||
public class DeleteZdAssortDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "ids")
|
||||
private List<Long> ids;
|
||||
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.docus.server.controller;
|
||||
|
||||
import com.docus.server.dto.segmentation.zdassort.AddZdAssortDTO;
|
||||
import com.docus.server.dto.segmentation.zdassort.EditZdAssortDTO;
|
||||
import com.docus.server.dto.segmentation.zdassort.DeleteZdAssortDTO;
|
||||
import com.docus.server.vo.segmentation.zdassort.ZdAssortVO;
|
||||
import com.docus.server.entity.segmentation.ZdAssort;
|
||||
import com.docus.server.api.segmentation.ZdAssortApi;
|
||||
import com.docus.infrastructure.web.request.SearchDTO;
|
||||
import com.docus.infrastructure.web.response.PageResult;
|
||||
import com.docus.server.service.IZdAssortService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 病案分类 控制器类
|
||||
*
|
||||
* @author AutoGenerator
|
||||
* @since 2023-08-30
|
||||
*/
|
||||
@Api(value = "病案分类", tags = "病案分类")
|
||||
@RestController
|
||||
public class ZdAssortController implements ZdAssortApi {
|
||||
@Resource
|
||||
private IZdAssortService iZdAssortService;
|
||||
/**
|
||||
*按主键查询
|
||||
* @param id 主键Id
|
||||
* @return 实体
|
||||
*/
|
||||
@ApiOperation("按主键查询")
|
||||
@Override
|
||||
public ZdAssortVO findById(Long id) {
|
||||
return iZdAssortService.findById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
*查询所有
|
||||
* @return 实体
|
||||
*/
|
||||
@ApiOperation("查询所有")
|
||||
@Override
|
||||
public List<ZdAssortVO> findAll() {
|
||||
return iZdAssortService.findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关键字搜索
|
||||
* @param searchDTO 搜索参数
|
||||
* @return 分页列表
|
||||
*/
|
||||
@ApiOperation("关键字搜索")
|
||||
@Override
|
||||
public PageResult<ZdAssortVO> search(SearchDTO searchDTO) {
|
||||
return iZdAssortService.search(searchDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param addZdAssortDTO 编辑参数
|
||||
*/
|
||||
@ApiOperation("新增")
|
||||
@Override
|
||||
public void add(AddZdAssortDTO addZdAssortDTO) {
|
||||
iZdAssortService.add(addZdAssortDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param editZdAssortDTO 编辑参数
|
||||
*/
|
||||
@ApiOperation("编辑")
|
||||
@Override
|
||||
public void edit(EditZdAssortDTO editZdAssortDTO) {
|
||||
iZdAssortService.edit(editZdAssortDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param deleteZdAssortDTO 删除参数
|
||||
* @return 成功或失败
|
||||
*/
|
||||
@ApiOperation("批量删除")
|
||||
@Override
|
||||
public int delete(DeleteZdAssortDTO deleteZdAssortDTO) {
|
||||
return iZdAssortService.delete(deleteZdAssortDTO);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.docus.server.convert;
|
||||
|
||||
import com.docus.infrastructure.web.response.PageResult;
|
||||
import com.docus.server.entity.segmentation.ZdAssort;
|
||||
import com.docus.server.dto.segmentation.zdassort.AddZdAssortDTO;
|
||||
import com.docus.server.dto.segmentation.zdassort.EditZdAssortDTO;
|
||||
import com.docus.server.dto.segmentation.zdassort.DeleteZdAssortDTO;
|
||||
import com.docus.server.vo.segmentation.zdassort.ZdAssortVO;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 病案分类 服务转换器
|
||||
*
|
||||
* @author AutoGenerator
|
||||
* @since 2023-08-30
|
||||
*/
|
||||
@Mapper
|
||||
public interface ZdAssortConvert {
|
||||
|
||||
ZdAssortConvert INSTANCE = Mappers.getMapper(ZdAssortConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
ZdAssort convertDO(AddZdAssortDTO addZdAssortDTO);
|
||||
|
||||
@Mappings({})
|
||||
ZdAssort convertDO(EditZdAssortDTO editZdAssortDTO);
|
||||
|
||||
@Mappings({})
|
||||
List<ZdAssort> convertAddDOList(List<AddZdAssortDTO> addZdAssortDTO);
|
||||
|
||||
@Mappings({})
|
||||
List<ZdAssort> convertEditDOList(List<EditZdAssortDTO> editZdAssortDTO);
|
||||
|
||||
@Mappings({})
|
||||
ZdAssortVO convertVO(ZdAssort zdAssort);
|
||||
|
||||
@Mappings({})
|
||||
List<ZdAssortVO> convertVO(List<ZdAssort> zdAssortList);
|
||||
|
||||
@Mappings({})
|
||||
PageResult<ZdAssortVO> convertVO(PageResult<ZdAssort> pageResult);
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
package com.docus.server.infrastructure.dao;
|
||||
import com.docus.server.entity.segmentation.ZdAssort;
|
||||
import com.docus.infrastructure.core.db.dao.IBaseDao;
|
||||
import com.docus.infrastructure.web.request.SearchDTO;
|
||||
import com.docus.infrastructure.web.response.PageResult;
|
||||
import java.util.List;
|
||||
/**
|
||||
*
|
||||
* 病案分类 数据访问接口
|
||||
*
|
||||
* @author AutoGenerator
|
||||
* @since 2023-08-30
|
||||
*/
|
||||
public interface IZdAssortDao extends IBaseDao<ZdAssort> {
|
||||
/**
|
||||
* 按主键查询
|
||||
* @param id 主键id
|
||||
* @return 实体
|
||||
*/
|
||||
ZdAssort findById(Long id);
|
||||
/**
|
||||
* 新增
|
||||
* @param zdAssort 新增参数
|
||||
* @return 成功或失败
|
||||
*/
|
||||
boolean add(ZdAssort zdAssort);
|
||||
/**
|
||||
* 编辑
|
||||
* @param zdAssort 编辑参数
|
||||
* @return 成功或失败
|
||||
*/
|
||||
boolean edit(ZdAssort zdAssort);
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids 主键ids
|
||||
* @return 成功或失败
|
||||
*/
|
||||
int delete(List<Long> ids);
|
||||
/**
|
||||
* 关键字搜索
|
||||
* @param searchDTO 搜索参数
|
||||
* @return 分页列表
|
||||
*/
|
||||
PageResult<ZdAssort> search(SearchDTO searchDTO);
|
||||
/**
|
||||
* 名称不重复
|
||||
* @param id 主键
|
||||
* @param name 名称
|
||||
* @return 名称重复数量
|
||||
*/
|
||||
int findByIdAndName(Long id, String name);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.docus.server.infrastructure.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.docus.server.entity.segmentation.ZdAssort;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* 病案分类 Mapper 接口
|
||||
*
|
||||
* @author AutoGenerator
|
||||
* @since 2023-08-30
|
||||
*/
|
||||
@Mapper
|
||||
@DS("archive")
|
||||
public interface ZdAssortMapper extends BaseMapper<ZdAssort> {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.docus.server.service;
|
||||
|
||||
import com.docus.server.dto.segmentation.zdassort.AddZdAssortDTO;
|
||||
import com.docus.server.dto.segmentation.zdassort.EditZdAssortDTO;
|
||||
import com.docus.server.dto.segmentation.zdassort.DeleteZdAssortDTO;
|
||||
import com.docus.server.vo.segmentation.zdassort.ZdAssortVO;
|
||||
import com.docus.server.entity.segmentation.ZdAssort;
|
||||
|
||||
import com.docus.infrastructure.web.request.SearchDTO;
|
||||
import com.docus.infrastructure.web.response.PageResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 病案分类 服务接口
|
||||
*
|
||||
* @author AutoGenerator
|
||||
* @since 2023-08-30
|
||||
*/
|
||||
public interface IZdAssortService {
|
||||
/**
|
||||
* 按主键查询
|
||||
* @param id 主键id
|
||||
* @return 实体
|
||||
*/
|
||||
ZdAssortVO findById(Long id);
|
||||
/**
|
||||
* 查询所有
|
||||
* @return 实体
|
||||
*/
|
||||
List<ZdAssortVO> findAll();
|
||||
/**
|
||||
* 新增
|
||||
* @param addZdAssortDTO 新增参数
|
||||
* @return 成功或失败
|
||||
*/
|
||||
boolean add(AddZdAssortDTO addZdAssortDTO);
|
||||
/**
|
||||
* 编辑
|
||||
* @param editZdAssortDTO 编辑参数
|
||||
* @return 成功或失败
|
||||
*/
|
||||
boolean edit(EditZdAssortDTO editZdAssortDTO);
|
||||
/**
|
||||
* 批量删除
|
||||
* @param deleteZdAssortDTO 删除参数
|
||||
* @return 成功或失败
|
||||
*/
|
||||
int delete(DeleteZdAssortDTO deleteZdAssortDTO);
|
||||
/**
|
||||
* 关键字搜索
|
||||
* @param searchDTO 搜索参数
|
||||
* @return 分页列表
|
||||
*/
|
||||
PageResult<ZdAssortVO> search(SearchDTO searchDTO);
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
package com.docus.server.service.impl;
|
||||
|
||||
import com.docus.server.dto.segmentation.zdassort.AddZdAssortDTO;
|
||||
import com.docus.server.dto.segmentation.zdassort.EditZdAssortDTO;
|
||||
import com.docus.server.dto.segmentation.zdassort.DeleteZdAssortDTO;
|
||||
import com.docus.server.vo.segmentation.zdassort.ZdAssortVO;
|
||||
import com.docus.server.entity.segmentation.ZdAssort;
|
||||
import com.docus.server.convert.ZdAssortConvert;
|
||||
import com.docus.server.infrastructure.dao.IZdAssortDao;
|
||||
import com.docus.server.service.IZdAssortService;
|
||||
import com.docus.core.util.Func;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.docus.infrastructure.web.request.SearchDTO;
|
||||
import com.docus.infrastructure.web.response.PageResult;
|
||||
import com.docus.infrastructure.redis.service.IdService;
|
||||
import com.docus.infrastructure.web.exception.ApiException;
|
||||
import com.docus.infrastructure.web.exception.ExceptionCode;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 病案分类 服务实现类
|
||||
*
|
||||
* @author AutoGenerator
|
||||
* @since 2023-08-30
|
||||
*/
|
||||
@Service
|
||||
public class ZdAssortServiceImpl implements IZdAssortService {
|
||||
@Resource
|
||||
private IZdAssortDao iZdAssortDao;
|
||||
@Resource
|
||||
private IdService idService;
|
||||
|
||||
/**
|
||||
*按主键查询
|
||||
* @param id 主键Id
|
||||
* @return 实体
|
||||
*/
|
||||
@Override
|
||||
public ZdAssortVO findById(Long id) {
|
||||
return ZdAssortConvert.INSTANCE.convertVO(iZdAssortDao.findById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
*查询所有
|
||||
* @return 实体
|
||||
*/
|
||||
@Override
|
||||
public List<ZdAssortVO> findAll() {
|
||||
return ZdAssortConvert.INSTANCE.convertVO(iZdAssortDao.findAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 关键字搜索
|
||||
* @param searchDTO 搜索参数
|
||||
* @return 分页列表
|
||||
*/
|
||||
@Override
|
||||
public PageResult<ZdAssortVO> search(SearchDTO searchDTO) {
|
||||
return ZdAssortConvert.INSTANCE.convertVO(iZdAssortDao.search(searchDTO));
|
||||
|
||||
//PageResult<ZdAssortVO> result = ZdAssortConvert.INSTANCE.convertVO(iZdAssortDao.search(searchDTO));
|
||||
|
||||
//if (CollectionUtils.isEmpty(result.getList())) {
|
||||
//return new PageResult<>();
|
||||
//}
|
||||
|
||||
//Map<String, SchSystemParams> map = iSchSystemParamsService.find(ListUtils.distinctSelect(result.getList(), SchCollectorVO::getCollectorId));
|
||||
|
||||
//result.getList().forEach(p -> {
|
||||
// String collectorId = String.valueOf(p.getCollectorId());
|
||||
// if (map.containsKey(collectorId)) {
|
||||
// p.setCollectorName(map.get(collectorId).getParamName());
|
||||
// }
|
||||
//});
|
||||
|
||||
//return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param addZdAssortDTO 编辑参数
|
||||
* @return 成功或失败
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean add(AddZdAssortDTO addZdAssortDTO) {
|
||||
ZdAssort zdAssort =ZdAssortConvert.INSTANCE.convertDO(addZdAssortDTO);
|
||||
// zdAssort.setId(idService.getDateSeq());
|
||||
return iZdAssortDao.add(zdAssort);
|
||||
|
||||
// String name = addZdAssortDTO.getName();
|
||||
|
||||
//ZdAssort zdAssort = iZdAssortDao.findOneBy("name", name);
|
||||
|
||||
//if (Func.notNull(zdAssort)) {
|
||||
// throw new ApiException(ExceptionCode.ParamIllegal.getCode(), "病案分类已经存在");
|
||||
// }
|
||||
|
||||
// ZdAssort zdAssort =ZdAssortConvert.INSTANCE.convertDO(addZdAssortDTO);
|
||||
// zdAssort.setId(idService.getDateSeq());
|
||||
|
||||
// return iZdAssortDao.add(schCollector);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param editZdAssortDTO 编辑参数
|
||||
* @return 成功或失败
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean edit(EditZdAssortDTO editZdAssortDTO) {
|
||||
ZdAssort zdAssort =ZdAssortConvert.INSTANCE.convertDO(editZdAssortDTO);
|
||||
return iZdAssortDao.edit(zdAssort);
|
||||
|
||||
// Long id = editZdAssortDTO.getId();
|
||||
|
||||
// ZdAssort zdAssort = iZdAssortDao.findById(id);
|
||||
|
||||
// if (Func.isNull(zdAssort)) {
|
||||
// throw new ApiException(ExceptionCode.ParamIllegal.getCode(), "病案分类,无法更新!");
|
||||
// }
|
||||
|
||||
// zdAssort.setUpdateTime(LocalDateTime.now());
|
||||
// return iZdAssortDao.edit(zdAssort);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param deleteZdAssortDTO 删除参数
|
||||
* @return 成功或失败
|
||||
*/
|
||||
@Override
|
||||
public int delete(DeleteZdAssortDTO deleteZdAssortDTO) {
|
||||
return iZdAssortDao.delete(deleteZdAssortDTO.getIds());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
<?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.docus.server.infrastructure.mapper.ZdAssortMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap"
|
||||
type="com.docus.server.entity.segmentation.ZdAssort">
|
||||
<id column="assort_id" property="assortId"/>
|
||||
<result column="assort_name" property="assortName"/>
|
||||
<result column="assort_sort" property="assortSort"/>
|
||||
<result column="effective" property="effective"/>
|
||||
<result column="is_check" property="isCheck"/>
|
||||
<result column="assort_code" property="assortCode"/>
|
||||
<result column="level" property="level"/>
|
||||
<result column="type_code" property="typeCode"/>
|
||||
<result column="recall_role" property="recallRole"/>
|
||||
<result column="collect_id" property="collectId"/>
|
||||
<result column="assort_source" property="assortSource"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
assort_id, assort_name, assort_sort, effective, is_check, assort_code, level, type_code, recall_role, collect_id, assort_source
|
||||
</sql>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue