Commit 273c46eb authored by 朱晨阳's avatar 朱晨阳

添加根据设备种类code获取设备类别接口

parent 1af30530
......@@ -211,6 +211,18 @@ public class CommonController extends BaseController {
}
/**
* 根据设备种类code获取设备类别
* @param type 1,设备种类 2,设备类别 3,设备品种
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/equipmentClassificationByParentCode")
@ApiOperation(httpMethod = "GET", value = "设备分类", notes = "1,设备种类 2,设备类别 3,设备品种")
public ResponseModel<List<EquipmentCategoryDto>> equipmentClassificationByParentCode(@RequestParam(value = "type") String type, @RequestParam(value = "parentCode", required = false) String parentCode) {
return ResponseHelper.buildResponse(commonService.equipmentClassificationByParentCode(type, parentCode));
}
/**
* 设备品种
*
* @param parentId 父级ID
......
......@@ -241,6 +241,8 @@ public interface ICommonService {
List<EquipmentCategoryDto> equipmentClassificationNoPipeline(String type);
List<EquipmentCategoryDto> equipmentClassificationByParentCode(String type, String parentCode);
List<EquipmentCategoryDto> getEquDefineByParentId(String parentId);
List<EquipmentClassifyDto> getEquClassifyByCode(String parentCode);
......
......@@ -2118,6 +2118,24 @@ public class CommonServiceImpl implements ICommonService {
}
@Override
public List<EquipmentCategoryDto> equipmentClassificationByParentCode(String type, String parentCode) {
List<EquipmentCategoryDto> categoryList = equipmentCategoryMapper.selectClassifyByParentCode(parentCode);
List<EquipmentCategoryDto> result = Collections.emptyList();
switch (type) {
case "1":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*000$").matcher(category.getCode()).matches()).collect(Collectors.toList());
break;
case "2":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*00$").matcher(category.getCode()).matches()).collect(Collectors.toList());
break;
case "3":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0A-Za-z]*[A-Za-z0-9]*[^0]0$").matcher(category.getCode()).matches()).collect(Collectors.toList());
break;
}
return result;
}
@Override
public List<EquipmentCategoryDto> getEquDefineByParentId(String parentId) {
return equipmentCategoryMapper.getEquDefineByParentId(parentId);
}
......
......@@ -29,6 +29,9 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
@Select("SELECT * FROM tz_equipment_category WHERE code NOT LIKE '7%' AND code NOT LIKE '8%' ORDER BY parent_id")
List<EquipmentCategoryDto> selectClassifyNoStart7And8();
List<EquipmentCategoryDto> selectClassifyByParentCode(@Param("parentCode") String parentCode);
@Select("select * from tz_equipment_category where code in('1000','2000','3000','4000','5000','6000','8000','9000')")
List<EquipmentCategoryDto> selectClassify();
......
......@@ -682,4 +682,15 @@
AND ( ibjoi."CODE96333" NOT LIKE'31%' OR ibjoi."CODE96333" IS NULL )
AND "CLAIM_STATUS" = '已认领';
</select>
<select id="selectClassifyByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto">
select * from tz_equipment_category
<where>
code NOT LIKE '7%' AND code NOT LIKE '8%'
<if test="parentCode != null and parentCode != ''">
and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} )
</if>
</where>
ORDER BY parent_id
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment