Commit 3b70e81b by 墨竹

feat:权限

parent 4b35a976
package com.gic.haoban.manage.api.dto.qdto.role; package com.gic.haoban.manage.api.dto.qdto.role;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.List;
/** /**
* 好办小程序权限(TabHaobanRole)实体类 * 好办小程序权限(TabHaobanRole)实体类
...@@ -19,38 +19,15 @@ public class HaobanRoleQDTO implements Serializable { ...@@ -19,38 +19,15 @@ public class HaobanRoleQDTO implements Serializable {
*/ */
private String roleName; private String roleName;
/** /**
* 权限id
*/
private Long menuId;
/**
* 权限code
*/
private String menuCode;
/**
* 0:导购;1:店长;3:区经 * 0:导购;1:店长;3:区经
*/ */
private Integer clerkType; private Integer clerkType;
private String wxEnterpriseId;
private String enterpriseId;
private String creatorId;
private String creatorName;
private String modifierId;
private String modifierName;
/** /**
* 1:正常;0:删除 * 权限id
*/ */
private Integer statusFlag; private List<Long> menuIds;
private Date createTime;
private Date updateTime;
private List<Long> delMenuIds;
public Long getRoleId() { public Long getRoleId() {
return roleId; return roleId;
...@@ -68,20 +45,12 @@ public class HaobanRoleQDTO implements Serializable { ...@@ -68,20 +45,12 @@ public class HaobanRoleQDTO implements Serializable {
this.roleName = roleName; this.roleName = roleName;
} }
public Long getMenuId() { public List<Long> getMenuIds() {
return menuId; return menuIds;
}
public void setMenuId(Long menuId) {
this.menuId = menuId;
} }
public String getMenuCode() { public void setMenuIds(List<Long> menuIds) {
return menuCode; this.menuIds = menuIds;
}
public void setMenuCode(String menuCode) {
this.menuCode = menuCode;
} }
public Integer getClerkType() { public Integer getClerkType() {
...@@ -92,77 +61,12 @@ public class HaobanRoleQDTO implements Serializable { ...@@ -92,77 +61,12 @@ public class HaobanRoleQDTO implements Serializable {
this.clerkType = clerkType; this.clerkType = clerkType;
} }
public String getWxEnterpriseId() { public List<Long> getDelMenuIds() {
return wxEnterpriseId; return delMenuIds;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getCreatorId() {
return creatorId;
} }
public void setCreatorId(String creatorId) { public void setDelMenuIds(List<Long> delMenuIds) {
this.creatorId = creatorId; this.delMenuIds = delMenuIds;
} }
public String getCreatorName() {
return creatorName;
}
public void setCreatorName(String creatorName) {
this.creatorName = creatorName;
}
public String getModifierId() {
return modifierId;
}
public void setModifierId(String modifierId) {
this.modifierId = modifierId;
}
public String getModifierName() {
return modifierName;
}
public void setModifierName(String modifierName) {
this.modifierName = modifierName;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
} }
package com.gic.haoban.manage.api.dto.role;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
*
*
* @author mozhu
* @since 2022-09-06 16:35:10
*/
public class HaobanMenuDTO implements Serializable {
private static final long serialVersionUID = 909873156099677525L;
private Long menuId;
/**
* 菜单code
*/
private String menuCode;
/**
* 菜单名称
*/
private String menuName;
/**
* 菜单url
*/
private String menuUrl;
/**
* 菜单图标url
*/
private String iconUrl;
/**
* 层级
*/
private Integer menuLevel;
/**
* 0:菜单;1:按钮
*/
private Integer menuType;
/**
* 排序
*/
private Integer menuSort;
/**
* 父code
*/
private String parentCode;
/**
* 1:正常;0:删除
*/
private Integer statusFlag;
private Integer customFlag;
private Date createTime;
private Date updateTime;
private List<HaobanMenuDTO> menuBOList;
public Long getMenuId() {
return menuId;
}
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
public String getMenuCode() {
return menuCode;
}
public void setMenuCode(String menuCode) {
this.menuCode = menuCode;
}
public String getMenuName() {
return menuName;
}
public void setMenuName(String menuName) {
this.menuName = menuName;
}
public String getMenuUrl() {
return menuUrl;
}
public void setMenuUrl(String menuUrl) {
this.menuUrl = menuUrl;
}
public String getIconUrl() {
return iconUrl;
}
public void setIconUrl(String iconUrl) {
this.iconUrl = iconUrl;
}
public Integer getMenuLevel() {
return menuLevel;
}
public void setMenuLevel(Integer menuLevel) {
this.menuLevel = menuLevel;
}
public Integer getMenuType() {
return menuType;
}
public void setMenuType(Integer menuType) {
this.menuType = menuType;
}
public Integer getMenuSort() {
return menuSort;
}
public void setMenuSort(Integer menuSort) {
this.menuSort = menuSort;
}
public String getParentCode() {
return parentCode;
}
public void setParentCode(String parentCode) {
this.parentCode = parentCode;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getCustomFlag() {
return customFlag;
}
public void setCustomFlag(Integer customFlag) {
this.customFlag = customFlag;
}
public List<HaobanMenuDTO> getMenuBOList() {
return menuBOList;
}
public void setMenuBOList(List<HaobanMenuDTO> menuBOList) {
this.menuBOList = menuBOList;
}
}
...@@ -18,14 +18,7 @@ public class HaobanRoleDTO implements Serializable { ...@@ -18,14 +18,7 @@ public class HaobanRoleDTO implements Serializable {
* 权限名称 * 权限名称
*/ */
private String roleName; private String roleName;
/**
* 权限id
*/
private Long menuId;
/**
* 权限code
*/
private String menuCode;
/** /**
* 0:导购;1:店长;3:区经 * 0:导购;1:店长;3:区经
*/ */
...@@ -68,22 +61,6 @@ public class HaobanRoleDTO implements Serializable { ...@@ -68,22 +61,6 @@ public class HaobanRoleDTO implements Serializable {
this.roleName = roleName; this.roleName = roleName;
} }
public Long getMenuId() {
return menuId;
}
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
public String getMenuCode() {
return menuCode;
}
public void setMenuCode(String menuCode) {
this.menuCode = menuCode;
}
public Integer getClerkType() { public Integer getClerkType() {
return clerkType; return clerkType;
} }
...@@ -163,6 +140,5 @@ public class HaobanRoleDTO implements Serializable { ...@@ -163,6 +140,5 @@ public class HaobanRoleDTO implements Serializable {
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
} }
package com.gic.haoban.manage.api.service.role; package com.gic.haoban.manage.api.service.role;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.role.HaobanMenuDTO;
import java.util.List;
/** /**
* @author xuwenqian * @author xuwenqian
* @date 2022/9/7 9:46 上午 * @date 2022/9/7 9:46 上午
*/ */
public interface HaobanRoleMenuApiService { public interface HaobanMenuApiService {
/** /**
* 获取菜单树 * 获取菜单树
...@@ -15,5 +18,5 @@ public interface HaobanRoleMenuApiService { ...@@ -15,5 +18,5 @@ public interface HaobanRoleMenuApiService {
* @author mozhu * @author mozhu
* @date 2022-09-07 09:50:37 * @date 2022-09-07 09:50:37
*/ */
ServiceResponse getMenuTreeList(); ServiceResponse<List<HaobanMenuDTO>> getMenuTreeList();
} }
package com.gic.haoban.manage.api.service.role; package com.gic.haoban.manage.api.service.role;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleQDTO; import com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleQDTO;
import java.util.List;
/** /**
* @author xuwenqian * @author xuwenqian
* @date 2022/9/7 9:46 上午 * @date 2022/9/7 9:46 上午
...@@ -14,23 +13,23 @@ public interface HaobanRoleApiService { ...@@ -14,23 +13,23 @@ public interface HaobanRoleApiService {
/** /**
* 添加 * 添加
* *
* @param haobanRoleQDTOList * @param haobanRoleQDTO
* @return {@link ServiceResponse } * @return {@link ServiceResponse }
* @author mozhu * @author mozhu
* @date 2022-09-07 11:36:08 * @date 2022-09-07 11:36:08
*/ */
ServiceResponse add(List<HaobanRoleQDTO> haobanRoleQDTOList); ServiceResponse add(HaobanRoleQDTO haobanRoleQDTO, WebLoginDTO login);
/** /**
* 编辑 * 编辑
* *
* @param haobanRoleQDTOList * @param haobanRoleQDTO
* @return {@link ServiceResponse } * @return {@link ServiceResponse }
* @author mozhu * @author mozhu
* @date 2022-09-07 11:44:17 * @date 2022-09-07 11:44:17
*/ */
ServiceResponse edit(List<HaobanRoleQDTO> haobanRoleQDTOList); ServiceResponse edit(HaobanRoleQDTO haobanRoleQDTO,WebLoginDTO login);
/** /**
......
...@@ -65,5 +65,6 @@ ...@@ -65,5 +65,6 @@
<dubbo:reference interface="com.gic.haoban.manage.api.service.QywxErrorLogApiService" id="qywxErrorLogApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.QywxErrorLogApiService" id="qywxErrorLogApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.fee.HaobanQywxFeeApiService" id="haobanQywxFeeApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.fee.HaobanQywxFeeApiService" id="haobanQywxFeeApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.role.HaobanRoleApiService" id="haobanRoleApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.role.HaobanMenuApiService" id="haobanMenuApiService"/>
</beans> </beans>
package com.gic.haoban.manage.service.dao.mapper.role; package com.gic.haoban.manage.service.dao.mapper.role;
import com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu; import com.gic.haoban.manage.service.entity.role.TabHaobanMenu;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/** /**
* 好办小程序菜单(TabHaobanRoleMenu)表数据库访问层 *
* *
* @author mozhu * @author mozhu
* @since 2022-09-06 16:35:10 * @since 2022-09-06 16:35:10
*/ */
public interface TabHaobanRoleMenuMapper { public interface TabHaobanMenuMapper {
/** /**
* 通过ID查询单条数据 * 通过ID查询单条数据
...@@ -19,39 +19,39 @@ public interface TabHaobanRoleMenuMapper { ...@@ -19,39 +19,39 @@ public interface TabHaobanRoleMenuMapper {
* @param menuId 主键 * @param menuId 主键
* @return 实例对象 * @return 实例对象
*/ */
TabHaobanRoleMenu queryById(Long menuId); TabHaobanMenu queryById(Long menuId);
/** /**
* 新增数据 * 新增数据
* *
* @param tabHaobanRoleMenu 实例对象 * @param tabHaobanMenu 实例对象
* @return 影响行数 * @return 影响行数
*/ */
int insert(TabHaobanRoleMenu tabHaobanRoleMenu); int insert(TabHaobanMenu tabHaobanMenu);
/** /**
* 批量新增数据(MyBatis原生foreach方法) * 批量新增数据(MyBatis原生foreach方法)
* *
* @param entities List<TabHaobanRoleMenu> 实例对象列表 * @param entities List<TabHaobanMenu> 实例对象列表
* @return 影响行数 * @return 影响行数
*/ */
int insertBatch(@Param("entities") List<TabHaobanRoleMenu> entities); int insertBatch(@Param("entities") List<TabHaobanMenu> entities);
/** /**
* 修改数据 * 修改数据
* *
* @param tabHaobanRoleMenu 实例对象 * @param tabHaobanMenu 实例对象
* @return 影响行数 * @return 影响行数
*/ */
int update(TabHaobanRoleMenu tabHaobanRoleMenu); int update(TabHaobanMenu tabHaobanMenu);
/** /**
* 获取所有菜单 * 获取所有菜单
* *
* @return {@link List }<{@link TabHaobanRoleMenu }> * @return {@link List }<{@link TabHaobanMenu }>
* @author mozhu * @author mozhu
* @date 2022-09-07 09:54:05 * @date 2022-09-07 09:54:05
*/ */
List<TabHaobanRoleMenu> getAllMenuList(); List<TabHaobanMenu> getAllMenuList();
} }
...@@ -58,5 +58,20 @@ public interface TabHaobanRoleMapper { ...@@ -58,5 +58,20 @@ public interface TabHaobanRoleMapper {
List<TabHaobanRole> getByEnterpriseIdAndClerkType(@Param("enterpriseId") String enterpriseId, List<TabHaobanRole> getByEnterpriseIdAndClerkType(@Param("enterpriseId") String enterpriseId,
@Param("wxEnterpriseId") String wxEnterpriseId, @Param("wxEnterpriseId") String wxEnterpriseId,
@Param("clerkType") Integer clerkType); @Param("clerkType") Integer clerkType);
List<Long> queryByMenuIds(@Param("menuIds") List<Long> menuIds,
@Param("enterpriseId") String enterpriseId,
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("clerkType") Integer clerkType);
List<Long> queryByUnMenuIds(@Param("menuIds") List<Long> menuIds,
@Param("enterpriseId") String enterpriseId,
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("clerkType") Integer clerkType);
Long queryByMenuId( @Param("menuId") Long menuId,
@Param("enterpriseId") String enterpriseId,
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("clerkType") Integer clerkType);
} }
...@@ -4,12 +4,13 @@ import java.io.Serializable; ...@@ -4,12 +4,13 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 好办小程序菜单(TabHaobanRoleMenu)实体类 *
* *
* @author mozhu * @author mozhu
* @since 2022-09-06 16:35:10 * @since 2022-09-06 16:35:10
*/ */
public class TabHaobanRoleMenu implements Serializable { public class TabHaobanMenu implements Serializable {
private static final long serialVersionUID = 909873156099677525L; private static final long serialVersionUID = 909873156099677525L;
private Long menuId; private Long menuId;
...@@ -49,6 +50,10 @@ public class TabHaobanRoleMenu implements Serializable { ...@@ -49,6 +50,10 @@ public class TabHaobanRoleMenu implements Serializable {
* 1:正常;0:删除 * 1:正常;0:删除
*/ */
private Integer statusFlag; private Integer statusFlag;
/**
* 是否定制菜单:1:是
*/
private Integer customFlag;
private Date createTime; private Date createTime;
...@@ -151,5 +156,12 @@ public class TabHaobanRoleMenu implements Serializable { ...@@ -151,5 +156,12 @@ public class TabHaobanRoleMenu implements Serializable {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public Integer getCustomFlag() {
return customFlag;
}
public void setCustomFlag(Integer customFlag) {
this.customFlag = customFlag;
}
} }
...@@ -17,14 +17,7 @@ public class TabHaobanRole implements Serializable { ...@@ -17,14 +17,7 @@ public class TabHaobanRole implements Serializable {
* 权限名称 * 权限名称
*/ */
private String roleName; private String roleName;
/**
* 权限id
*/
private Long menuId;
/**
* 权限code
*/
private String menuCode;
/** /**
* 0:导购;1:店长;3:区经 * 0:导购;1:店长;3:区经
*/ */
...@@ -67,22 +60,6 @@ public class TabHaobanRole implements Serializable { ...@@ -67,22 +60,6 @@ public class TabHaobanRole implements Serializable {
this.roleName = roleName; this.roleName = roleName;
} }
public Long getMenuId() {
return menuId;
}
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
public String getMenuCode() {
return menuCode;
}
public void setMenuCode(String menuCode) {
this.menuCode = menuCode;
}
public Integer getClerkType() { public Integer getClerkType() {
return clerkType; return clerkType;
} }
...@@ -162,6 +139,5 @@ public class TabHaobanRole implements Serializable { ...@@ -162,6 +139,5 @@ public class TabHaobanRole implements Serializable {
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
} }
...@@ -5,12 +5,12 @@ import java.util.Date; ...@@ -5,12 +5,12 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* 好办小程序菜单(TabHaobanRoleMenu)实体类 *
* *
* @author mozhu * @author mozhu
* @since 2022-09-06 16:35:10 * @since 2022-09-06 16:35:10
*/ */
public class HaobanRoleMenuBO implements Serializable { public class HaobanMenuBO implements Serializable {
private static final long serialVersionUID = 909873156099677525L; private static final long serialVersionUID = 909873156099677525L;
...@@ -51,12 +51,13 @@ public class HaobanRoleMenuBO implements Serializable { ...@@ -51,12 +51,13 @@ public class HaobanRoleMenuBO implements Serializable {
* 1:正常;0:删除 * 1:正常;0:删除
*/ */
private Integer statusFlag; private Integer statusFlag;
private Integer customFlag;
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
private List<HaobanRoleMenuBO> menuBOList; private List<HaobanMenuBO> menuBOList;
public Long getMenuId() { public Long getMenuId() {
...@@ -155,11 +156,19 @@ public class HaobanRoleMenuBO implements Serializable { ...@@ -155,11 +156,19 @@ public class HaobanRoleMenuBO implements Serializable {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public List<HaobanRoleMenuBO> getMenuBOList() { public Integer getCustomFlag() {
return customFlag;
}
public void setCustomFlag(Integer customFlag) {
this.customFlag = customFlag;
}
public List<HaobanMenuBO> getMenuBOList() {
return menuBOList; return menuBOList;
} }
public void setMenuBOList(List<HaobanRoleMenuBO> menuBOList) { public void setMenuBOList(List<HaobanMenuBO> menuBOList) {
this.menuBOList = menuBOList; this.menuBOList = menuBOList;
} }
} }
......
...@@ -18,14 +18,7 @@ public class HaobanRoleBO implements Serializable { ...@@ -18,14 +18,7 @@ public class HaobanRoleBO implements Serializable {
* 权限名称 * 权限名称
*/ */
private String roleName; private String roleName;
/**
* 权限id
*/
private Long menuId;
/**
* 权限code
*/
private String menuCode;
/** /**
* 0:导购;1:店长;3:区经 * 0:导购;1:店长;3:区经
*/ */
...@@ -68,22 +61,6 @@ public class HaobanRoleBO implements Serializable { ...@@ -68,22 +61,6 @@ public class HaobanRoleBO implements Serializable {
this.roleName = roleName; this.roleName = roleName;
} }
public Long getMenuId() {
return menuId;
}
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
public String getMenuCode() {
return menuCode;
}
public void setMenuCode(String menuCode) {
this.menuCode = menuCode;
}
public Integer getClerkType() { public Integer getClerkType() {
return clerkType; return clerkType;
} }
...@@ -163,6 +140,5 @@ public class HaobanRoleBO implements Serializable { ...@@ -163,6 +140,5 @@ public class HaobanRoleBO implements Serializable {
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
} }
package com.gic.haoban.manage.service.service.out.impl.role; package com.gic.haoban.manage.service.service.out.impl.role;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.service.role.HaobanRoleMenuApiService; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.service.service.role.HaobanRoleMenuService; import com.gic.haoban.manage.api.dto.role.HaobanMenuDTO;
import com.gic.haoban.manage.api.service.role.HaobanMenuApiService;
import com.gic.haoban.manage.service.pojo.bo.role.HaobanMenuBO;
import com.gic.haoban.manage.service.service.role.HaobanMenuService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
@Service @Service
public class HaobanRoleMenuApiServiceImpl implements HaobanRoleMenuApiService { public class HaobanMenuApiServiceImpl implements HaobanMenuApiService {
@Autowired @Autowired
private HaobanRoleMenuService haobanRoleMenuService; private HaobanMenuService haobanMenuService;
@Override @Override
public ServiceResponse getMenuTreeList() { public ServiceResponse<List<HaobanMenuDTO>> getMenuTreeList() {
return ServiceResponse.success(haobanRoleMenuService.getMenuTreeList()); List<HaobanMenuBO> menuTreeList = haobanMenuService.getMenuTreeList();
return ServiceResponse.success(EntityUtil.changeEntityListNew(HaobanMenuDTO.class,menuTreeList));
} }
} }
package com.gic.haoban.manage.service.service.out.impl.role; package com.gic.haoban.manage.service.service.out.impl.role;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil; import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleQDTO; import com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleQDTO;
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.TabHaobanMenu;
import com.gic.haoban.manage.service.entity.role.TabHaobanRole; import com.gic.haoban.manage.service.entity.role.TabHaobanRole;
import com.gic.haoban.manage.service.pojo.bo.role.HaobanRoleBO; import com.gic.haoban.manage.service.pojo.bo.role.HaobanRoleBO;
import com.gic.haoban.manage.service.service.role.HaobanMenuService;
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.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Service @Service
public class HaobanRoleApiServiceImpl implements HaobanRoleApiService { public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
private static final Logger logger = LogManager.getLogger(HaobanRoleApiServiceImpl.class);
@Autowired @Autowired
private HaobanRoleService haobanRoleService; private HaobanRoleService haobanRoleService;
@Autowired
private HaobanMenuService haobanMenuService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ServiceResponse add(List<HaobanRoleQDTO> haobanRoleQDTOList) { public ServiceResponse add(HaobanRoleQDTO haobanRoleQDTO, WebLoginDTO login) {
List<TabHaobanRole> tabHaobanRoles = EntityUtil.changeEntityListNew(TabHaobanRole.class, haobanRoleQDTOList); List<Long> menuIds = haobanRoleQDTO.getMenuIds();
return ServiceResponse.success(haobanRoleService.insertBatch(tabHaobanRoles)); List<TabHaobanRole> haobanRoles = new ArrayList<>();
for (Long menuId : menuIds) {
TabHaobanRole tabHaobanRole = new TabHaobanRole();
tabHaobanRole.setRoleName(haobanRoleQDTO.getRoleName());
tabHaobanRole.setMenuId(menuId);
tabHaobanRole.setClerkType(haobanRoleQDTO.getClerkType());
tabHaobanRole.setStatusFlag(1);
tabHaobanRole.setEnterpriseId(login.getEnterpriseId());
tabHaobanRole.setWxEnterpriseId(login.getWxEnterpriseId());
TabHaobanMenu tabHaobanMenu = haobanMenuService.queryById(menuId);
if (tabHaobanMenu != null) {
tabHaobanRole.setMenuCode(tabHaobanMenu.getMenuCode());
tabHaobanRole.setMenuName(tabHaobanMenu.getMenuName());
}
tabHaobanRole.setCreatorId(login.getClerkId());
tabHaobanRole.setCreatorName(login.getClerkName());
haobanRoles.add(tabHaobanRole);
}
return ServiceResponse.success(haobanRoleService.insertBatch(haobanRoles));
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ServiceResponse edit(List<HaobanRoleQDTO> haobanRoleQDTOList) { public ServiceResponse edit(HaobanRoleQDTO haobanRoleQDTO, WebLoginDTO login) {
List<TabHaobanRole> tabHaobanRoles = EntityUtil.changeEntityListNew(TabHaobanRole.class, haobanRoleQDTOList); String enterpriseId = login.getEnterpriseId();
for (TabHaobanRole tabHaobanRole : tabHaobanRoles) { String wxEnterpriseId = login.getWxEnterpriseId();
Integer clerkType = haobanRoleQDTO.getClerkType();
List<Long> delMenuIds = haobanRoleQDTO.getDelMenuIds();
List<Long> delRoleIds = haobanRoleService.queryByUnMenuIds(delMenuIds, enterpriseId, wxEnterpriseId, clerkType);
//删除已删除的权限
haobanRoleService.delByRoleIds(delRoleIds);
List<Long> menuIds = haobanRoleQDTO.getMenuIds();
for (Long menuId : menuIds) {
Long roleId = haobanRoleService.queryByMenuId(menuId, enterpriseId, wxEnterpriseId, clerkType);
if (roleId == null) {
TabHaobanRole tabHaobanRole = new TabHaobanRole();
tabHaobanRole.setRoleName(haobanRoleQDTO.getRoleName());
tabHaobanRole.setMenuId(menuId);
tabHaobanRole.setClerkType(haobanRoleQDTO.getClerkType());
tabHaobanRole.setStatusFlag(1);
tabHaobanRole.setEnterpriseId(login.getEnterpriseId());
tabHaobanRole.setWxEnterpriseId(login.getWxEnterpriseId());
TabHaobanMenu tabHaobanMenu = haobanMenuService.queryById(menuId);
if (tabHaobanMenu != null) {
tabHaobanRole.setMenuCode(tabHaobanMenu.getMenuCode());
tabHaobanRole.setMenuName(tabHaobanMenu.getMenuName());
}
tabHaobanRole.setCreatorId(login.getClerkId());
tabHaobanRole.setCreatorName(login.getClerkName());
haobanRoleService.insert(tabHaobanRole);
} else {
TabHaobanRole tabHaobanRole = new TabHaobanRole();
tabHaobanRole.setRoleName(haobanRoleQDTO.getRoleName());
tabHaobanRole.setModifierId(login.getClerkId());
tabHaobanRole.setModifierName(login.getClerkName());
haobanRoleService.update(tabHaobanRole); haobanRoleService.update(tabHaobanRole);
} }
}
return ServiceResponse.success(); return ServiceResponse.success();
} }
......
package com.gic.haoban.manage.service.service.role; package com.gic.haoban.manage.service.service.role;
import com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu; import com.gic.haoban.manage.service.entity.role.TabHaobanMenu;
import com.gic.haoban.manage.service.pojo.bo.role.HaobanRoleMenuBO; import com.gic.haoban.manage.service.pojo.bo.role.HaobanMenuBO;
import java.util.List; import java.util.List;
/** /**
* 好办小程序菜单(TabHaobanRoleMenu)表服务接口 *
* *
* @author mozhu * @author mozhu
* @since 2022-09-06 16:35:11 * @since 2022-09-06 16:35:11
*/ */
public interface HaobanRoleMenuService { public interface HaobanMenuService {
/** /**
* 通过ID查询单条数据 * 通过ID查询单条数据
...@@ -19,28 +19,28 @@ public interface HaobanRoleMenuService { ...@@ -19,28 +19,28 @@ public interface HaobanRoleMenuService {
* @param menuId 主键 * @param menuId 主键
* @return 实例对象 * @return 实例对象
*/ */
TabHaobanRoleMenu queryById(Long menuId); TabHaobanMenu queryById(Long menuId);
/** /**
* 新增数据 * 新增数据
* *
* @param tabHaobanRoleMenu 实例对象 * @param tabHaobanMenu 实例对象
* @return 实例对象 * @return 实例对象
*/ */
TabHaobanRoleMenu insert(TabHaobanRoleMenu tabHaobanRoleMenu); TabHaobanMenu insert(TabHaobanMenu tabHaobanMenu);
/** /**
* 修改数据 * 修改数据
* *
* @param tabHaobanRoleMenu 实例对象 * @param tabHaobanMenu 实例对象
* @return 实例对象 * @return 实例对象
*/ */
TabHaobanRoleMenu update(TabHaobanRoleMenu tabHaobanRoleMenu); TabHaobanMenu update(TabHaobanMenu tabHaobanMenu);
/** /**
* 菜单树 * 菜单树
* @return * @return
*/ */
List<HaobanRoleMenuBO> getMenuTreeList(); List<HaobanMenuBO> getMenuTreeList();
} }
...@@ -66,4 +66,55 @@ public interface HaobanRoleService { ...@@ -66,4 +66,55 @@ public interface HaobanRoleService {
* @date 2022-09-07 14:08:19 * @date 2022-09-07 14:08:19
*/ */
List<HaobanRoleBO> getByEnterpriseIdAndClerkType(String enterpriseId, String wxEnterpriseId, Integer clerkType); List<HaobanRoleBO> getByEnterpriseIdAndClerkType(String enterpriseId, String wxEnterpriseId, Integer clerkType);
/**
* 查询菜单id
*
* @param menuIds 菜单id
* @param enterpriseId 企业标识
* @param wxEnterpriseId wx企业标识
* @param clerkType 职员类型
* @return {@link List }<{@link Long }>
* @author mozhu
* @date 2022-09-07 14:32:17
*/
List<Long> queryByMenuIds(List<Long> menuIds,String enterpriseId, String wxEnterpriseId,Integer clerkType);
/**
* 查询被删除的菜单id
*
* @param menuIds 菜单id
* @param enterpriseId 企业标识
* @param wxEnterpriseId wx企业标识
* @param clerkType 职员类型
* @return {@link List }<{@link Long }>
* @author mozhu
* @date 2022-09-07 14:32:20
*/
List<Long> queryByUnMenuIds(List<Long> menuIds,String enterpriseId, String wxEnterpriseId,Integer clerkType);
/**
* 通过菜单id查询
*
* @param menuId 菜单id
* @param enterpriseId 企业标识
* @param wxEnterpriseId wx企业标识
* @param clerkType 职员类型
* @return {@link Long }
* @author mozhu
* @date 2022-09-07 17:03:50
*/
Long queryByMenuId(Long menuId,String enterpriseId, String wxEnterpriseId,Integer clerkType);
/**
* 删除权限
*
* @param roleIds 角色id
* @return int
* @author mozhu
* @date 2022-09-07 14:47:18
*/
void delByRoleIds(List<Long> roleIds);
} }
package com.gic.haoban.manage.service.service.role.impl; package com.gic.haoban.manage.service.service.role.impl;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.service.dao.mapper.role.TabHaobanRoleMenuMapper; import com.gic.haoban.manage.service.dao.mapper.role.TabHaobanMenuMapper;
import com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu; import com.gic.haoban.manage.service.entity.role.TabHaobanMenu;
import com.gic.haoban.manage.service.pojo.bo.role.HaobanRoleMenuBO; import com.gic.haoban.manage.service.pojo.bo.role.HaobanMenuBO;
import com.gic.haoban.manage.service.service.role.HaobanRoleMenuService; import com.gic.haoban.manage.service.service.role.HaobanMenuService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -14,16 +14,16 @@ import java.util.Date; ...@@ -14,16 +14,16 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* 好办小程序菜单(TabHaobanRoleMenu)表服务实现类 *
* *
* @author mozhu * @author mozhu
* @since 2022-09-06 16:35:11 * @since 2022-09-06 16:35:11
*/ */
@Service @Service
public class HaobanRoleMenuServiceImpl implements HaobanRoleMenuService { public class HaobanMenuServiceImpl implements HaobanMenuService {
@Autowired @Autowired
private TabHaobanRoleMenuMapper tabHaobanRoleMenuMapper; private TabHaobanMenuMapper tabHaobanMenuMapper;
/** /**
* 通过ID查询单条数据 * 通过ID查询单条数据
...@@ -32,61 +32,61 @@ public class HaobanRoleMenuServiceImpl implements HaobanRoleMenuService { ...@@ -32,61 +32,61 @@ public class HaobanRoleMenuServiceImpl implements HaobanRoleMenuService {
* @return 实例对象 * @return 实例对象
*/ */
@Override @Override
public TabHaobanRoleMenu queryById(Long menuId) { public TabHaobanMenu queryById(Long menuId) {
return this.tabHaobanRoleMenuMapper.queryById(menuId); return this.tabHaobanMenuMapper.queryById(menuId);
} }
/** /**
* 新增数据 * 新增数据
* *
* @param tabHaobanRoleMenu 实例对象 * @param tabHaobanMenu 实例对象
* @return 实例对象 * @return 实例对象
*/ */
@Override @Override
public TabHaobanRoleMenu insert(TabHaobanRoleMenu tabHaobanRoleMenu) { public TabHaobanMenu insert(TabHaobanMenu tabHaobanMenu) {
tabHaobanRoleMenu.setCreateTime(new Date()); tabHaobanMenu.setCreateTime(new Date());
tabHaobanRoleMenu.setUpdateTime(new Date()); tabHaobanMenu.setUpdateTime(new Date());
this.tabHaobanRoleMenuMapper.insert(tabHaobanRoleMenu); this.tabHaobanMenuMapper.insert(tabHaobanMenu);
return tabHaobanRoleMenu; return tabHaobanMenu;
} }
/** /**
* 修改数据 * 修改数据
* *
* @param tabHaobanRoleMenu 实例对象 * @param tabHaobanMenu 实例对象
* @return 实例对象 * @return 实例对象
*/ */
@Override @Override
public TabHaobanRoleMenu update(TabHaobanRoleMenu tabHaobanRoleMenu) { public TabHaobanMenu update(TabHaobanMenu tabHaobanMenu) {
tabHaobanRoleMenu.setUpdateTime(new Date()); tabHaobanMenu.setUpdateTime(new Date());
this.tabHaobanRoleMenuMapper.update(tabHaobanRoleMenu); this.tabHaobanMenuMapper.update(tabHaobanMenu);
return this.queryById(tabHaobanRoleMenu.getMenuId()); return this.queryById(tabHaobanMenu.getMenuId());
} }
@Override @Override
public List<HaobanRoleMenuBO> getMenuTreeList() { public List<HaobanMenuBO> getMenuTreeList() {
List<TabHaobanRoleMenu> allMenuList = tabHaobanRoleMenuMapper.getAllMenuList(); List<TabHaobanMenu> allMenuList = tabHaobanMenuMapper.getAllMenuList();
List<HaobanRoleMenuBO> menuBOList = EntityUtil.changeEntityListNew(HaobanRoleMenuBO.class, allMenuList); List<HaobanMenuBO> menuBOList = EntityUtil.changeEntityListNew(HaobanMenuBO.class, allMenuList);
for (HaobanRoleMenuBO haobanRoleMenuBO : menuBOList) { for (HaobanMenuBO haobanMenuBO : menuBOList) {
List<HaobanRoleMenuBO> menus = iterateMenus(menuBOList, haobanRoleMenuBO.getMenuCode()); List<HaobanMenuBO> menus = iterateMenus(menuBOList, haobanMenuBO.getMenuCode());
haobanRoleMenuBO.setMenuBOList(menus); haobanMenuBO.setMenuBOList(menus);
} }
return menuBOList; return menuBOList;
} }
public List<HaobanRoleMenuBO> iterateMenus(List<HaobanRoleMenuBO> menuVoList, String pCode) { public List<HaobanMenuBO> iterateMenus(List<HaobanMenuBO> menuVoList, String pCode) {
List<HaobanRoleMenuBO> result = new ArrayList<>(); List<HaobanMenuBO> result = new ArrayList<>();
for (HaobanRoleMenuBO haobanRoleMenuBO : menuVoList) { for (HaobanMenuBO haobanMenuBO : menuVoList) {
String menuCode = haobanRoleMenuBO.getMenuCode(); String menuCode = haobanMenuBO.getMenuCode();
String parentCode = haobanRoleMenuBO.getParentCode(); String parentCode = haobanMenuBO.getParentCode();
if (StringUtils.isNotBlank(parentCode)) { if (StringUtils.isNotBlank(parentCode)) {
if (parentCode.equals(pCode)) { if (parentCode.equals(pCode)) {
//递归查询当前子菜单的子菜单 //递归查询当前子菜单的子菜单
List<HaobanRoleMenuBO> iterateMenu = iterateMenus(menuVoList, menuCode); List<HaobanMenuBO> iterateMenu = iterateMenus(menuVoList, menuCode);
haobanRoleMenuBO.setMenuBOList(iterateMenu); haobanMenuBO.setMenuBOList(iterateMenu);
result.add(haobanRoleMenuBO); result.add(haobanMenuBO);
} }
} }
} }
......
...@@ -90,4 +90,29 @@ public class HaobanRoleServiceImpl implements HaobanRoleService { ...@@ -90,4 +90,29 @@ public class HaobanRoleServiceImpl implements HaobanRoleService {
List<TabHaobanRole> haobanRoles = tabHaobanRoleMapper.getByEnterpriseIdAndClerkType(enterpriseId, wxEnterpriseId, clerkType); List<TabHaobanRole> haobanRoles = tabHaobanRoleMapper.getByEnterpriseIdAndClerkType(enterpriseId, wxEnterpriseId, clerkType);
return EntityUtil.changeEntityListNew(HaobanRoleBO.class,haobanRoles); return EntityUtil.changeEntityListNew(HaobanRoleBO.class,haobanRoles);
} }
@Override
public List<Long> queryByMenuIds(List<Long> menuIds, String enterpriseId, String wxEnterpriseId, Integer clerkType) {
return tabHaobanRoleMapper.queryByMenuIds(menuIds,enterpriseId,wxEnterpriseId,clerkType);
}
@Override
public List<Long> queryByUnMenuIds(List<Long> menuIds, String enterpriseId, String wxEnterpriseId, Integer clerkType) {
return tabHaobanRoleMapper.queryByUnMenuIds(menuIds,enterpriseId,wxEnterpriseId,clerkType);
}
@Override
public Long queryByMenuId(Long menuId, String enterpriseId, String wxEnterpriseId, Integer clerkType) {
return tabHaobanRoleMapper.queryByMenuId(menuId,enterpriseId,wxEnterpriseId,clerkType);
}
@Override
public void delByRoleIds(List<Long> roleIds) {
for (Long roleId : roleIds) {
TabHaobanRole tabHaobanRole = new TabHaobanRole();
tabHaobanRole.setStatusFlag(0);
tabHaobanRole.setRoleId(roleId);
tabHaobanRoleMapper.update(tabHaobanRole);
}
}
} }
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
timeout="10000"/> timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.ValidationCodeApiService" ref="validationCodeApiServiceImpl"/> <dubbo:service interface="com.gic.haoban.manage.api.service.ValidationCodeApiService" ref="validationCodeApiServiceImpl"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.role.HaobanRoleMenuApiService" ref="haobanRoleMenuApiServiceImpl"/> <dubbo:service interface="com.gic.haoban.manage.api.service.role.HaobanMenuApiService" ref="haobanMenuApiServiceImpl"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.role.HaobanRoleApiService" ref="haobanRoleApiServiceImpl"/> <dubbo:service interface="com.gic.haoban.manage.api.service.role.HaobanRoleApiService" ref="haobanRoleApiServiceImpl"/>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.role.TabHaobanRoleMenuMapper"> <mapper namespace="com.gic.haoban.manage.service.dao.mapper.role.TabHaobanMenuMapper">
<resultMap type="com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu" id="TabHaobanRoleMenuMap"> <resultMap type="com.gic.haoban.manage.service.entity.role.TabHaobanMenu" id="TabHaobanMenuMap">
<result property="menuId" column="menu_id" jdbcType="INTEGER"/> <result property="menuId" column="menu_id" jdbcType="INTEGER"/>
<result property="menuCode" column="menu_code" jdbcType="VARCHAR"/> <result property="menuCode" column="menu_code" jdbcType="VARCHAR"/>
<result property="menuName" column="menu_name" jdbcType="VARCHAR"/> <result property="menuName" column="menu_name" jdbcType="VARCHAR"/>
...@@ -12,36 +12,37 @@ ...@@ -12,36 +12,37 @@
<result property="menuType" column="menu_type" jdbcType="INTEGER"/> <result property="menuType" column="menu_type" jdbcType="INTEGER"/>
<result property="menuSort" column="menu_sort" jdbcType="INTEGER"/> <result property="menuSort" column="menu_sort" jdbcType="INTEGER"/>
<result property="parentCode" column="parent_code" jdbcType="VARCHAR"/> <result property="parentCode" column="parent_code" jdbcType="VARCHAR"/>
<result property="customFlag" column="custom_flag" jdbcType="INTEGER"/>
<result property="statusFlag" column="status_flag" jdbcType="INTEGER"/> <result property="statusFlag" column="status_flag" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
menu_id, menu_code, menu_name, menu_url, icon_url, menu_level, menu_type, menu_sort, parent_code, status_flag, create_time, update_time menu_id, menu_code, menu_name, menu_url, icon_url, menu_level, menu_type, menu_sort, parent_code, status_flag,custom_flag, create_time, update_time
</sql> </sql>
<!--查询单个--> <!--查询单个-->
<select id="queryById" resultMap="TabHaobanRoleMenuMap"> <select id="queryById" resultMap="TabHaobanMenuMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tab_haoban_role_menu from tab_haoban_menu
where menu_id = #{menuId} where menu_id = #{menuId}
</select> </select>
<!--新增所有列--> <!--新增所有列-->
<insert id="insert" keyProperty="menuId" useGeneratedKeys="true"> <insert id="insert" keyProperty="menuId" useGeneratedKeys="true">
insert into tab_haoban_role_menu(menu_id, menu_code, menu_name, menu_url, icon_url, menu_level, menu_type, menu_sort, parent_code, status_flag, create_time, update_time) insert into tab_haoban_menu(menu_id, menu_code, menu_name, menu_url, icon_url, menu_level, menu_type, menu_sort, parent_code, status_flag,custom_flag, create_time, update_time)
values (#{menuId}, #{menuCode}, #{menuName}, #{menuUrl}, #{iconUrl}, #{menuLevel}, #{menuType}, #{menuSort}, #{parentCode}, #{statusFlag}, #{createTime}, #{updateTime}) values (#{menuId}, #{menuCode}, #{menuName}, #{menuUrl}, #{iconUrl}, #{menuLevel}, #{menuType}, #{menuSort}, #{parentCode}, #{statusFlag},#{customFlag}, #{createTime}, #{updateTime})
</insert> </insert>
<insert id="insertBatch" keyProperty="menuId" useGeneratedKeys="true"> <insert id="insertBatch" keyProperty="menuId" useGeneratedKeys="true">
insert into tab_haoban_role_menu(menu_id, menu_code, menu_name, menu_url, icon_url, menu_level, menu_type, insert into tab_haoban_menu(menu_id, menu_code, menu_name, menu_url, icon_url, menu_level, menu_type,
menu_sort, parent_code, status_flag, create_time, update_time) menu_sort, parent_code, status_flag,custom_flag, create_time, update_time)
values values
<foreach collection="entities" item="entity" separator=","> <foreach collection="entities" item="entity" separator=",">
(#{entity.menuId}, #{entity.menuCode}, #{entity.menuName}, #{entity.menuUrl}, #{entity.iconUrl}, (#{entity.menuId}, #{entity.menuCode}, #{entity.menuName}, #{entity.menuUrl}, #{entity.iconUrl},
#{entity.menuLevel}, #{entity.menuType}, #{entity.menuSort}, #{entity.parentCode}, #{entity.statusFlag}, #{entity.menuLevel}, #{entity.menuType}, #{entity.menuSort}, #{entity.parentCode}, #{entity.statusFlag},#{entity.customFlag},
#{entity.createTime}, #{entity.updateTime}) #{entity.createTime}, #{entity.updateTime})
</foreach> </foreach>
</insert> </insert>
...@@ -49,7 +50,7 @@ ...@@ -49,7 +50,7 @@
<!--通过主键修改数据--> <!--通过主键修改数据-->
<update id="update"> <update id="update">
update tab_haoban_role_menu update tab_haoban_menu
<set> <set>
<if test="menuCode != null and menuCode != ''"> <if test="menuCode != null and menuCode != ''">
menu_code = #{menuCode}, menu_code = #{menuCode},
...@@ -78,6 +79,9 @@ ...@@ -78,6 +79,9 @@
<if test="statusFlag != null"> <if test="statusFlag != null">
status_flag = #{statusFlag}, status_flag = #{statusFlag},
</if> </if>
<if test="customFlag != null">
custom_flag = #{customFlag},
</if>
<if test="createTime != null"> <if test="createTime != null">
create_time = #{createTime}, create_time = #{createTime},
</if> </if>
...@@ -89,10 +93,10 @@ ...@@ -89,10 +93,10 @@
</update> </update>
<select id="getAllMenuList" resultMap="TabHaobanRoleMenuMap"> <select id="getAllMenuList" resultMap="TabHaobanMenuMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tab_haoban_role_menu from tab_haoban_menu
where status_flag = 1 order by menu_sort where status_flag = 1 order by menu_sort
</select> </select>
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
<resultMap type="com.gic.haoban.manage.service.entity.role.TabHaobanRole" id="TabHaobanRoleMap"> <resultMap type="com.gic.haoban.manage.service.entity.role.TabHaobanRole" id="TabHaobanRoleMap">
<result property="roleId" column="role_id" jdbcType="INTEGER"/> <result property="roleId" column="role_id" jdbcType="INTEGER"/>
<result property="roleName" column="role_name" jdbcType="VARCHAR"/> <result property="roleName" column="role_name" jdbcType="VARCHAR"/>
<result property="menuId" column="menu_id" jdbcType="INTEGER"/>
<result property="menuCode" column="menu_code" jdbcType="VARCHAR"/>
<result property="clerkType" column="clerk_type" jdbcType="INTEGER"/> <result property="clerkType" column="clerk_type" jdbcType="INTEGER"/>
<result property="wxEnterpriseId" column="wx_enterprise_id" jdbcType="VARCHAR"/> <result property="wxEnterpriseId" column="wx_enterprise_id" jdbcType="VARCHAR"/>
<result property="enterpriseId" column="enterprise_id" jdbcType="VARCHAR"/> <result property="enterpriseId" column="enterprise_id" jdbcType="VARCHAR"/>
...@@ -20,7 +18,7 @@ ...@@ -20,7 +18,7 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
role_id, role_name, menu_id, menu_code, clerk_type, wx_enterprise_id, enterprise_id, creator_id, creator_name, modifier_id, modifier_name, status_flag, create_time, update_time role_id, role_name, clerk_type, wx_enterprise_id, enterprise_id, creator_id, creator_name, modifier_id, modifier_name, status_flag, create_time, update_time
</sql> </sql>
<!--查询单个--> <!--查询单个-->
...@@ -33,16 +31,16 @@ ...@@ -33,16 +31,16 @@
<!--新增所有列--> <!--新增所有列-->
<insert id="insert" keyProperty="roleId" useGeneratedKeys="true"> <insert id="insert" keyProperty="roleId" useGeneratedKeys="true">
insert into tab_haoban_role(role_id, role_name, menu_id, menu_code, clerk_type, wx_enterprise_id, enterprise_id, creator_id, creator_name, modifier_id, modifier_name, status_flag, create_time, update_time) insert into tab_haoban_role(role_id, role_name, clerk_type, wx_enterprise_id, enterprise_id, creator_id, creator_name, modifier_id, modifier_name, status_flag, create_time, update_time)
values (#{roleId}, #{roleName}, #{menuId}, #{menuCode}, #{clerkType}, #{wxEnterpriseId}, #{enterpriseId}, #{creatorId}, #{creatorName}, #{modifierId}, #{modifierName}, #{statusFlag}, #{createTime}, #{updateTime}) values (#{roleId}, #{roleName}, #{clerkType}, #{wxEnterpriseId}, #{enterpriseId}, #{creatorId}, #{creatorName}, #{modifierId}, #{modifierName}, #{statusFlag}, #{createTime}, #{updateTime})
</insert> </insert>
<insert id="insertBatch" keyProperty="roleId" useGeneratedKeys="true"> <insert id="insertBatch" keyProperty="roleId" useGeneratedKeys="true">
insert into tab_haoban_role(role_id, role_name, menu_id, menu_code, clerk_type, wx_enterprise_id, enterprise_id, insert into tab_haoban_role(role_id, role_name, clerk_type, wx_enterprise_id, enterprise_id,
creator_id, creator_name, modifier_id, modifier_name, status_flag, create_time, update_time) creator_id, creator_name, modifier_id, modifier_name, status_flag, create_time, update_time)
values values
<foreach collection="entities" item="entity" separator=","> <foreach collection="entities" item="entity" separator=",">
(#{entity.roleId}, #{entity.roleName}, #{entity.menuId}, #{entity.menuCode}, #{entity.clerkType}, (#{entity.roleId}, #{entity.roleName}, #{entity.clerkType},
#{entity.wxEnterpriseId}, #{entity.enterpriseId}, #{entity.creatorId}, #{entity.creatorName}, #{entity.wxEnterpriseId}, #{entity.enterpriseId}, #{entity.creatorId}, #{entity.creatorName},
#{entity.modifierId}, #{entity.modifierName}, #{entity.statusFlag}, #{entity.createTime}, #{entity.modifierId}, #{entity.modifierName}, #{entity.statusFlag}, #{entity.createTime},
#{entity.updateTime}) #{entity.updateTime})
...@@ -57,12 +55,6 @@ ...@@ -57,12 +55,6 @@
<if test="roleName != null and roleName != ''"> <if test="roleName != null and roleName != ''">
role_name = #{roleName}, role_name = #{roleName},
</if> </if>
<if test="menuId != null">
menu_id = #{menuId},
</if>
<if test="menuCode != null and menuCode != ''">
menu_code = #{menuCode},
</if>
<if test="clerkType != null"> <if test="clerkType != null">
clerk_type = #{clerkType}, clerk_type = #{clerkType},
</if> </if>
...@@ -107,5 +99,42 @@ ...@@ -107,5 +99,42 @@
and clerk_type = #{clerkType} and clerk_type = #{clerkType}
</select> </select>
<select id="queryByMenuIds" resultType="java.lang.Long">
select
role_id
from tab_haoban_role
where wx_enterprise_id = #{wxEnterpriseId}
and enterprise_id = #{enterpriseId}
and clerk_type = #{clerkType}
and menu_id in
<foreach collection="menuIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</select>
<select id="queryByUnMenuIds" resultType="java.lang.Long">
select
role_id
from tab_haoban_role
where wx_enterprise_id = #{wxEnterpriseId}
and enterprise_id = #{enterpriseId}
and clerk_type = #{clerkType}
and menu_id not in
<foreach collection="menuIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</select>
<select id="queryByMenuId" resultType="java.lang.Long">
select
role_id
from tab_haoban_role
where wx_enterprise_id = #{wxEnterpriseId}
and enterprise_id = #{enterpriseId}
and clerk_type = #{clerkType}
and menu_id = #{menuId}
</select>
</mapper> </mapper>
package com.gic.haoban.manage.web.controller;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.manage.api.dto.qdto.role.HaobanRoleQDTO;
import com.gic.haoban.manage.api.dto.role.HaobanMenuDTO;
import com.gic.haoban.manage.api.service.role.HaobanMenuApiService;
import com.gic.haoban.manage.api.service.role.HaobanRoleApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author mozhu
* @date 2022/9/7 3:03 下午
*/
@RestController
@RequestMapping("/role")
public class HaobanRoleController extends WebBaseController{
private static final Logger logger = LoggerFactory.getLogger(HaobanRoleController.class);
@Autowired
private HaobanRoleApiService haobanRoleApiService;
@Autowired
private HaobanMenuApiService haobanMenuApiService;
@RequestMapping(value = "/add",method = RequestMethod.POST)
private RestResponse add(@RequestBody HaobanRoleQDTO haobanRoleQDTO) {
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
haobanRoleApiService.add(haobanRoleQDTO,login);
return RestResponse.successResult();
}
@RequestMapping(value = "/edit",method = RequestMethod.POST)
private RestResponse edit(@RequestBody HaobanRoleQDTO haobanRoleQDTO) {
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
return RestResponse.successResult(haobanRoleApiService.edit(haobanRoleQDTO,login));
}
@RequestMapping(value = "/queryMenuByClerkType",method = RequestMethod.GET)
private RestResponse queryMenuByClerkType() {
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
return RestResponse.successResult();
}
@RequestMapping("/getMenuTreeList")
private RestResponse<List<HaobanMenuDTO>> getMenuTreeList() {
ServiceResponse<List<HaobanMenuDTO>> serviceMenuTreeList = haobanMenuApiService.getMenuTreeList();
return RestResponse.successResult(serviceMenuTreeList.getResult());
}
}
package com.gic.haoban.manage.web.controller.logrecord; package com.gic.haoban.manage.web.controller.logrecord;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo; import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse; import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.dsmongo.api.dto.DocumentResultDTO;
import com.gic.dsmongo.api.dto.QueryDocDTO;
import com.gic.dsmongo.api.service.MongoOperationService; import com.gic.dsmongo.api.service.MongoOperationService;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO; import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil; import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.manage.web.qo.logrecord.LogRecordQo; import com.gic.haoban.manage.web.qo.logrecord.LogRecordQo;
import com.gic.haoban.manage.web.vo.logrecord.LogRecordTypeVO; import com.gic.haoban.manage.web.vo.logrecord.LogRecordTypeVO;
import com.gic.log.record.bean.GicLogRecordBean;
import com.gic.log.record.bean.OptRecordLog; import com.gic.log.record.bean.OptRecordLog;
import com.gic.log.record.enums.OrderEnum; import com.gic.log.record.enums.OrderEnum;
import com.gic.log.record.service.LogSearchApiService; import com.gic.log.record.service.LogSearchApiService;
import com.gic.log.record.util.GicLogRecordCategoryEnum; import com.gic.log.record.util.GicLogRecordCategoryEnum;
import com.gic.log.record.util.GicLogRecordOptTypeEnum; import com.gic.log.record.util.GicLogRecordOptTypeEnum;
import com.gic.log.record.util.LogCommenUtil;
import com.gic.log.record.util.LogQueryWrapper; import com.gic.log.record.util.LogQueryWrapper;
import com.mongodb.BasicDBObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.bson.conversions.Bson;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.util.*; import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Controller @Controller
@RequestMapping("/log-record") @RequestMapping("/log-record")
......
...@@ -120,4 +120,6 @@ ...@@ -120,4 +120,6 @@
<dubbo:reference id="logSearchApiService" interface="com.gic.log.record.service.LogSearchApiService" timeout="10000" retries="0" check="false" /> <dubbo:reference id="logSearchApiService" interface="com.gic.log.record.service.LogSearchApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.haoban.manage.api.service.fee.HaobanQywxFeeApiService" id="haobanQywxFeeApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.fee.HaobanQywxFeeApiService" id="haobanQywxFeeApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.ValidationCodeApiService" id="validationCodeApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.ValidationCodeApiService" id="validationCodeApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.role.HaobanRoleApiService" id="haobanRoleApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.role.HaobanMenuApiService" id="haobanMenuApiService"/>
</beans> </beans>
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