增加搜索二级分类名称

上级 c18811bb
流水线 #8111 已通过 于阶段
in 2 分 30 秒
......@@ -65,8 +65,8 @@ public class IndustryTypeController {
@ApiOperation(value = "一级行业详情-全部")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = IndustryTypeDTO.class)})
@GetMapping("getIndustryTypeById")
public IndustryTypeDTO getIndustryTypeById(@RequestParam Integer id) {
return industryTypeService.getIndustryTypeById(id);
public IndustryTypeDTO getIndustryTypeById(@RequestParam Integer id, @RequestParam Integer inspectionId) {
return industryTypeService.getIndustryTypeById(id, inspectionId);
}
@ApiOperation(value = "一级行业列表-全部")
......
......@@ -30,4 +30,11 @@ public interface IndustryTypeDao {
List<InspectionDO> listInspectionsByIndustryTypeIdId(Integer industryTypeId);
IndustryTypeDO getIndustryTypeById(Integer id);
/**
* 获取二级分类的服务名称
* @param inspectionId 二级服务的id
* @return {@link String}
*/
String getInspectionNameById(Integer inspectionId);
}
......@@ -2,6 +2,7 @@ package com.mmc.pms.entity.inspection;
import com.mmc.pms.model.inspection.dto.IndustryTypeDTO;
import com.mmc.pms.model.inspection.vo.IndustryTypeVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -46,6 +47,8 @@ public class IndustryTypeDO implements Serializable {
* 服务列表
*/
private List<InspectionDO> inspectionDOS;
@ApiModelProperty(value = "二级服务分类名称")
private String inspectionName;
public IndustryTypeDO(IndustryTypeVO industryTypeVO) {
this.id = industryTypeVO.getId();
......@@ -60,6 +63,7 @@ public class IndustryTypeDO implements Serializable {
.description(this.description).saleState(this.saleState).createTime(this.createTime)
.inspectionDTOS(CollectionUtils.isNotEmpty(this.inspectionDOS) ?
this.inspectionDOS.stream().map(InspectionDO::buildInspectionDTO).collect(Collectors.toList()) : null)
.inspectionName(this.inspectionName)
.build();
}
......
......@@ -34,4 +34,6 @@ public class IndustryTypeDTO implements Serializable {
private Date createTime;
@ApiModelProperty(value = "服务列表")
private List<InspectionDTO> inspectionDTOS;
@ApiModelProperty(value = "二级服务分类名称")
private String inspectionName;
}
......@@ -22,7 +22,7 @@ public interface IndustryTypeService {
ResultBody<IndustryTypeDTO> listInspectionsByIndustryTypeId(Integer id);
IndustryTypeDTO getIndustryTypeById(Integer id);
IndustryTypeDTO getIndustryTypeById(Integer id,Integer inspectionId);
List<IndustryTypeDTO> listIndustry();
}
......@@ -14,6 +14,7 @@ import com.mmc.pms.service.inspection.IndustryTypeService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
......@@ -23,6 +24,7 @@ import java.util.stream.Collectors;
* @Date: 2023/8/3 18:01
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class IndustryTypeServiceImpl implements IndustryTypeService {
@Autowired
private IndustryTypeDao industryTypeDao;
......@@ -84,8 +86,10 @@ public class IndustryTypeServiceImpl implements IndustryTypeService {
}
@Override
public IndustryTypeDTO getIndustryTypeById(Integer id) {
public IndustryTypeDTO getIndustryTypeById(Integer id,Integer inspectionId) {
IndustryTypeDO industryTypeDO = industryTypeDao.getIndustryTypeById(id);
String inspectionNameById = industryTypeDao.getInspectionNameById(inspectionId);
industryTypeDO.setInspectionName(inspectionNameById);
return industryTypeDO.buildIndustryTypeDTO();
}
......
......@@ -119,4 +119,7 @@
from industry_type it
where it.id = #{id}
</select>
<select id="getInspectionNameById" resultType="java.lang.String">
select inspection_name from inspection where id = #{inspectionId}
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论