Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
4c03761d
Commit
4c03761d
authored
Sep 14, 2022
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:小程序生成默认权限
parent
7a41a380
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
261 additions
and
64 deletions
+261
-64
RoleClerkTypeEnum.java
...m/gic/haoban/manage/api/enums/role/RoleClerkTypeEnum.java
+40
-0
WxEnterpriseApiService.java
...gic/haoban/manage/api/service/WxEnterpriseApiService.java
+9
-0
HaobanRoleApiService.java
.../haoban/manage/api/service/role/HaobanRoleApiService.java
+1
-3
TabHaobanRoleMapper.java
...n/manage/service/dao/mapper/role/TabHaobanRoleMapper.java
+33
-4
TabHaobanRoleMenuMapper.java
...nage/service/dao/mapper/role/TabHaobanRoleMenuMapper.java
+10
-0
WxEnterpriseApiServiceImpl.java
.../service/service/out/impl/WxEnterpriseApiServiceImpl.java
+83
-37
HaobanRoleApiServiceImpl.java
...rvice/service/out/impl/role/HaobanRoleApiServiceImpl.java
+9
-7
HaobanRoleMenuService.java
...an/manage/service/service/role/HaobanRoleMenuService.java
+10
-0
HaobanRoleService.java
...haoban/manage/service/service/role/HaobanRoleService.java
+22
-4
HaobanRoleMenuServiceImpl.java
.../service/service/role/impl/HaobanRoleMenuServiceImpl.java
+5
-0
HaobanRoleServiceImpl.java
...nage/service/service/role/impl/HaobanRoleServiceImpl.java
+15
-5
TabHaobanRoleMapper.xml
...ce/src/main/resources/mapper/role/TabHaobanRoleMapper.xml
+19
-3
TabHaobanRoleMenuMapper.xml
...rc/main/resources/mapper/role/TabHaobanRoleMenuMapper.xml
+4
-0
HaobanRoleController.java
...ic/haoban/manage/web/controller/HaobanRoleController.java
+1
-1
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/role/RoleClerkTypeEnum.java
0 → 100644
View file @
4c03761d
package
com
.
gic
.
haoban
.
manage
.
api
.
enums
.
role
;
/**
* 好办小程序角色
*
* @author mozhu
* @date 2022-09-14 10:51:26
*/
public
enum
RoleClerkTypeEnum
{
//0:导购;1:店长;2:区经
CLERK
(
0
,
"导购"
),
SHOP
(
1
,
"店长"
),
MANAGE
(
2
,
"区经"
);
private
Integer
code
;
private
String
desc
;
RoleClerkTypeEnum
(
Integer
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/WxEnterpriseApiService.java
View file @
4c03761d
...
...
@@ -237,4 +237,13 @@ public interface WxEnterpriseApiService {
public
String
getEndDate
(
String
enterpriseId
)
;
/**
* 默认生成好办小程序权限
*
* @param wxEnterpriseId wx企业标识
* @author mozhu
* @date 2022-09-14 11:07:24
*/
void
addHaobanRole
(
String
wxEnterpriseId
);
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/role/HaobanRoleApiService.java
View file @
4c03761d
...
...
@@ -34,15 +34,13 @@ public interface HaobanRoleApiService {
/**
* 根据类型查询企业的菜单权限
*
* @param enterpriseId 企业标识
* @param wxEnterpriseId wx企业标识
* @param clerkType 职员类型
* @return {@link ServiceResponse }
* @author mozhu
* @date 2022-09-07 14:02:21
*/
ServiceResponse
getBy
EnterpriseIdAndClerkType
(
String
enterpriseId
,
String
wxEnterpriseId
,
Integer
clerkType
);
ServiceResponse
getBy
WxEnterpriseIdAndClerkType
(
String
wxEnterpriseId
,
Integer
clerkType
);
/**
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/role/TabHaobanRoleMapper.java
View file @
4c03761d
...
...
@@ -46,17 +46,46 @@ public interface TabHaobanRoleMapper {
int
update
(
TabHaobanRole
tabHaobanRole
);
/**
* 按角色删除id
*
* @param roleId 角色id
* @return int
* @author mozhu
* @date 2022-09-14 10:13:03
*/
int
deleteByRoleId
(
Long
roleId
);
/**
* 根据类型查询企业的菜单权限
*
* @param enterpriseId 企业标识
* @param wxEnterpriseId wx企业标识
* @param clerkType 职员类型
* @return {@link List }<{@link TabHaobanRole }>
* @author mozhu
* @date 2022-09-07 14:09:07
*/
List
<
TabHaobanRole
>
getByEnterpriseIdAndClerkType
(
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"clerkType"
)
Integer
clerkType
);
List
<
TabHaobanRole
>
getByWxEnterpriseIdAndClerkType
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"clerkType"
)
Integer
clerkType
);
/**
* 根据wx企业id获取数量
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-09-14 10:36:05
*/
int
getCountByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
/**
* 根据wx企业id 删除
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-09-14 10:17:21
*/
int
deleteByWxEnterpriseId
(
String
wxEnterpriseId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/role/TabHaobanRoleMenuMapper.java
View file @
4c03761d
...
...
@@ -74,5 +74,15 @@ public interface TabHaobanRoleMenuMapper {
*/
List
<
String
>
getByWxEnterpriseIdAndRoleId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"roleId"
)
Long
roleId
);
/**
* 根据wx企业id 删除
*
* @param wxEnterpriseId wx企业标识
* @return boolean
* @author mozhu
* @date 2022-09-14 10:40:18
*/
boolean
deleteByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/WxEnterpriseApiServiceImpl.java
View file @
4c03761d
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Set
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.DateUtil
;
...
...
@@ -26,37 +8,38 @@ import com.gic.enterprise.api.constant.EnterpriseServiceEnum;
import
com.gic.enterprise.api.dto.EnterpriseUsingPermissionDto
;
import
com.gic.enterprise.api.service.EnterpriseUseForbidService
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.manage.api.dto.CommonMQDTO
;
import
com.gic.haoban.manage.api.dto.MiniprogramSettingDTO
;
import
com.gic.haoban.manage.api.dto.QywxCorpInfoSimpleDTO
;
import
com.gic.haoban.manage.api.dto.SecretSettingDTO
;
import
com.gic.haoban.manage.api.dto.StaffPrivacyUseLogDTO
;
import
com.gic.haoban.manage.api.dto.WelcomeDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleMenuQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleQDTO
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.enums.role.RoleClerkTypeEnum
;
import
com.gic.haoban.manage.api.service.HaobanCommonMQApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.api.service.role.HaobanRoleApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeMapper
;
import
com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper
;
import
com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxApplication
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated
;
import
com.gic.haoban.manage.service.entity.TabMiniprogramSetting
;
import
com.gic.haoban.manage.service.entity.TabWelcome
;
import
com.gic.haoban.manage.service.entity.*
;
import
com.gic.haoban.manage.service.pojo.bo.StaffPrivacyUseLogBO
;
import
com.gic.haoban.manage.service.service.MiniprogramSettingService
;
import
com.gic.haoban.manage.service.service.SecretSettingService
;
import
com.gic.haoban.manage.service.service.StaffPrivacyUseLogService
;
import
com.gic.haoban.manage.service.service.WxApplicationService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.pojo.bo.role.HaobanRoleBO
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.haoban.manage.service.service.role.HaobanRoleMenuService
;
import
com.gic.haoban.manage.service.service.role.HaobanRoleService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
@Service
public
class
WxEnterpriseApiServiceImpl
implements
WxEnterpriseApiService
{
...
...
@@ -85,6 +68,13 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
private
EnterpriseUseForbidService
enterpriseUseForbidService
;
@Autowired
private
HaobanCommonMQApiService
haobanCommonMQApiService
;
@Autowired
private
HaobanRoleMenuService
haobanRoleMenuService
;
@Autowired
private
HaobanRoleService
haobanRoleService
;
@Autowired
private
HaobanRoleApiService
haobanRoleApiService
;
@Override
public
void
callbackReviceEnterprise
(
QywxCorpInfoSimpleDTO
dto
)
{
...
...
@@ -132,6 +122,9 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
}
wxDTO
.
setWxSecurityType
(
2
);
wxEnterpriseId
=
wxEnterpriseService
.
add
(
wxDTO
);
//好办小程序插入权限
log
.
info
(
"插入好办小程序权限:{}"
,
wxEnterpriseId
);
addHaobanRole
(
wxEnterpriseId
);
}
TabHaobanWxApplication
haobanWxApplication
=
wxApplicationService
.
selectBySiteIdAndWxEnterpriseId
(
siteId
,
wxEnterpriseId
);
if
(
haobanWxApplication
==
null
)
{
...
...
@@ -192,6 +185,7 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
}
agreeExternalUseridFlag
(
wxEnterpriseId
,
1
);
this
.
wxEnterpriseService
.
updateWxSecurityType
(
wxEnterpriseId
);
log
.
info
(
"企业微信授权处理完成"
);
}
...
...
@@ -525,4 +519,56 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
}
return
"好办服务已到期"
;
}
@Override
public
void
addHaobanRole
(
String
wxEnterpriseId
)
{
List
<
HaobanRoleBO
>
haobanRoleBOList
=
haobanRoleService
.
getByWxEnterpriseIdAndClerkType
(
"-1"
,
null
);
HaobanRoleQDTO
haobanRoleQDTO
=
new
HaobanRoleQDTO
();
HaobanRoleQDTO
haobanRoleSystemQDTO
=
new
HaobanRoleQDTO
();
for
(
HaobanRoleBO
haobanRoleBO
:
haobanRoleBOList
)
{
Long
roleId
=
haobanRoleBO
.
getRoleId
();
Integer
clerkType
=
haobanRoleBO
.
getClerkType
();
String
roleName
=
haobanRoleBO
.
getRoleName
();
int
count
=
haobanRoleService
.
getCountByWxEnterpriseId
(
wxEnterpriseId
);
//清除历史权限
if
(
count
>
0
)
{
haobanRoleService
.
deleteByWxEnterpriseId
(
wxEnterpriseId
);
haobanRoleMenuService
.
deleteByWxEnterpriseId
(
wxEnterpriseId
);
}
haobanRoleQDTO
.
setRoleName
(
roleName
);
haobanRoleSystemQDTO
.
setRoleName
(
roleName
);
List
<
String
>
menuCodes
=
haobanRoleMenuService
.
getByWxEnterpriseIdAndRoleId
(
"-1"
,
roleId
);
if
(
RoleClerkTypeEnum
.
CLERK
.
getCode
().
equals
(
clerkType
))
{
HaobanRoleMenuQDTO
clerkMenus
=
new
HaobanRoleMenuQDTO
();
clerkMenus
.
setClerkType
(
clerkType
);
clerkMenus
.
setMenuCodes
(
menuCodes
);
haobanRoleQDTO
.
setClerkMenus
(
clerkMenus
);
haobanRoleSystemQDTO
.
setClerkMenus
(
clerkMenus
);
}
else
if
(
RoleClerkTypeEnum
.
SHOP
.
getCode
().
equals
(
clerkType
))
{
HaobanRoleMenuQDTO
manegeClerkMenus
=
new
HaobanRoleMenuQDTO
();
manegeClerkMenus
.
setClerkType
(
clerkType
);
manegeClerkMenus
.
setMenuCodes
(
menuCodes
);
haobanRoleQDTO
.
setManegeClerkMenus
(
manegeClerkMenus
);
haobanRoleSystemQDTO
.
setManegeClerkMenus
(
manegeClerkMenus
);
}
else
if
(
RoleClerkTypeEnum
.
MANAGE
.
getCode
().
equals
(
clerkType
))
{
HaobanRoleMenuQDTO
managerMenus
=
new
HaobanRoleMenuQDTO
();
managerMenus
.
setClerkType
(
clerkType
);
managerMenus
.
setMenuCodes
(
menuCodes
);
haobanRoleQDTO
.
setManagerMenus
(
managerMenus
);
haobanRoleSystemQDTO
.
setManagerMenus
(
managerMenus
);
}
}
WebLoginDTO
login
=
new
WebLoginDTO
();
login
.
setWxEnterpriseId
(
wxEnterpriseId
);
login
.
setClerkId
(
"-1"
);
login
.
setClerkName
(
"系统"
);
//商户权限
haobanRoleApiService
.
add
(
haobanRoleQDTO
,
login
);
//运维系统权限
haobanRoleApiService
.
add
(
haobanRoleSystemQDTO
,
login
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/role/HaobanRoleApiServiceImpl.java
View file @
4c03761d
...
...
@@ -5,6 +5,7 @@ import com.gic.commons.util.UniqueIdUtils;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleMenuQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleQDTO
;
import
com.gic.haoban.manage.api.enums.role.RoleClerkTypeEnum
;
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.TabHaobanRoleMenu
;
...
...
@@ -23,6 +24,7 @@ import java.util.List;
@Service
public
class
HaobanRoleApiServiceImpl
implements
HaobanRoleApiService
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
HaobanRoleApiServiceImpl
.
class
);
@Autowired
...
...
@@ -44,7 +46,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
Date
now
=
new
Date
();
//导购
if
(
clerkMenus
!=
null
)
{
TabHaobanRole
tabHaobanRole
=
getTabHaobanRole
(
haobanRoleQDTO
,
wxEnterpriseId
,
clerkId
,
clerkName
,
haobanRoles
,
0
);
TabHaobanRole
tabHaobanRole
=
getTabHaobanRole
(
haobanRoleQDTO
,
wxEnterpriseId
,
clerkId
,
clerkName
,
haobanRoles
,
RoleClerkTypeEnum
.
CLERK
.
getCode
()
);
List
<
String
>
menuCodes
=
clerkMenus
.
getMenuCodes
();
for
(
String
menuCode
:
menuCodes
)
{
getTabHaobanRoleMenu
(
wxEnterpriseId
,
tabHaobanRoleMenus
,
now
,
tabHaobanRole
,
menuCode
);
...
...
@@ -53,7 +55,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
//店长
if
(
manegeClerkMenus
!=
null
)
{
TabHaobanRole
tabHaobanRole
=
getTabHaobanRole
(
haobanRoleQDTO
,
wxEnterpriseId
,
clerkId
,
clerkName
,
haobanRoles
,
1
);
TabHaobanRole
tabHaobanRole
=
getTabHaobanRole
(
haobanRoleQDTO
,
wxEnterpriseId
,
clerkId
,
clerkName
,
haobanRoles
,
RoleClerkTypeEnum
.
SHOP
.
getCode
()
);
List
<
String
>
menuCodes
=
manegeClerkMenus
.
getMenuCodes
();
for
(
String
menuCode
:
menuCodes
)
{
getTabHaobanRoleMenu
(
wxEnterpriseId
,
tabHaobanRoleMenus
,
now
,
tabHaobanRole
,
menuCode
);
...
...
@@ -62,7 +64,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
//区经
if
(
managerMenus
!=
null
)
{
TabHaobanRole
tabHaobanRole
=
getTabHaobanRole
(
haobanRoleQDTO
,
wxEnterpriseId
,
clerkId
,
clerkName
,
haobanRoles
,
2
);
TabHaobanRole
tabHaobanRole
=
getTabHaobanRole
(
haobanRoleQDTO
,
wxEnterpriseId
,
clerkId
,
clerkName
,
haobanRoles
,
RoleClerkTypeEnum
.
MANAGE
.
getCode
()
);
List
<
String
>
menuCodes
=
managerMenus
.
getMenuCodes
();
for
(
String
menuCode
:
menuCodes
)
{
getTabHaobanRoleMenu
(
wxEnterpriseId
,
tabHaobanRoleMenus
,
now
,
tabHaobanRole
,
menuCode
);
...
...
@@ -85,11 +87,11 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
tabHaobanRoleMenus
.
add
(
tabHaobanRoleMenu
);
}
private
TabHaobanRole
getTabHaobanRole
(
HaobanRoleQDTO
haobanRoleQDTO
,
String
wxEnterpriseId
,
String
clerkId
,
String
clerkName
,
List
<
TabHaobanRole
>
haobanRoles
,
int
i
)
{
private
TabHaobanRole
getTabHaobanRole
(
HaobanRoleQDTO
haobanRoleQDTO
,
String
wxEnterpriseId
,
String
clerkId
,
String
clerkName
,
List
<
TabHaobanRole
>
haobanRoles
,
int
clerkType
)
{
TabHaobanRole
tabHaobanRole
=
new
TabHaobanRole
();
tabHaobanRole
.
setRoleId
(
UniqueIdUtils
.
uniqueLong
());
tabHaobanRole
.
setRoleName
(
haobanRoleQDTO
.
getRoleName
());
tabHaobanRole
.
setClerkType
(
i
);
tabHaobanRole
.
setClerkType
(
clerkType
);
tabHaobanRole
.
setWxEnterpriseId
(
wxEnterpriseId
);
tabHaobanRole
.
setStatusFlag
(
1
);
tabHaobanRole
.
setCreatorId
(
clerkId
);
...
...
@@ -158,8 +160,8 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
}
@Override
public
ServiceResponse
getBy
EnterpriseIdAndClerkType
(
String
enterpriseId
,
String
wxEnterpriseId
,
Integer
clerkType
)
{
List
<
HaobanRoleBO
>
haobanRoleBOList
=
haobanRoleService
.
getBy
EnterpriseIdAndClerkType
(
enterpriseId
,
wxEnterpriseId
,
clerkType
);
public
ServiceResponse
getBy
WxEnterpriseIdAndClerkType
(
String
wxEnterpriseId
,
Integer
clerkType
)
{
List
<
HaobanRoleBO
>
haobanRoleBOList
=
haobanRoleService
.
getBy
WxEnterpriseIdAndClerkType
(
wxEnterpriseId
,
clerkType
);
return
ServiceResponse
.
success
(
haobanRoleBOList
);
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/role/HaobanRoleMenuService.java
View file @
4c03761d
...
...
@@ -75,4 +75,14 @@ public interface HaobanRoleMenuService {
* @date 2022-09-13 14:57:34
*/
List
<
String
>
getByWxEnterpriseIdAndRoleId
(
String
wxEnterpriseId
,
Long
roleId
);
/**
* 根据企业id删除权限
*
* @param wxEnterpriseId wx企业标识
* @return boolean
* @author mozhu
* @date 2022-09-14 10:39:43
*/
boolean
deleteByWxEnterpriseId
(
String
wxEnterpriseId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/role/HaobanRoleService.java
View file @
4c03761d
...
...
@@ -53,19 +53,37 @@ public interface HaobanRoleService {
* @param roleId 主键
* @return 是否成功
*/
boolean
deleteById
(
Long
roleId
);
boolean
deleteByRoleId
(
Long
roleId
);
/**
* 删除企业权限
*
* @param wxEnterpriseId wx企业标识
* @return boolean
* @author mozhu
* @date 2022-09-14 10:16:19
*/
boolean
deleteByWxEnterpriseId
(
String
wxEnterpriseId
);
/**
* 根据类型查询企业的菜单权限
*
* @param enterpriseId 企业标识
* @param wxEnterpriseId wx企业标识
* @param clerkType 职员类型
* @return {@link List }<{@link HaobanRoleBO }>
* @author mozhu
* @date 2022-09-07 14:08:19
*/
List
<
HaobanRoleBO
>
getByEnterpriseIdAndClerkType
(
String
enterpriseId
,
String
wxEnterpriseId
,
Integer
clerkType
);
List
<
HaobanRoleBO
>
getByWxEnterpriseIdAndClerkType
(
String
wxEnterpriseId
,
Integer
clerkType
);
/**
* 查询wx企业id数量
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-09-14 10:37:49
*/
int
getCountByWxEnterpriseId
(
String
wxEnterpriseId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/role/impl/HaobanRoleMenuServiceImpl.java
View file @
4c03761d
...
...
@@ -85,4 +85,9 @@ public class HaobanRoleMenuServiceImpl implements HaobanRoleMenuService {
public
List
<
String
>
getByWxEnterpriseIdAndRoleId
(
String
wxEnterpriseId
,
Long
roleId
)
{
return
tabHaobanRoleMenuMapper
.
getByWxEnterpriseIdAndRoleId
(
wxEnterpriseId
,
roleId
);
}
@Override
public
boolean
deleteByWxEnterpriseId
(
String
wxEnterpriseId
)
{
return
tabHaobanRoleMenuMapper
.
deleteByWxEnterpriseId
(
wxEnterpriseId
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/role/impl/HaobanRoleServiceImpl.java
View file @
4c03761d
...
...
@@ -76,14 +76,24 @@ public class HaobanRoleServiceImpl implements HaobanRoleService {
* @return 是否成功
*/
@Override
public
boolean
deleteById
(
Long
roleId
)
{
return
false
;
public
boolean
deleteBy
Role
Id
(
Long
roleId
)
{
return
tabHaobanRoleMapper
.
deleteByRoleId
(
roleId
)
>
0
;
}
@Override
public
List
<
HaobanRoleBO
>
getByEnterpriseIdAndClerkType
(
String
enterpriseId
,
String
wxEnterpriseId
,
Integer
clerkType
)
{
List
<
TabHaobanRole
>
haobanRoles
=
tabHaobanRoleMapper
.
getByEnterpriseIdAndClerkType
(
enterpriseId
,
wxEnterpriseId
,
clerkType
);
return
EntityUtil
.
changeEntityListNew
(
HaobanRoleBO
.
class
,
haobanRoles
);
public
boolean
deleteByWxEnterpriseId
(
String
wxEnterpriseId
)
{
return
tabHaobanRoleMapper
.
deleteByWxEnterpriseId
(
wxEnterpriseId
)
>
0
;
}
@Override
public
List
<
HaobanRoleBO
>
getByWxEnterpriseIdAndClerkType
(
String
wxEnterpriseId
,
Integer
clerkType
)
{
List
<
TabHaobanRole
>
haobanRoles
=
tabHaobanRoleMapper
.
getByWxEnterpriseIdAndClerkType
(
wxEnterpriseId
,
clerkType
);
return
EntityUtil
.
changeEntityListNew
(
HaobanRoleBO
.
class
,
haobanRoles
);
}
@Override
public
int
getCountByWxEnterpriseId
(
String
wxEnterpriseId
)
{
return
tabHaobanRoleMapper
.
getCountByWxEnterpriseId
(
wxEnterpriseId
);
}
}
haoban-manage3-service/src/main/resources/mapper/role/TabHaobanRoleMapper.xml
View file @
4c03761d
...
...
@@ -85,15 +85,31 @@
where role_id = #{roleId}
</update>
<delete
id=
"deleteByRoleId"
>
delete from tab_haoban_role where role_id = #{roleId}
</delete>
<select
id=
"getByEnterpriseIdAndClerkType"
resultMap=
"TabHaobanRoleMap"
>
<select
id=
"getBy
Wx
EnterpriseIdAndClerkType"
resultMap=
"TabHaobanRoleMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_role
where wx_enterprise_id = #{wxEnterpriseId}
and enterprise_id = #{enterpriseId}
and clerk_type = #{clerkType}
<if
test=
"clerkType != null"
>
and clerk_type = #{clerkType}
</if>
</select>
<select
id=
"getCountByWxEnterpriseId"
resultType=
"java.lang.Integer"
>
select
count(*)
from tab_haoban_role
where wx_enterprise_id = #{wxEnterpriseId}
</select>
<delete
id=
"deleteByWxEnterpriseId"
>
delete from tab_haoban_role where wx_enterprise_id = #{wxEnterpriseId}
</delete>
</mapper>
haoban-manage3-service/src/main/resources/mapper/role/TabHaobanRoleMenuMapper.xml
View file @
4c03761d
...
...
@@ -84,5 +84,9 @@
where wx_enterprise_id = #{wxEnterpriseId} and role_id = #{roleId}
</select>
<delete
id=
"deleteByWxEnterpriseId"
>
delete from tab_haoban_role_menu where wx_enterprise_id = #{wxEnterpriseId}
</delete>
</mapper>
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/HaobanRoleController.java
View file @
4c03761d
...
...
@@ -60,7 +60,7 @@ public class HaobanRoleController extends WebBaseController{
@RequestMapping
(
value
=
"/queryRoleByClerkType"
,
method
=
RequestMethod
.
GET
)
private
RestResponse
queryRoleByClerkType
(
Integer
clerkType
)
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
ServiceResponse
serviceResponse
=
haobanRoleApiService
.
getBy
EnterpriseIdAndClerkType
(
login
.
getEnterpriseId
(),
login
.
getWxEnterpriseId
(),
clerkType
);
ServiceResponse
serviceResponse
=
haobanRoleApiService
.
getBy
WxEnterpriseIdAndClerkType
(
login
.
getWxEnterpriseId
(),
clerkType
);
return
RestResponse
.
successResult
(
serviceResponse
.
getResult
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment