指标库新增web页面树形接口

This commit is contained in:
ly19960718 2021-04-13 16:48:21 +08:00
parent 142e628102
commit 72d6e516de
5 changed files with 96 additions and 11 deletions

View File

@ -40,6 +40,30 @@ public class IndexLibController extends DefaultBaseController {
@ApiOperation(value = "web页面指标库树形列表", notes = "web页面指标库树形列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listztreeweb")
public List<IndexLibZTreeDTO> listZTreeWeb() {
Map<String, Object> params = requestParams();
String indexLibParentId = "0";
if (!StringUtils.isBlank(params.get("id") == null ? null : params.get("id").toString())) {
indexLibParentId = params.get("id").toString();
}
params.put("indexLibParentId",indexLibParentId);
return indexLibService.listZTreeWeb(params);
}
@ApiOperation(value = "修改指标状态", notes = "修改指标状态接口") @ApiOperation(value = "修改指标状态", notes = "修改指标状态接口")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "indexLibId", value = "ID", paramType = "path"), @ApiImplicitParam(name = "indexLibId", value = "ID", paramType = "path"),

View File

@ -24,6 +24,15 @@ import java.util.Map;
public interface IIndexLibDao { public interface IIndexLibDao {
/**
* web页面树形列表
* @param params
* @return
* @throws SearchException
*/
List<IndexLibZTreeDTO> listZTreeWeb(Map<String, Object> params) throws SearchException;
/** /**
* 树形列表 * 树形列表
* @param params * @param params
@ -135,4 +144,13 @@ public interface IIndexLibDao {
*/ */
Integer countByParentId(Map<String, Object> params) throws SearchException; Integer countByParentId(Map<String, Object> params) throws SearchException;
/**
* web页面根据父级ID统计
* @param params
* @return
* @throws SearchException
*/
Integer countByParentIdWeb(Map<String, Object> params) throws SearchException;
} }

View File

@ -20,13 +20,15 @@ import java.util.Map;
**/ **/
public interface IIndexLibService { public interface IIndexLibService {
/** /**
* 树形列表 * web页面树形列表
* @param params * @param params
* @return * @return
* @throws Exception * @throws Exception
*/ */
List<IndexLibZTreeDTO> listZTreeWeb(Map<String, Object> params);
List<IndexLibZTreeDTO> listZTree(Map<String, Object> params); List<IndexLibZTreeDTO> listZTree(Map<String, Object> params);
/** /**
* 新增 * 新增

View File

@ -34,6 +34,23 @@ public class IndexLibServiceImpl extends DefaultBaseService implements IIndexLib
@Autowired @Autowired
private IIndexLibDao indexLibDao; private IIndexLibDao indexLibDao;
public List<IndexLibZTreeDTO> listZTreeWeb(Map<String, Object> params){
List<IndexLibZTreeDTO> list = indexLibDao.listZTreeWeb(params);
for (IndexLibZTreeDTO indexLibZTreeDTO : list) {
Map<String,Object> data = new HashMap<>();
data.put("parentId",indexLibZTreeDTO.getId());
Integer count = countByParentIdWeb(data);
if (count > 0){
indexLibZTreeDTO.setIsParent(true);
}else{
indexLibZTreeDTO.setIsParent(false);
}
}
return list;
}
public List<IndexLibZTreeDTO> listZTree(Map<String, Object> params){ public List<IndexLibZTreeDTO> listZTree(Map<String, Object> params){
List<IndexLibZTreeDTO> list = indexLibDao.listZTree(params); List<IndexLibZTreeDTO> list = indexLibDao.listZTree(params);
@ -50,15 +67,6 @@ public class IndexLibServiceImpl extends DefaultBaseService implements IIndexLib
return list; return list;
} }
@Override @Override
public void save(IndexLibVO indexLibVO) { public void save(IndexLibVO indexLibVO) {
saveReturnId(indexLibVO); saveReturnId(indexLibVO);
@ -201,5 +209,9 @@ public class IndexLibServiceImpl extends DefaultBaseService implements IIndexLib
Integer count = indexLibDao.countByParentId(params); Integer count = indexLibDao.countByParentId(params);
return count == null ? 0 : count; return count == null ? 0 : count;
} }
public Integer countByParentIdWeb(Map<String, Object> params) {
Integer count = indexLibDao.countByParentIdWeb(params);
return count == null ? 0 : count;
}
} }

View File

@ -53,6 +53,35 @@
</resultMap> </resultMap>
<!-- 树形列表 -->
<select id="listZTreeWeb" parameterType="map" resultMap="indexLibZTreeDTO">
SELECT
t1.index_lib_id,
t1.index_lib_name,
t1.index_lib_parent_id
FROM
duty_index_lib t1
WHERE
t1.is_delete = 0
AND t1.index_lib_state = 1
AND (t1.index_template_id = '' OR t1.index_template_id IS NULL)
AND t1.index_lib_parent_id = #{indexLibParentId}
ORDER BY
t1.index_lib_sort
</select>
<!-- web页面统计根据父级ID -->
<select id="countByParentIdWeb" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
duty_index_lib t1
WHERE
t1.is_delete = 0 AND t1.index_lib_parent_id = #{parentId}
AND t1.index_lib_state = 1
AND (t1.index_template_id = '' OR t1.index_template_id IS NULL)
</select>