Commit 6839df8f authored by 朱晨阳's avatar 朱晨阳

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

parent 00456dda
...@@ -197,6 +197,22 @@ public class CommonController extends BaseController { ...@@ -197,6 +197,22 @@ public class CommonController extends BaseController {
return ResponseHelper.buildResponse(commonService.equipmentClassification(type)); return ResponseHelper.buildResponse(commonService.equipmentClassification(type));
} }
/**
* 设备分类
*
* @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));
}
/** /**
* 设备分类 去掉管道分类 * 设备分类 去掉管道分类
* *
...@@ -216,10 +232,10 @@ public class CommonController extends BaseController { ...@@ -216,10 +232,10 @@ public class CommonController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/equipmentClassificationByParentCode") @GetMapping(value = "/equipmentClassificationNoPipelineByParentCode")
@ApiOperation(httpMethod = "GET", value = "设备分类", notes = "1,设备种类 2,设备类别 3,设备品种") @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) { public ResponseModel<List<EquipmentCategoryDto>> equipmentClassificationNoPipelineByParentCode(@RequestParam(value = "type") String type, @RequestParam(value = "parentCode", required = false) String parentCode) {
return ResponseHelper.buildResponse(commonService.equipmentClassificationByParentCode(type, parentCode)); return ResponseHelper.buildResponse(commonService.equipmentClassificationNoPipelineByParentCode(type, parentCode));
} }
/** /**
......
...@@ -188,6 +188,8 @@ public interface ICommonService { ...@@ -188,6 +188,8 @@ public interface ICommonService {
*/ */
List<EquipmentCategoryDto> equipmentClassification(String type); List<EquipmentCategoryDto> equipmentClassification(String type);
List<EquipmentCategoryDto> equipmentClassificationByParentCode(String type, String parentCode);
/** /**
* 套打使用标志生成 * 套打使用标志生成
* *
...@@ -241,7 +243,7 @@ public interface ICommonService { ...@@ -241,7 +243,7 @@ public interface ICommonService {
List<EquipmentCategoryDto> equipmentClassificationNoPipeline(String type); List<EquipmentCategoryDto> equipmentClassificationNoPipeline(String type);
List<EquipmentCategoryDto> equipmentClassificationByParentCode(String type, String parentCode); List<EquipmentCategoryDto> equipmentClassificationNoPipelineByParentCode(String type, String parentCode);
List<EquipmentCategoryDto> getEquDefineByParentId(String parentId); List<EquipmentCategoryDto> getEquDefineByParentId(String parentId);
......
...@@ -2099,6 +2099,30 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2099,6 +2099,30 @@ public class CommonServiceImpl implements ICommonService {
return result; return result;
} }
/**
* 设备分类
*
* @param type 1,设备种类 2,设备类别 3,设备品种
* .c@return
*/
@Override
public List<EquipmentCategoryDto> equipmentClassificationByParentCode(String type, String parentCode) {
List<EquipmentCategoryDto> categoryList = equipmentCategoryMapper.selectClassifyNoStart7ByParentCode(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 @Override
public List<EquipmentCategoryDto> equipmentClassificationNoPipeline(String type) { public List<EquipmentCategoryDto> equipmentClassificationNoPipeline(String type) {
List<EquipmentCategoryDto> categoryList = equipmentCategoryMapper.selectClassifyNoStart7And8(); List<EquipmentCategoryDto> categoryList = equipmentCategoryMapper.selectClassifyNoStart7And8();
...@@ -2118,8 +2142,8 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2118,8 +2142,8 @@ public class CommonServiceImpl implements ICommonService {
} }
@Override @Override
public List<EquipmentCategoryDto> equipmentClassificationByParentCode(String type, String parentCode) { public List<EquipmentCategoryDto> equipmentClassificationNoPipelineByParentCode(String type, String parentCode) {
List<EquipmentCategoryDto> categoryList = equipmentCategoryMapper.selectClassifyByParentCode(parentCode); List<EquipmentCategoryDto> categoryList = equipmentCategoryMapper.selectClassifyNoStart7And8ByParentCode(parentCode);
List<EquipmentCategoryDto> result = Collections.emptyList(); List<EquipmentCategoryDto> result = Collections.emptyList();
switch (type) { switch (type) {
case "1": case "1":
......
...@@ -26,11 +26,14 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> { ...@@ -26,11 +26,14 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
@Select("SELECT * FROM tz_equipment_category WHERE code NOT LIKE '7%' ORDER BY parent_id") @Select("SELECT * FROM tz_equipment_category WHERE code NOT LIKE '7%' ORDER BY parent_id")
List<EquipmentCategoryDto> selectClassifyNoStart7(); List<EquipmentCategoryDto> selectClassifyNoStart7();
List<EquipmentCategoryDto> selectClassifyNoStart7ByParentCode(@Param("parentCode") String parentCode);
@Select("SELECT * FROM tz_equipment_category WHERE code NOT LIKE '7%' AND code NOT LIKE '8%' ORDER BY parent_id") @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> selectClassifyNoStart7And8();
List<EquipmentCategoryDto> selectClassifyByParentCode(@Param("parentCode") String parentCode); List<EquipmentCategoryDto> selectClassifyNoStart7And8ByParentCode(@Param("parentCode") String parentCode);
@Select("select * from tz_equipment_category where code in('1000','2000','3000','4000','5000','6000','8000','9000')") @Select("select * from tz_equipment_category where code in('1000','2000','3000','4000','5000','6000','8000','9000')")
List<EquipmentCategoryDto> selectClassify(); List<EquipmentCategoryDto> selectClassify();
......
...@@ -683,7 +683,18 @@ ...@@ -683,7 +683,18 @@
AND "CLAIM_STATUS" = '已认领'; AND "CLAIM_STATUS" = '已认领';
</select> </select>
<select id="selectClassifyByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto"> <select id="selectClassifyNoStart7ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto">
select * from tz_equipment_category
<where>
code NOT LIKE '7%'
<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>
<select id="selectClassifyNoStart7And8ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto">
select * from tz_equipment_category select * from tz_equipment_category
<where> <where>
code NOT LIKE '7%' AND code NOT LIKE '8%' code NOT LIKE '7%' AND code NOT LIKE '8%'
......
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