第一步
找到要在那个接口上添加多一个查询条件
,
第二步
双加shift键,找到该接口的controller层
第三步
点击service方法,进去service层
第四步
进去service层之后,添加根据指标类型查询的方法
/**
* 指标类型查询
* @param matterType
* @return
*/
List getDetailByType(String matterType);
第五步
点击向下的箭头,进入serviceImpl层(实现层),添加指标类型查询实现。
//指标类型查询
@Override
public List getDetailByType(String matterType) {
List detailDoList = this.getBaseMapper().selectList(
Wrappers.lambdaQuery(new MatterDO())
.eq(MatterDO::getMatterType, matterType)
.eq(MatterDO::getIsDelete, false)
);
// return CollectionUtils.isNotEmpty(detailDoList) ? detailDoList.get(0) : null;
return detailDoList;
}
第六步
进入列表的实体类,添加matterType属性字段,无则添加,有则不用添加。
/**
* 指标类型
*/
private String matterType;
第七步
测试
第一步
确定在哪里添加指标组名称查询的接口
第二步
然后再此controller下的service层添加指标组名称查询的方法
/**
* 指标组名称查询
* @param matterGroupName
* @return
*/
PageVO getByGroupName(MatterGroupRequestPage2VO matterGroupName);
第三步
然后再Mapper层添加指标组名称查询的方法
// 指标组名称
List Matter_Group_Name(MatterGroupRequestPage2VO MatterGroupName);
// 指标组编码
Integer Matter_Group_Code(@Param("matterGroupCode") String matterGroupCode);
第四步
然后再Mapper.xml配置文件配置实现此方法的sql语句
第五步
新建一个实体类,用来输出指定的字段
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class MatterGroup2VO implements Serializable {
@ApiModelProperty(value = "主键",required = true)
private Long id;
@ApiModelProperty(value = "指标组编码,参考业务属性规则,一级四位")
private String matterGroupCode;
@ApiModelProperty(value = "指标名称")
private String matterGroupName;
@ApiModelProperty(value = "父指标主键")
private Long parentId;
@ApiModelProperty(value = "排序")
private Integer orderNum;
/**
* 创建者名称
*/
@TableField(exist = false)
private String creator;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "指标数量")
private Integer matterNum;
}
第六步
新建一个类,用于获取请求参数
import com.Xxx.appointment.utils.PageRequestVO;
import io.swagger.annotations.ApiModelProperty;
import javafx.application.Application;
import javafx.stage.Stage;
import lombok.Data;
import java.io.Serializable;
@Data
public class MatterGroupRequestPage2VO extends PageRequestVO implements Serializable {
@ApiModelProperty(value = "指标名称")
private String matterGroupName;
@ApiModelProperty(value = "指标组编码,参考业务属性规则,一级四位")
private String matterGroupCode;
}
第七步
然后再serviceImpl层(实现层)实现此功能
//指标组名称查询
@Override
public PageVO getByGroupName(MatterGroupRequestPage2VO matterGroupName) {
List groupDOList = matterGroupV1Mapper.Matter_Group_Name(matterGroupName);
for (MatterGroup2VO matterGroup2VO : groupDOList) {
String matterGroupCode = matterGroup2VO.getMatterGroupCode();
Integer integer = matterGroupV1Mapper.Matter_Group_Code(matterGroupCode);
matterGroup2VO.setMatterNum(integer);
}
PageVO pageVO = new PageVO(groupDOList);
return pageVO;
}
第八步
然后再controller层添加指标组名称查询的接口
@ApiOperationSupport(order = 103)
@PostMapping("getByGroupName")
@ApiOperation(value = "103.根据指标组名称查询指标组",notes = "103.根据指标组名称查询指标组")
public RespPageResult getByGroupName(MatterGroupRequestPage2VO matterGroupName){
try{
return ResultUtil.getSuccessPageResult(matterGroupV1Service.getByGroupName(matterGroupName));
}catch (Exception e){
log.error("根据指标组名称查询指标组",e);
return ResultUtil.getFailedPageResult(e.getMessage());
}
}
第九步
测试
页面更新:2024-04-18
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号