字典下拉选
This commit is contained in:
parent
781d104afb
commit
0df66f733c
|
|
@ -41,5 +41,11 @@ public class SelectController extends BaseController {
|
|||
public AjaxResult getMenuTree(MenuDto dto){
|
||||
return service.getMenuTree(dto);
|
||||
}
|
||||
@ApiOperation(value = "字典下拉选")
|
||||
@PostMapping("getDictList")
|
||||
public AjaxResult getDictList(Integer code){
|
||||
return service.getDictList(code);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.securitycontrol.system.base.mapper;
|
|||
|
||||
import com.securitycontrol.entity.system.vo.SelectVo;
|
||||
import com.securitycontrol.entity.system.vo.TreeNode;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -43,4 +44,12 @@ public interface ISelectMapper {
|
|||
* @date 2024/2/26 13:35
|
||||
*/
|
||||
List<TreeNode> getMenuTree();
|
||||
|
||||
|
||||
/**
|
||||
* 查询字典下拉选
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
List<TreeNode> getDictList(@Param("code") Integer code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,4 +39,6 @@ public interface ISelectService {
|
|||
* @date 2024/2/26 13:33
|
||||
*/
|
||||
AjaxResult getMenuTree(MenuDto dto);
|
||||
|
||||
AjaxResult getDictList(Integer code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,4 +72,25 @@ public class SelectServiceImpl implements ISelectService {
|
|||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 字典下拉选
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getDictList(Integer code) {
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
try {
|
||||
List<TreeNode> list = mapper.getDictList(code);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
groupList= TreeBuild.transTreeList(list);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("组织机构树-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,4 +27,14 @@
|
|||
FROM sys_menu
|
||||
WHERE del_flag = 0
|
||||
</select>
|
||||
<!--字典下拉选-->
|
||||
<select id="getDictList" resultType="com.securitycontrol.entity.system.vo.TreeNode">
|
||||
select dict_code as id, dict_name label, p_code AS parentId
|
||||
from sys_dict
|
||||
WHERE del_flag = 0
|
||||
<if test="code!=null and code!=''">
|
||||
and p_code=#{code}
|
||||
</if>
|
||||
ORDER BY dict_sort desc
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue