Browse Source

feat:

1.根据场景id查询时增加对场景目录关联的查询字段赋值
2.分页查询图层目录树时增加了根据id查询
master_tdsql
caoqi 1 year ago
parent
commit
01ff142a8e
  1. 18
      shuili-system/src/main/java/com/kms/yg/znjg/controller/SySceneController.java
  2. 3
      shuili-system/src/main/resources/mapper/yg/znjg/SyDirMapper.xml

18
shuili-system/src/main/java/com/kms/yg/znjg/controller/SySceneController.java

@ -22,6 +22,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -188,8 +189,8 @@ public class SySceneController {
*/
@GetMapping(value = "/findSceneById/{id}")
@ApiOperation("根据id查询场景实体对象")
public Response<SyScene> findSceneById(@PathVariable(value = "id") String id) throws Exception {
Response<SyScene> responseInfo = new Response<>();
public Response<SySceneVo> findSceneById(@PathVariable(value = "id") String id) throws Exception {
Response<SySceneVo> responseInfo = new Response<>();
try {
QueryWrapper<SyScene> wrapper = new QueryWrapper<>();
Map<String, Object> map = new HashMap();
@ -198,8 +199,19 @@ public class SySceneController {
wrapper.allEq(map);
List<SyScene> syScenes = sySceneMapper.selectList(wrapper);
if (syScenes != null && syScenes.size() > 0) {
SyScene syScene = syScenes.get(0);
String relateSceneId = syScene.getId();
// 使用MyBatisPlus查询场景关联的图层目录个数
Integer dirCount = sySceneDirRelationMapper.selectCount(new QueryWrapper<SySceneDirRelation>() {{
eq("scene_id", relateSceneId);
eq("is_valid", 1);
}});
// 创建SySceneVo对象,并将查询到的数据封装到SySceneVo对象中
SySceneVo sySceneVo = new SySceneVo();
BeanUtils.copyProperties(syScene, sySceneVo);
sySceneVo.setRelationDirCount(dirCount);
responseInfo.setCode("200");
responseInfo.setData(syScenes.get(0));
responseInfo.setData(sySceneVo);
} else {
throw new Exception("未查询到数据");
}

3
shuili-system/src/main/resources/mapper/yg/znjg/SyDirMapper.xml

@ -43,6 +43,9 @@
where x.dir_id=y.id and x.is_valid=1) as relation_scene_count
FROM bs_sgc_qqjd_dir y
where y.is_valid = 1
<if test="syDir.id != null and syDir.id != ''">
AND y.id = #{syDir.id,jdbcType=VARCHAR}
</if>
<if test="syDir.name != null and syDir.name != ''">
AND y.name LIKE CONCAT(CONCAT('%', TRIM(#{syDir.name,jdbcType=VARCHAR})), '%')
</if>

Loading…
Cancel
Save