commit
8f835a88c1
@ -1,109 +0,0 @@ |
|||||||
package digital.laboratory.platform.entrustment.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||||
import digital.laboratory.platform.common.core.util.R; |
|
||||||
import digital.laboratory.platform.entrustment.entity.EntrustTemplateInfo; |
|
||||||
import digital.laboratory.platform.entrustment.enums.TemplateTypeEnums; |
|
||||||
import digital.laboratory.platform.entrustment.query.EntrustTemplateInfoQuery; |
|
||||||
import digital.laboratory.platform.entrustment.service.EntrustTemplateInfoService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.annotation.Resource; |
|
||||||
import javax.validation.Valid; |
|
||||||
import java.util.Arrays; |
|
||||||
import java.util.List; |
|
||||||
import java.util.stream.Collectors; |
|
||||||
|
|
||||||
/** |
|
||||||
* 委托检材--检出定性定量结果信息 |
|
||||||
* |
|
||||||
* @author chenjiangbao |
|
||||||
* @describe 委托检材--检出定性定量结果信息相关接口 前端控制器 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/papp/entrustTemplateInfo") |
|
||||||
@Api(tags = "019-委托送检中案情简要等内容的模板信息相关接口") |
|
||||||
public class EntrustTemplateInfoController { |
|
||||||
|
|
||||||
@Resource |
|
||||||
private EntrustTemplateInfoService entrustTemplateInfoService; |
|
||||||
|
|
||||||
// 内部静态类,用于封装枚举数据
|
|
||||||
private static class EnumResponse { |
|
||||||
private final int code; |
|
||||||
private final String desc; |
|
||||||
|
|
||||||
public EnumResponse(int code, String desc) { |
|
||||||
this.code = code; |
|
||||||
this.desc = desc; |
|
||||||
} |
|
||||||
|
|
||||||
public int getCode() { |
|
||||||
return code; |
|
||||||
} |
|
||||||
|
|
||||||
public String getDesc() { |
|
||||||
return desc; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation("获取所有模板的类型值") |
|
||||||
@GetMapping("/allTemplateType") |
|
||||||
public R<List<EnumResponse>> allTemplateType() { |
|
||||||
List<EnumResponse> enumResponseList = Arrays.stream(TemplateTypeEnums.values()) |
|
||||||
.map(value -> new EnumResponse(value.getCode(), value.getDesc())) |
|
||||||
.collect(Collectors.toList()); |
|
||||||
return R.ok(enumResponseList); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation("获取模板的分页接口") |
|
||||||
@PostMapping("/page") |
|
||||||
public R<IPage<EntrustTemplateInfo>> pageEntrustTemplateInfo(@RequestBody EntrustTemplateInfoQuery query) { |
|
||||||
return R.ok( |
|
||||||
entrustTemplateInfoService.page( |
|
||||||
new Page<>(query.getCurrent(), query.getSize()), |
|
||||||
Wrappers.<EntrustTemplateInfo>lambdaQuery() |
|
||||||
.eq(query.getType() != null, EntrustTemplateInfo::getTemplateType, query.getType()) |
|
||||||
.orderByDesc(EntrustTemplateInfo::getCreateTime) |
|
||||||
) |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation("录入模板信息") |
|
||||||
@PostMapping("/save") |
|
||||||
public R<EntrustTemplateInfo> addEntrustTemplateInfo(@RequestBody @Valid EntrustTemplateInfo info) { |
|
||||||
EntrustTemplateInfo isExist = entrustTemplateInfoService.getOne( |
|
||||||
Wrappers.<EntrustTemplateInfo>lambdaQuery() |
|
||||||
.eq(EntrustTemplateInfo::getTemplateName, info.getTemplateName()) |
|
||||||
.eq(EntrustTemplateInfo::getTemplateType, info.getTemplateType()) |
|
||||||
); |
|
||||||
if (isExist != null) { |
|
||||||
return R.failed(String.format("在模板类型为 [%s] 中已经存在模板名称为 [%s] 的模板!", |
|
||||||
TemplateTypeEnums.fromCode(info.getTemplateType()).getDesc(), |
|
||||||
info.getTemplateName())); |
|
||||||
} |
|
||||||
entrustTemplateInfoService.save(info); |
|
||||||
return R.ok(info); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation("更新模板信息") |
|
||||||
@PutMapping("/update") |
|
||||||
public R<EntrustTemplateInfo> update(@RequestBody EntrustTemplateInfo info) { |
|
||||||
EntrustTemplateInfo isExist = entrustTemplateInfoService.getById(info.getId()); |
|
||||||
if (isExist == null) { |
|
||||||
return R.failed("数据在系统中不存在!"); |
|
||||||
} |
|
||||||
entrustTemplateInfoService.updateById(info); |
|
||||||
return R.ok(info); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation("删除模板信息") |
|
||||||
@PostMapping("/delete") |
|
||||||
public R<Boolean> delete(@RequestBody List<String> ids) { |
|
||||||
return R.ok(entrustTemplateInfoService.removeByIds(ids)); |
|
||||||
} |
|
||||||
} |
|
@ -1,55 +0,0 @@ |
|||||||
package digital.laboratory.platform.entrustment.entity; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType; |
|
||||||
import com.baomidou.mybatisplus.annotation.TableField; |
|
||||||
import com.baomidou.mybatisplus.annotation.TableId; |
|
||||||
import com.baomidou.mybatisplus.annotation.TableName; |
|
||||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity; |
|
||||||
import java.io.Serializable; |
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel; |
|
||||||
import io.swagger.annotations.ApiModelProperty; |
|
||||||
import lombok.Data; |
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank; |
|
||||||
import javax.validation.constraints.NotNull; |
|
||||||
|
|
||||||
/** |
|
||||||
* 委托送检中案情简要等内容的模板信息表 |
|
||||||
* @TableName b_entrust_template_info |
|
||||||
*/ |
|
||||||
@Data |
|
||||||
@TableName(value ="b_entrust_template_info") |
|
||||||
@ApiModel(value = "EntrustTemplateInfo", description = "委托送检中案情简要等内容的模板信息表") |
|
||||||
public class EntrustTemplateInfo extends BaseEntity { |
|
||||||
/** |
|
||||||
* 主键id |
|
||||||
*/ |
|
||||||
@ApiModelProperty("id主键") |
|
||||||
@TableId(value = "ID", type = IdType.ASSIGN_ID) |
|
||||||
private String id; |
|
||||||
|
|
||||||
/** |
|
||||||
* 模板名称 |
|
||||||
*/ |
|
||||||
@ApiModelProperty("模板名称") |
|
||||||
@NotBlank(message = "模板名称不能为空!") |
|
||||||
private String templateName; |
|
||||||
|
|
||||||
/** |
|
||||||
* 模板内容 |
|
||||||
*/ |
|
||||||
@ApiModelProperty("模板内容") |
|
||||||
@NotBlank(message = "模板内容不能为空!") |
|
||||||
private String templateContent; |
|
||||||
|
|
||||||
/** |
|
||||||
* 模板类型,比如:0 - 案情简要 |
|
||||||
*/ |
|
||||||
@ApiModelProperty("模板类型,比如:0 - 案情简要") |
|
||||||
@NotNull(message = "模板类型不能为空!") |
|
||||||
private Integer templateType; |
|
||||||
|
|
||||||
@TableField(exist = false) |
|
||||||
private static final long serialVersionUID = 1L; |
|
||||||
} |
|
@ -1,30 +0,0 @@ |
|||||||
package digital.laboratory.platform.entrustment.enums; |
|
||||||
|
|
||||||
import lombok.Getter; |
|
||||||
|
|
||||||
@Getter |
|
||||||
public enum TemplateTypeEnums { |
|
||||||
|
|
||||||
TEMPLATE_CASE_BRIEF(0, "案情简要模板"), |
|
||||||
; |
|
||||||
|
|
||||||
|
|
||||||
private final Integer code; |
|
||||||
|
|
||||||
private final String desc; |
|
||||||
|
|
||||||
TemplateTypeEnums(Integer code, String desc) { |
|
||||||
this.code = code; |
|
||||||
this.desc = desc; |
|
||||||
} |
|
||||||
|
|
||||||
// 根据名称获取状态值
|
|
||||||
public static TemplateTypeEnums fromCode(Integer code) { |
|
||||||
for (TemplateTypeEnums entrustAlterApplyStatus : values()) { |
|
||||||
if (entrustAlterApplyStatus.getCode().equals(code)) { |
|
||||||
return entrustAlterApplyStatus; |
|
||||||
} |
|
||||||
} |
|
||||||
throw new IllegalArgumentException("No enum constant with code: " + code); |
|
||||||
} |
|
||||||
} |
|
@ -1,20 +0,0 @@ |
|||||||
package digital.laboratory.platform.entrustment.mapper; |
|
||||||
|
|
||||||
import digital.laboratory.platform.entrustment.entity.EntrustTemplateInfo; |
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
||||||
import org.apache.ibatis.annotations.Mapper; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author ChenJiangBao |
|
||||||
* @description 针对表【b_entrust_template_info(委托送检中案情简要等内容的模板信息表)】的数据库操作Mapper |
|
||||||
* @createDate 2025-01-08 14:12:41 |
|
||||||
* @Entity digital.laboratory.platform.entrustment.entity.EntrustTemplateInfo |
|
||||||
*/ |
|
||||||
@Mapper |
|
||||||
public interface EntrustTemplateInfoMapper extends BaseMapper<EntrustTemplateInfo> { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,19 +0,0 @@ |
|||||||
package digital.laboratory.platform.entrustment.query; |
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel; |
|
||||||
import io.swagger.annotations.ApiModelProperty; |
|
||||||
import lombok.Data; |
|
||||||
|
|
||||||
/** |
|
||||||
* 申请修改委托消息 查询对象(分页查询、列表查询) |
|
||||||
* |
|
||||||
* @author Chen |
|
||||||
* @since 1.0.0 2024-08-14 |
|
||||||
*/ |
|
||||||
@Data |
|
||||||
@ApiModel(description = "申请修改委托消息 查询对象(分页查询、列表查询)") |
|
||||||
public class EntrustTemplateInfoQuery extends BaseQuery { |
|
||||||
|
|
||||||
@ApiModelProperty(value = "模板类型") |
|
||||||
private Integer type; |
|
||||||
} |
|
@ -1,13 +0,0 @@ |
|||||||
package digital.laboratory.platform.entrustment.service; |
|
||||||
|
|
||||||
import digital.laboratory.platform.entrustment.entity.EntrustTemplateInfo; |
|
||||||
import com.baomidou.mybatisplus.extension.service.IService; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author ChenJiangBao |
|
||||||
* @description 针对表【b_entrust_template_info(委托送检中案情简要等内容的模板信息表)】的数据库操作Service |
|
||||||
* @createDate 2025-01-08 14:12:41 |
|
||||||
*/ |
|
||||||
public interface EntrustTemplateInfoService extends IService<EntrustTemplateInfo> { |
|
||||||
|
|
||||||
} |
|
@ -1,22 +0,0 @@ |
|||||||
package digital.laboratory.platform.entrustment.service.impl; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
||||||
import digital.laboratory.platform.entrustment.entity.EntrustTemplateInfo; |
|
||||||
import digital.laboratory.platform.entrustment.service.EntrustTemplateInfoService; |
|
||||||
import digital.laboratory.platform.entrustment.mapper.EntrustTemplateInfoMapper; |
|
||||||
import org.springframework.stereotype.Service; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author ChenJiangBao |
|
||||||
* @description 针对表【b_entrust_template_info(委托送检中案情简要等内容的模板信息表)】的数据库操作Service实现 |
|
||||||
* @createDate 2025-01-08 14:12:41 |
|
||||||
*/ |
|
||||||
@Service |
|
||||||
public class EntrustTemplateInfoServiceImpl extends ServiceImpl<EntrustTemplateInfoMapper, EntrustTemplateInfo> |
|
||||||
implements EntrustTemplateInfoService{ |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,23 +0,0 @@ |
|||||||
<?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="digital.laboratory.platform.entrustment.mapper.EntrustTemplateInfoMapper"> |
|
||||||
|
|
||||||
<resultMap id="BaseResultMap" type="digital.laboratory.platform.entrustment.entity.EntrustTemplateInfo"> |
|
||||||
<id property="id" column="id" jdbcType="VARCHAR"/> |
|
||||||
<result property="templateName" column="template_name" jdbcType="VARCHAR"/> |
|
||||||
<result property="templateContent" column="template_content" jdbcType="VARCHAR"/> |
|
||||||
<result property="templateType" column="template_type" jdbcType="TINYINT"/> |
|
||||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
|
||||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/> |
|
||||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
|
||||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/> |
|
||||||
</resultMap> |
|
||||||
|
|
||||||
<sql id="Base_Column_List"> |
|
||||||
id,template_name,template_content, |
|
||||||
template_type,create_time,create_by, |
|
||||||
update_time,update_by |
|
||||||
</sql> |
|
||||||
</mapper> |
|
Loading…
Reference in new issue