feat(标签库): 根据code查询

This commit is contained in:
yjz
2024-01-26 13:58:20 +08:00
parent 0f5c901979
commit 8f09a61cb6
4 changed files with 53 additions and 5 deletions
@@ -14,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @ClassName: LawsLabelDatabaseController
* @Description:
@@ -34,7 +36,7 @@ public class LawsLabelDatabaseController {
}
/**
* 标准化活动-树结构查询
* 标签库-树结构查询
* @return
*/
@AutoLog(value = "标签库-树结构查询")
@@ -49,4 +51,15 @@ public class LawsLabelDatabaseController {
Integer pageSize) {
return Result.OK(lawsLabelDatabaseService.queryTreeList(firstNodeName, pageNo, pageSize));
}
/**
* 标签库-树结构查询
* @return
*/
@AutoLog(value = "标签库-零部件树选中回显")
@ApiOperation(value="标签库-零部件树选中回显", notes="标签库-零部件树选中回显")
@GetMapping(value = "/queryByCodes")
public Result<List<LawsLabelDatabase>> queryByCodes(@ApiParam("选中的节点名称") String selectNodeCodes) {
return Result.OK(lawsLabelDatabaseService.queryByCodes(selectNodeCodes));
}
}
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.laws.labeldatabase.entity.LawsLabelDatabase;
import java.util.List;
/**
* @InterfaceName: ILawsLabelDatabaseService
* @Description:
@@ -21,4 +23,11 @@ public interface ILawsLabelDatabaseService extends IService<LawsLabelDatabase> {
* @return
*/
IPage<LawsLabelDatabase> queryTreeList(String firstNodeName, Integer pageNo, Integer pageSize);
/**
* 零部件树选中回显
* @param selectNodeCodes
* @return
*/
List<LawsLabelDatabase> queryByCodes(String selectNodeCodes);
}
@@ -11,8 +11,7 @@ import com.jero.modules.laws.labeldatabase.service.ILawsLabelDatabaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -61,6 +60,24 @@ public class LawsLabelDatabaseServiceImpl
return page;
}
@Override
public List<LawsLabelDatabase> queryByCodes(String selectNodeCodes) {
if (StringUtils.isBlank(selectNodeCodes)){
return new ArrayList<>();
}
List<LawsLabelDatabase> lawsLabelDatabaseList = new ArrayList<>();
List<String> codeList = Arrays.asList(selectNodeCodes.split(","));
List<LawsLabelDatabase> list = list(new LambdaQueryWrapper<LawsLabelDatabase>()
.in(LawsLabelDatabase::getCode, codeList));
// 排序
for (String code : codeList) {
Optional<LawsLabelDatabase> optional = list.stream().filter(v -> code.equals(v.getCode())).findFirst();
optional.ifPresent(v -> lawsLabelDatabaseList.add(optional.get()));
}
return lawsLabelDatabaseList;
}
/**
* 递归构建子节点
* @param tree
@@ -5,13 +5,14 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
*标签库
*@author liJiaRao
@@ -443,4 +444,12 @@ public class LawsTag implements Serializable {
@TableField(exist = false)
private String showAreaEnName;
/**
* 使用范围(1:国标 2:企标)
*/
@ApiModelProperty(value = "使用范围(1:国标 2:企标)")
@Dict(dicCode = "standard_source")
private String usableRange;
}