ludc
2024-01-17 2ff8dd1f7d2f71944c25c9e116d12d9fb418ac0a
分类授权数据授权界面编写与接口修改,分类数据查询接口修改
已修改14个文件
6959 ■■■■ 文件已修改
Source/UBCS-WEB/src/api/template/templateAttr.js 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Master/MasterTree.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClient.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClientFallback.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java 6266 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/feign/SysClient.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/mapper/ClassifyAuthMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IClassifyAuthService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/ClassifyAuthServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/ClassifyAuthMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/MenuMapper.xml 636 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/api/template/templateAttr.js
@@ -1,10 +1,13 @@
import request from "@/router/axios";
//获取树形组件数据
export const getAtrrList = () => {
export const getAtrrList = (params) => {
  return request({
    url: '/api/ubcs-code/codeClassify/treeCodeClassify',
    method: 'get',
    params: {
      ...params
    }
  })
}
//树节点添加
Source/UBCS-WEB/src/components/Master/MasterTree.vue
@@ -103,7 +103,12 @@
      const result = this.$route.query.id.substring(0, index);
      this.idData = result;
      this.removeList();
      getTreeList({'conditionMap[id]': this.idData}).then(res => {
      let conditionMaps = {};
      conditionMaps["conditionMap[id]"] = this.idData;
      conditionMaps["conditionMap[authType]"] = "data_auth";
      // æ•°æ®æŽˆæƒä¸­æ˜¯å¦å…·å¤‡æŸ¥çœ‹æƒé™
      conditionMaps["conditionMap[menuCode]"] = "data_view";
      getTreeList(conditionMaps).then(res => {
        if (res) {
          if (res.data.length === 0) {
            this.$message.error("主数据分类查询为空!");
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
@@ -876,7 +876,11 @@
    getAttr() {
      this.loading = true;
      return new Promise((resolve, reject) => {
        getAtrrList()
        let conditionMaps = {};
        conditionMaps["conditionMap[authType]"] = "classify_auth";
        // åˆ†ç±»æŽˆæƒä¸­æ˜¯å¦å…·å¤‡æŸ¥çœ‹æƒé™
        conditionMaps["conditionMap[menuCode]"] = "classify_view";
        getAtrrList(conditionMaps)
          .then(res => {
            this.Treedata = res.data;
            this.CloneTreedata = res.data;
Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClient.java
@@ -392,6 +392,6 @@
    R<List<String>> getRegexByList(@RequestBody List<String> combinationIds);
    @GetMapping(GETVIEWCLASSIFY)
    R<List<String>> getViewClassByRoleIds(@RequestParam("roleIds") List<String> roleIds);
    R<List<String>> getViewClassByRoleIds(@RequestParam("roleIds") List<String> roleIds,@RequestParam("authType") String authType,@RequestParam("menuCode") String menuCode);
}
Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClientFallback.java
@@ -200,9 +200,8 @@
    }
    @Override
    public R<List<String>> getViewClassByRoleIds(List<String> roleIds) {
    public R<List<String>> getViewClassByRoleIds(List<String> roleIds,String authType,String menuCode) {
        return R.fail("获取数据失败");
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java
@@ -134,14 +134,14 @@
     * @param treeQueryObject æ ‘形查询对象
     * @return ä¸»é¢˜åº“分类显示树
     */
    List<Tree> referTree(TreeQueryObject treeQueryObject);
    List<Tree> referTree(TreeQueryObject treeQueryObject) throws ServiceException;
    /**
     * æŸ¥è¯¢ä¸»é¢˜åº“分类 æ ‘
     * @param treeQueryObject æ ‘查询对象
     * @return ä¸»é¢˜åº“分类 æ˜¾ç¤ºæ ‘
     */
    List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject);
    List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject) throws ServiceException;
    /**
     * å¯¼å‡ºåˆ†ç±»
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
@@ -510,7 +510,7 @@
     * @return ä¸»é¢˜åº“分类显示树
     */
    @Override
    public List<Tree> referTree(TreeQueryObject treeQueryObject) {
    public List<Tree> referTree(TreeQueryObject treeQueryObject) throws ServiceException{
        if(treeQueryObject == null){
            treeQueryObject = new TreeQueryObject();
        }
@@ -520,7 +520,7 @@
        if(treeQueryObject.getConditionMap().containsKey(LC_STATUS)) {
            treeQueryObject.getConditionMap().remove(LC_STATUS);
        }
        if(treeQueryObject.getExtandParamsMap() ==null || !treeQueryObject.getExtandParamsMap().containsKey(REFER_SHOW_DISABLED_QUERY_KEY)) {
        if(treeQueryObject.getExtandParamsMap() == null || !treeQueryObject.getExtandParamsMap().containsKey(REFER_SHOW_DISABLED_QUERY_KEY)) {
        }
        treeQueryObject.getConditionMap().put(LC_STATUS, FRAMEWORK_DATA_ENABLED);
        return treeCodeClassify(treeQueryObject);
@@ -550,7 +550,7 @@
     * @return ä¸»é¢˜åº“分类 æ˜¾ç¤ºæ ‘
     */
    @Override
    public List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject) {
    public List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject) throws ServiceException{
        List<CodeClassify> doList = null;
        String id = null;
        String lcStatus = null;
@@ -597,10 +597,10 @@
            }
        }else {
            // é‚£äº›åˆ†ç±»å…·å¤‡æŸ¥çœ‹æƒé™
            R<List<String>> viewClassByRoleIds = sysClient.getViewClassByRoleIds(Arrays.asList(AuthUtil.getUser().getRoleId().split(",")));
            R<List<String>> viewClassByRoleIds = sysClient.getViewClassByRoleIds(Arrays.asList(AuthUtil.getUser().getRoleId().split(",")),treeQueryObject.getConditionMap().getOrDefault("authType","classify_auth"),treeQueryObject.getConditionMap().getOrDefault("menuCode","classify_view"));
            // è¯·æ±‚失败或者请求得到的具备查看权限的分类id集合为空
            if(!viewClassByRoleIds.isSuccess() && !viewClassByRoleIds.getData().isEmpty()){
                return new ArrayList<>();
            if(!viewClassByRoleIds.isSuccess() && viewClassByRoleIds.getData().isEmpty()){
                throw new ServiceException("主数据查看权限未配置,或配置有误!");
            }
            // è¿‡æ»¤
            filterTreeNodes(tree,viewClassByRoleIds.getData());
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
ÎļþÌ«´ó
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/feign/SysClient.java
@@ -264,8 +264,8 @@
        return R.data(mdmCountConfigService.getMdmCountConfig(userId));
    }
    public R<List<String>> getViewClassByRoleIds(List<String> roleIds){
        return R.data(classifyAuthService.getViewClassByRoleIds(roleIds));
    public R<List<String>> getViewClassByRoleIds(List<String> roleIds,String authType,String menuCode){
        return R.data(classifyAuthService.getViewClassByRoleIds(roleIds,authType,menuCode));
    }
}
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/mapper/ClassifyAuthMapper.java
@@ -15,6 +15,6 @@
    List<ClassifyAuth> getClassifyAuthList(@Param("classifyId") String classifyId);
    List<String> getViewClassByRoleIds(@Param("roleIds") List<String> roleIds);
    List<String> getViewClassByRoleIds(@Param("roleIds") List<String> roleIds,@Param("authType") String authType,@Param("menuCode") String menuCode);
}
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IClassifyAuthService.java
@@ -53,6 +53,6 @@
     * @param roleIds
     * @return
     */
    List<String> getViewClassByRoleIds(List<String> roleIds);
    List<String> getViewClassByRoleIds(List<String> roleIds,String authType,String menuCode);
}
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/ClassifyAuthServiceImpl.java
@@ -183,11 +183,11 @@
     * @return
     */
    @Override
    public List<String> getViewClassByRoleIds(List<String> roleIds) {
    public List<String> getViewClassByRoleIds(List<String> roleIds,String authType,String menuCode) {
        if(roleIds.isEmpty()){
            return new ArrayList<>();
        }
        return this.classifyAuthMapper.getViewClassByRoleIds(roleIds);
        return this.classifyAuthMapper.getViewClassByRoleIds(roleIds, authType,menuCode);
    }
}
Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/ClassifyAuthMapper.xml
@@ -25,10 +25,10 @@
                #{item}
            </foreach>
        </if>
          AND AUTH_TYPE = #{authType}
          AND BUTTON_IDS LIKE CONCAT('%', CONCAT((SELECT ID
                                                  FROM PL_SYS_MENU
                                                  WHERE CODE = 'classify_view'), '%'))
                                      FROM PL_SYS_MENU
                                      WHERE CODE = #{menuCode}), '%'))
    </select>
Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/MenuMapper.xml
@@ -44,19 +44,19 @@
        <result column="key" property="key"/>
    </resultMap>
    <select id="lazyList"  resultMap="menuVOResultMap">
    <select id="lazyList" resultMap="menuVOResultMap">
        SELECT
            menu.*,
            (
                SELECT
                    CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END
            FROM
                pl_sys_menu
            WHERE
                parent_id = menu.id AND is_deleted = 0
        menu.*,
        (
        SELECT
        CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END
        FROM
        pl_sys_menu
        WHERE
        parent_id = menu.id AND is_deleted = 0
        ) AS "has_children"
        FROM
            pl_sys_menu menu
        pl_sys_menu menu
        WHERE menu.is_deleted = 0
        <if test="param1!=null">
            and menu.parent_id = #{param1}
@@ -75,17 +75,17 @@
    <select id="lazyMenuPage" resultMap="menuVOResultMap">
        SELECT
            menu.*,
            (
                SELECT
                    CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END
        menu.*,
        (
        SELECT
        CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END
        FROM
                pl_sys_menu
        pl_sys_menu
        WHERE
        parent_id = menu.id AND is_deleted = 0  AND category = 1
        parent_id = menu.id AND is_deleted = 0 AND category = 1
        ) AS "has_children"
        FROM
            pl_sys_menu menu
        pl_sys_menu menu
        WHERE menu.is_deleted = 0 AND menu.category = 1
        <if test="param1!=null">
            and menu.parent_id = #{param1}
@@ -103,11 +103,17 @@
    </select>
    <select id="tree" resultMap="treeNodeResultMap">
        select id, parent_id, name as title, id as "value", id as "key" from pl_sys_menu where is_deleted = 0 and category = 1
        select id, parent_id, name as title, id as "value", id as "key"
        from pl_sys_menu
        where is_deleted = 0
          and category = 1
    </select>
    <select id="allMenu" resultMap="menuResultMap">
        select * from pl_sys_menu where is_deleted = 0 and category = 1
        select *
        from pl_sys_menu
        where is_deleted = 0
          and category = 1
    </select>
    <select id="roleMenu" resultMap="menuResultMap">
@@ -127,49 +133,56 @@
    <select id="roleMenuByRoleId" resultMap="menuResultMap">
        select * from pl_sys_menu where is_deleted = 0 and id IN
            ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
                <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            )
        ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        )
    </select>
    <select id="roleMenuByTopMenuId" resultMap="menuResultMap">
        select * from pl_sys_menu where is_deleted = 0 and id IN
        select *
        from pl_sys_menu
        where is_deleted = 0
          and id IN
              (
                  SELECT menu_id FROM pl_sys_top_menu_setting WHERE top_menu_id = #{param1}
                  SELECT menu_id
                  FROM pl_sys_top_menu_setting
                  WHERE top_menu_id = #{param1}
              )
    </select>
    <select id="routes" resultMap="menuResultMap">
        SELECT
            *
        *
        FROM
            pl_sys_menu
        pl_sys_menu
        WHERE
            is_deleted = 0 and category = 1
            and id IN ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
                        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                            #{item}
                        </foreach> )
        is_deleted = 0 and category = 1
        and id IN ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        )
    </select>
    <select id="allButtons" resultMap="menuResultMap">
        SELECT
            id,
            parent_id,
            CODE,
            NAME,
            alias,
            path,
            source,
        SELECT id,
               parent_id,
               CODE,
               NAME,
               alias,
               path,
               source,
            action,
            sort
        FROM
            pl_sys_menu
        WHERE
            (
                category = 2 OR id IN ( SELECT parent_id FROM pl_sys_menu WHERE is_deleted = 0 AND category = 2 )
            category = 2
           OR id IN ( SELECT parent_id FROM pl_sys_menu WHERE is_deleted = 0
          AND category = 2 )
            )
          AND is_deleted = 0
        ORDER BY sort
@@ -177,74 +190,78 @@
    <select id="buttons" resultMap="menuResultMap">
        SELECT * FROM (
            SELECT
                id,
                parent_id,
                code,
                name,
                alias,
                path,
                source,
                action,
                sort
            FROM
                pl_sys_menu
            WHERE
                is_deleted = 0 and id IN (
                  SELECT parent_id FROM pl_sys_menu
                  WHERE ( category = 2 AND id IN ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
                    <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                        #{item}
                    </foreach>
                  ) ) )
            UNION ALL
        SELECT
        id,
        parent_id,
        code,
        name,
        alias,
        path,
        source,
        action,
        sort
        FROM
        pl_sys_menu
        WHERE
        is_deleted = 0 and id IN (
        SELECT parent_id FROM pl_sys_menu
        WHERE ( category = 2 AND id IN ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        ) ) )
        UNION ALL
            SELECT
                id,
                parent_id,
                code,
                name,
                alias,
                path,
                source,
                action,
                sort
            FROM
                pl_sys_menu
            WHERE
                is_deleted = 0 and  category = 2 AND id IN ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
                <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>)
        SELECT
        id,
        parent_id,
        code,
        name,
        alias,
        path,
        source,
        action,
        sort
        FROM
        pl_sys_menu
        WHERE
        is_deleted = 0 and category = 2 AND id IN ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>)
        ) menu ORDER BY sort
    </select>
    <select id="getButtonsByRoleIdAndCode" resultMap="menuResultMap">
        SELECT pm.*
        FROM PL_SYS_MENU ps,
             PL_SYS_MENU pm,
             PL_ORG_ROLE_MENU prom
        WHERE ps.ID = prom.MENU_ID
          <if test="roleId != null and roleId != ''">
              AND prom.ROLE_ID = #{roleId}
          </if>
            AND ps."CATEGORY" = 1
            AND pm.IS_DELETED = 0
          <if test="code != null and code != ''">
        PL_SYS_MENU pm
        <if test="roleId != null and roleId != ''">
            ,PL_ORG_ROLE_MENU prom
        </if>
        WHERE
        ps."CATEGORY" = 1
        <if test="roleId != null and roleId != ''">
            AND ps.ID = prom.MENU_ID
            AND prom.ROLE_ID = #{roleId}
        </if>
        AND pm.IS_DELETED = 0
        <if test="code != null and code != ''">
            AND ps.ID = pm.PARENT_ID
            AND ps.CODE = #{code}
          </if>
        </if>
        ORDER BY pm.SORT ASC
    </select>
    <select id="grantTree" resultMap="treeNodeResultMap">
        select
               id,
        select id,
               parent_id,
               name as title,
               id as "value",
               id as "key"
        from pl_sys_menu where is_deleted = 0 order by sort
               id   as "value",
               id   as "key"
        from pl_sys_menu
        where is_deleted = 0
        order by sort
    </select>
    <select id="grantTreeByRole" resultMap="treeNodeResultMap">
@@ -252,102 +269,95 @@
        and id in ( select menu_id from pl_org_role_menu where role_id in
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach> )
        or id in (
            select parent_id from pl_sys_menu where is_deleted = 0
            and id in ( select menu_id from pl_org_role_menu where role_id in
            <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach> )
          )
        order by sort
    </select>
    <select id="grantTopTree" resultMap="treeNodeResultMap">
        select id, parent_id, name as title, id as "value", id as "key" from pl_sys_menu where category = 1 and is_deleted = 0 order by sort
    </select>
    <select id="grantTopTreeByRole" resultMap="treeNodeResultMap">
        select id, parent_id, name as title, id as "value", id as "key" from pl_sys_menu where category = 1 and is_deleted = 0
        and id in ( select menu_id from pl_org_role_menu where role_id in
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach> )
        </foreach>
        )
        or id in (
        select parent_id from pl_sys_menu where is_deleted = 0
        and id in ( select menu_id from pl_org_role_menu where role_id in
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach> )
        </foreach>
        )
        )
        order by sort
    </select>
    <select id="grantTopTree" resultMap="treeNodeResultMap">
        select id, parent_id, name as title, id as "value", id as "key"
        from pl_sys_menu
        where category = 1
          and is_deleted = 0
        order by sort
    </select>
    <select id="grantTopTreeByRole" resultMap="treeNodeResultMap">
        select id, parent_id, name as title, id as "value", id as "key" from pl_sys_menu where category = 1 and
        is_deleted = 0
        and id in ( select menu_id from pl_org_role_menu where role_id in
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        )
        or id in (
        select parent_id from pl_sys_menu where is_deleted = 0
        and id in ( select menu_id from pl_org_role_menu where role_id in
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        )
        )
        order by sort
    </select>
    <select id="grantDataScopeTree" resultMap="treeNodeResultMap">
        SELECT
            *
        FROM
            (
                SELECT
                    id,
                    parent_id,
                    NAME AS title,
                    id AS "value",
                    id AS "key"
                FROM
                    pl_sys_menu
                WHERE
                    category = 1
                  AND is_deleted = 0
                  AND id IN ( SELECT menu_id FROM pl_auth_scope_data WHERE is_deleted = 0 AND menu_id IS NOT NULL )
            ) menu
        SELECT *
        FROM (
                 SELECT id,
                        parent_id,
                        NAME AS title,
                        id   AS "value",
                        id   AS "key"
                 FROM pl_sys_menu
                 WHERE category = 1
                   AND is_deleted = 0
                   AND id IN (SELECT menu_id FROM pl_auth_scope_data WHERE is_deleted = 0 AND menu_id IS NOT NULL)
             ) menu
        UNION ALL
        SELECT
            id,
            menu_id AS parent_id,
            scope_name AS title,
            id AS "value",
            id AS "key"
        FROM
            pl_auth_scope_data
        WHERE
            is_deleted = 0
        SELECT id,
               menu_id    AS parent_id,
               scope_name AS title,
               id         AS "value",
               id         AS "key"
        FROM pl_auth_scope_data
        WHERE is_deleted = 0
          AND menu_id IS NOT NULL
    </select>
    <select id="grantApiScopeTree" resultMap="treeNodeResultMap">
        SELECT
            *
        FROM
            (
                SELECT
                    id,
                    parent_id,
                    NAME AS title,
                    id AS "value",
                    id AS "key"
                FROM
                    pl_sys_menu
                WHERE
                    category = 1
                  AND is_deleted = 0
                  AND id IN ( SELECT menu_id FROM pl_auth_scope_api WHERE is_deleted = 0 AND menu_id IS NOT NULL )
            ) menu
        SELECT *
        FROM (
                 SELECT id,
                        parent_id,
                        NAME AS title,
                        id   AS "value",
                        id   AS "key"
                 FROM pl_sys_menu
                 WHERE category = 1
                   AND is_deleted = 0
                   AND id IN (SELECT menu_id FROM pl_auth_scope_api WHERE is_deleted = 0 AND menu_id IS NOT NULL)
             ) menu
        UNION ALL
        SELECT
            id,
            menu_id AS parent_id,
            scope_name AS title,
            id AS "value",
            id AS "key"
        FROM
            pl_auth_scope_api
        WHERE
            is_deleted = 0
        SELECT id,
               menu_id    AS parent_id,
               scope_name AS title,
               id         AS "value",
               id         AS "key"
        FROM pl_auth_scope_api
        WHERE is_deleted = 0
          AND menu_id IS NOT NULL
    </select>
@@ -356,61 +366,63 @@
        *
        FROM
        (
            SELECT
                id,
                parent_id,
                NAME AS title,
                id AS "value",
                id AS "key"
            FROM
                pl_sys_menu
            WHERE
                category = 1
            AND is_deleted = 0
            AND id IN ( SELECT menu_id FROM pl_auth_scope_data WHERE is_deleted = 0 AND menu_id IS NOT NULL )
            AND (
                id IN (
                    select menu_id from pl_org_role_menu where role_id in
                    <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                        #{item}
                    </foreach>
                )
                OR id IN (
                    select parent_id from pl_sys_menu where is_deleted = 0
                    and id in ( select menu_id from pl_org_role_menu where role_id in
                    <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                        #{item}
                    </foreach> )
                )
            )
        SELECT
        id,
        parent_id,
        NAME AS title,
        id AS "value",
        id AS "key"
        FROM
        pl_sys_menu
        WHERE
        category = 1
        AND is_deleted = 0
        AND id IN ( SELECT menu_id FROM pl_auth_scope_data WHERE is_deleted = 0 AND menu_id IS NOT NULL )
        AND (
        id IN (
        select menu_id from pl_org_role_menu where role_id in
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        )
        OR id IN (
        select parent_id from pl_sys_menu where is_deleted = 0
        and id in ( select menu_id from pl_org_role_menu where role_id in
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        )
        )
        )
        ) menu
        UNION ALL
        SELECT
            id,
            menu_id AS parent_id,
            scope_name AS title,
            id AS "value",
            id AS "key"
        id,
        menu_id AS parent_id,
        scope_name AS title,
        id AS "value",
        id AS "key"
        FROM
            pl_auth_scope_data
        pl_auth_scope_data
        WHERE
            is_deleted = 0
        is_deleted = 0
        AND (
            menu_id IN (
                select menu_id from pl_org_role_menu where role_id in
                <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            )
            OR menu_id IN (
                select parent_id from pl_sys_menu where is_deleted = 0
                and id in ( select menu_id from pl_org_role_menu where role_id in
                <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach> )
            )
        menu_id IN (
        select menu_id from pl_org_role_menu where role_id in
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        )
        OR menu_id IN (
        select parent_id from pl_sys_menu where is_deleted = 0
        and id in ( select menu_id from pl_org_role_menu where role_id in
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        )
        )
        )
        AND menu_id IS NOT NULL
    </select>
@@ -420,125 +432,133 @@
        *
        FROM
        (
            SELECT
                id,
                parent_id,
                NAME AS title,
                id AS "value",
                id AS "key"
            FROM
                pl_sys_menu
            WHERE
                category = 1
            AND is_deleted = 0
            AND id IN ( SELECT menu_id FROM pl_auth_scope_api WHERE is_deleted = 0 AND menu_id IS NOT NULL )
            AND (
                id IN (
                    select menu_id from pl_org_role_menu where role_id in
                    <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                        #{item}
                    </foreach>
                )
                OR id IN (
                    select parent_id from pl_sys_menu where is_deleted = 0
                    and id in (
                        select menu_id from pl_org_role_menu where role_id in
                    <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                        #{item}
                    </foreach> )
                )
            )
        SELECT
        id,
        parent_id,
        NAME AS title,
        id AS "value",
        id AS "key"
        FROM
        pl_sys_menu
        WHERE
        category = 1
        AND is_deleted = 0
        AND id IN ( SELECT menu_id FROM pl_auth_scope_api WHERE is_deleted = 0 AND menu_id IS NOT NULL )
        AND (
        id IN (
        select menu_id from pl_org_role_menu where role_id in
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        )
        OR id IN (
        select parent_id from pl_sys_menu where is_deleted = 0
        and id in (
        select menu_id from pl_org_role_menu where role_id in
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        )
        )
        )
        ) menu
        UNION ALL
        SELECT
            id,
            menu_id AS parent_id,
            scope_name AS title,
            id AS "value",
            id AS "key"
        id,
        menu_id AS parent_id,
        scope_name AS title,
        id AS "value",
        id AS "key"
        FROM
            pl_auth_scope_api
        pl_auth_scope_api
        WHERE
            is_deleted = 0
        is_deleted = 0
        AND
            (
                menu_id IN (
                    select menu_id from pl_org_role_menu where role_id in
                    <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                        #{item}
                    </foreach>
                )
            OR menu_id IN (
                    select parent_id from pl_sys_menu where is_deleted = 0
                    and id in ( select menu_id from pl_org_role_menu where role_id in
                    <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                        #{item}
                    </foreach> )
                )
        (
        menu_id IN (
        select menu_id from pl_org_role_menu where role_id in
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        )
        OR menu_id IN (
        select parent_id from pl_sys_menu where is_deleted = 0
        and id in ( select menu_id from pl_org_role_menu where role_id in
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        )
        )
        )
        AND menu_id IS NOT NULL
    </select>
    <select id="authRoutes" resultType="com.vci.ubcs.system.dto.MenuDTO">
        SELECT
            GROUP_CONCAT(r.role_alias) as alias,
            m.path
        GROUP_CONCAT(r.role_alias) as alias,
        m.path
        FROM
            pl_org_role_menu rm
            LEFT JOIN pl_sys_menu m ON rm.menu_id = m.id
            LEFT JOIN pl_org_role r ON rm.role_id = r.id
        pl_org_role_menu rm
        LEFT JOIN pl_sys_menu m ON rm.menu_id = m.id
        LEFT JOIN pl_org_role r ON rm.role_id = r.id
        WHERE
            rm.role_id IN
            <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
            AND m.path IS NOT NULL and m.is_deleted = 0
        rm.role_id IN
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        AND m.path IS NOT NULL and m.is_deleted = 0
        GROUP BY m.path
    </select>
    <select id="selectMenuChildByBtnType" resultMap="menuResultMap">
        select pm.*
            from pl_sys_menu ps, pl_sys_menu pm
        from pl_sys_menu ps, pl_sys_menu pm
        where pm.is_deleted = 0
          and ps.category = 1
          and ps.CODE = #{btmType}
          and ps.ID = pm.PARENT_ID
          <if test="roleIds != null and roleIds != ''">
            and ps.ID in (
                SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
                <foreach collection="roleIds" index="index" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            )
          </if>
        and ps.category = 1
        and ps.CODE = #{btmType}
        and ps.ID = pm.PARENT_ID
        <if test="roleIds != null and roleIds != ''">
            and ps.ID in
            SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
            <foreach collection="roleIds" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        order by pm.sort asc
    </select>
    <select id="getButtonByIdsOrByParentCode" resultMap="menuResultMap">
        SELECT pm.*
        FROM PL_SYS_MENU ps,
        PL_SYS_MENU pm,
        PL_ORG_ROLE_MENU prom
        WHERE ps.ID = prom.MENU_ID
        <if test="roleIds != null and roleIds != ''">
            AND prom.ROLE_ID in (#{roleIds})
        </if>
          AND ps."CATEGORY" = 1
          AND pm.IS_DELETED = 0
        <if test="code != null and code != ''">
            AND ps.ID = pm.PARENT_ID
            AND ps.CODE = #{code}
        </if>
        <if test="ids != null and ids != ''">
            AND ps.ID IN (
        SELECT
            pm.*
        FROM
            PL_SYS_MENU pm
            <if test="code != null and code != ''">
                ,PL_SYS_MENU ps
            </if>
            <if test="roleIds != null and roleIds != ''">
                ,PL_ORG_ROLE_MENU prom
            </if>
        WHERE
            pm.IS_DELETED = 0
            AND pm."CATEGORY" = 2
            <if test="code != null and code != ''">
                AND ps."CATEGORY" = 1
                AND ps.ID = pm.PARENT_ID
                AND ps.CODE = #{code}
            </if>
            <if test="roleIds != null and roleIds != ''">
                AND pm.ID = prom.MENU_ID
                AND prom.ROLE_ID in (#{roleIds})
            </if>
            <if test="ids != null and ids != ''">
                AND pm.ID IN
                <foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            )
        </if>
        ORDER BY pm.SORT ASC
            </if>
        ORDER BY SORT ASC
    </select>
</mapper>