Commit b4e28246 by 墨竹

feat:权限新增接口

parent b19562ba
...@@ -19,4 +19,15 @@ public interface HaobanMenuApiService { ...@@ -19,4 +19,15 @@ public interface HaobanMenuApiService {
* @date 2022-09-07 09:50:37 * @date 2022-09-07 09:50:37
*/ */
ServiceResponse<List<HaobanMenuDTO>> getMenuTreeList(); ServiceResponse<List<HaobanMenuDTO>> getMenuTreeList();
/**
* 得到haoban菜单树列表
*
* @param wxEnterpriseId wx企业标识
* @param clerkType 职员类型
* @return {@link ServiceResponse}<{@link List}<{@link HaobanMenuDTO}>>
*/
ServiceResponse<List<HaobanMenuDTO>> getHaobanMenuTreeList(String wxEnterpriseId,Integer clerkType);
} }
...@@ -31,18 +31,6 @@ public interface HaobanRoleApiService { ...@@ -31,18 +31,6 @@ public interface HaobanRoleApiService {
*/ */
ServiceResponse edit(HaobanRoleQDTO haobanRoleQDTO,WebLoginDTO login); ServiceResponse edit(HaobanRoleQDTO haobanRoleQDTO,WebLoginDTO login);
/**
* 根据类型查询企业的菜单权限
* @param wxEnterpriseId wx企业标识
* @param clerkType 职员类型
* @return {@link ServiceResponse }
* @author mozhu
* @date 2022-09-07 14:02:21
*/
ServiceResponse getByWxEnterpriseIdAndClerkType(String wxEnterpriseId, Integer clerkType);
/** /**
* 通过wx企业id和角色id 查询菜单 * 通过wx企业id和角色id 查询菜单
* *
...@@ -53,4 +41,5 @@ public interface HaobanRoleApiService { ...@@ -53,4 +41,5 @@ public interface HaobanRoleApiService {
* @date 2022-09-13 14:56:09 * @date 2022-09-13 14:56:09
*/ */
ServiceResponse getByWxEnterpriseIdAndRoleId(String wxEnterpriseId,Long roleId); ServiceResponse getByWxEnterpriseIdAndRoleId(String wxEnterpriseId,Long roleId);
} }
...@@ -6,8 +6,6 @@ import org.apache.ibatis.annotations.Param; ...@@ -6,8 +6,6 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/** /**
*
*
* @author mozhu * @author mozhu
* @since 2022-09-06 16:35:10 * @since 2022-09-06 16:35:10
*/ */
...@@ -53,5 +51,16 @@ public interface TabHaobanMenuMapper { ...@@ -53,5 +51,16 @@ public interface TabHaobanMenuMapper {
* @date 2022-09-07 09:54:05 * @date 2022-09-07 09:54:05
*/ */
List<TabHaobanMenu> getAllMenuList(); List<TabHaobanMenu> getAllMenuList();
/**
* 得到haoban菜单列表
*
* @param wxEnterpriseId wx企业标识
* @param clerkType 职员类型
* @return {@link List}<{@link TabHaobanMenu}>
*/
List<TabHaobanMenu> getHaobanMenuList(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("clerkType") Integer clerkType);
} }
...@@ -23,4 +23,9 @@ public class HaobanMenuApiServiceImpl implements HaobanMenuApiService { ...@@ -23,4 +23,9 @@ public class HaobanMenuApiServiceImpl implements HaobanMenuApiService {
return ServiceResponse.success(EntityUtil.changeEntityListNew(HaobanMenuDTO.class,menuTreeList)); return ServiceResponse.success(EntityUtil.changeEntityListNew(HaobanMenuDTO.class,menuTreeList));
} }
@Override
public ServiceResponse<List<HaobanMenuDTO>> getHaobanMenuTreeList(String wxEnterpriseId, Integer clerkType) {
List<HaobanMenuBO> haobanMenuBOList = haobanMenuService.getHaobanMenuTreeList(wxEnterpriseId, clerkType);
return ServiceResponse.success(EntityUtil.changeEntityListNew(HaobanMenuDTO.class,haobanMenuBOList));
}
} }
...@@ -9,7 +9,6 @@ import com.gic.haoban.manage.api.enums.role.RoleClerkTypeEnum; ...@@ -9,7 +9,6 @@ import com.gic.haoban.manage.api.enums.role.RoleClerkTypeEnum;
import com.gic.haoban.manage.api.service.role.HaobanRoleApiService; import com.gic.haoban.manage.api.service.role.HaobanRoleApiService;
import com.gic.haoban.manage.service.entity.role.TabHaobanRole; import com.gic.haoban.manage.service.entity.role.TabHaobanRole;
import com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu; import com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu;
import com.gic.haoban.manage.service.pojo.bo.role.HaobanRoleBO;
import com.gic.haoban.manage.service.service.role.HaobanRoleMenuService; import com.gic.haoban.manage.service.service.role.HaobanRoleMenuService;
import com.gic.haoban.manage.service.service.role.HaobanRoleService; import com.gic.haoban.manage.service.service.role.HaobanRoleService;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -160,12 +159,6 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService { ...@@ -160,12 +159,6 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
} }
@Override @Override
public ServiceResponse getByWxEnterpriseIdAndClerkType(String wxEnterpriseId, Integer clerkType) {
List<HaobanRoleBO> haobanRoleBOList = haobanRoleService.getByWxEnterpriseIdAndClerkType(wxEnterpriseId, clerkType);
return ServiceResponse.success(haobanRoleBOList);
}
@Override
public ServiceResponse getByWxEnterpriseIdAndRoleId(String wxEnterpriseId, Long roleId) { public ServiceResponse getByWxEnterpriseIdAndRoleId(String wxEnterpriseId, Long roleId) {
List<String> menuCodes = haobanRoleMenuService.getByWxEnterpriseIdAndRoleId(wxEnterpriseId, roleId); List<String> menuCodes = haobanRoleMenuService.getByWxEnterpriseIdAndRoleId(wxEnterpriseId, roleId);
return ServiceResponse.success(menuCodes); return ServiceResponse.success(menuCodes);
......
...@@ -45,4 +45,12 @@ public interface HaobanMenuService { ...@@ -45,4 +45,12 @@ public interface HaobanMenuService {
*/ */
List<HaobanMenuBO> getMenuTreeList(); List<HaobanMenuBO> getMenuTreeList();
/**
* 得到haoban菜单树列表
*
* @param wxEnterpriseId wx企业标识
* @param clerkType 职员类型
* @return {@link List}<{@link HaobanMenuBO}>
*/
List<HaobanMenuBO> getHaobanMenuTreeList(String wxEnterpriseId, Integer clerkType);
} }
...@@ -67,16 +67,26 @@ public class HaobanMenuServiceImpl implements HaobanMenuService { ...@@ -67,16 +67,26 @@ public class HaobanMenuServiceImpl implements HaobanMenuService {
return menuBOList; return menuBOList;
} }
@Override
public List<HaobanMenuBO> getHaobanMenuTreeList(String wxEnterpriseId, Integer clerkType) {
List<TabHaobanMenu> tabHaobanMenuList = tabHaobanMenuMapper.getHaobanMenuList(wxEnterpriseId, clerkType);
List<HaobanMenuBO> menuBOList = EntityUtil.changeEntityListNew(HaobanMenuBO.class, tabHaobanMenuList);
for (HaobanMenuBO haobanMenuBO : menuBOList) {
List<HaobanMenuBO> menus = iterateMenus(menuBOList, haobanMenuBO.getMenuCode());
haobanMenuBO.setMenuBOList(menus);
}
return menuBOList;
}
public List<HaobanMenuBO> iterateMenus(List<HaobanMenuBO> menuVoList, String pCode) { public List<HaobanMenuBO> iterateMenus(List<HaobanMenuBO> menuBOList, String pCode) {
List<HaobanMenuBO> result = new ArrayList<>(); List<HaobanMenuBO> result = new ArrayList<>();
for (HaobanMenuBO haobanMenuBO : menuVoList) { for (HaobanMenuBO haobanMenuBO : menuBOList) {
String menuCode = haobanMenuBO.getMenuCode(); String menuCode = haobanMenuBO.getMenuCode();
String parentCode = haobanMenuBO.getParentCode(); String parentCode = haobanMenuBO.getParentCode();
if (StringUtils.isNotBlank(parentCode)) { if (StringUtils.isNotBlank(parentCode)) {
if (parentCode.equals(pCode)) { if (parentCode.equals(pCode)) {
//递归查询当前子菜单的子菜单 //递归查询当前子菜单的子菜单
List<HaobanMenuBO> iterateMenu = iterateMenus(menuVoList, menuCode); List<HaobanMenuBO> iterateMenu = iterateMenus(menuBOList, menuCode);
haobanMenuBO.setMenuBOList(iterateMenu); haobanMenuBO.setMenuBOList(iterateMenu);
result.add(haobanMenuBO); result.add(haobanMenuBO);
} }
......
...@@ -41,7 +41,8 @@ ...@@ -41,7 +41,8 @@
values values
<foreach collection="entities" item="entity" separator=","> <foreach collection="entities" item="entity" separator=",">
(#{entity.menuCode}, #{entity.menuName}, #{entity.menuUrl}, #{entity.iconUrl}, (#{entity.menuCode}, #{entity.menuName}, #{entity.menuUrl}, #{entity.iconUrl},
#{entity.menuLevel}, #{entity.menuType}, #{entity.menuSort}, #{entity.parentCode}, #{entity.statusFlag},#{entity.routePath}, #{entity.menuLevel}, #{entity.menuType}, #{entity.menuSort}, #{entity.parentCode},
#{entity.statusFlag},#{entity.routePath},
#{entity.createTime}, #{entity.updateTime}) #{entity.createTime}, #{entity.updateTime})
</foreach> </foreach>
</insert> </insert>
...@@ -85,7 +86,7 @@ ...@@ -85,7 +86,7 @@
update_time = #{updateTime}, update_time = #{updateTime},
</if> </if>
</set> </set>
where menu_code = #{menuCode} where menu_code = #{menuCode}
</update> </update>
...@@ -96,5 +97,19 @@ ...@@ -96,5 +97,19 @@
where status_flag = 1 order by menu_sort where status_flag = 1 order by menu_sort
</select> </select>
<select id="getHaobanMenuList" resultMap="TabHaobanMenuMap">
select
c.*
from tab_haoban_role_menu a
left join tab_haoban_role b on a.role_id = b.role_id
left join tab_haoban_menu c on c.menu_code = a.menu_code
where
a.clerk_type = #{clerkType}
and a.wx_enterprise_id = #{wxEnterpriseId}
and c.status_flag = 1
order by c.menu_sort
</select>
</mapper> </mapper>
...@@ -54,13 +54,14 @@ public class HaobanRoleController extends WebBaseController{ ...@@ -54,13 +54,14 @@ public class HaobanRoleController extends WebBaseController{
} }
/** /**
* 根据类型查询角色 * 获取菜单
* @param clerkType
* @return * @return
*/ */
@RequestMapping(value = "/queryRoleByClerkType",method = RequestMethod.GET) @RequestMapping(value = "/getHaobanMenuTreeList",method = RequestMethod.GET)
private RestResponse queryRoleByClerkType(Integer clerkType) { private RestResponse getHaobanMenuTreeList(Integer clerkType) {
WebLoginDTO login = AuthWebRequestUtil.getLoginUser(); WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
ServiceResponse serviceResponse = haobanRoleApiService.getByWxEnterpriseIdAndClerkType(login.getWxEnterpriseId(), clerkType); ServiceResponse serviceResponse = haobanMenuApiService.getHaobanMenuTreeList(login.getWxEnterpriseId(), clerkType);
return RestResponse.successResult(serviceResponse.getResult()); return RestResponse.successResult(serviceResponse.getResult());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment