小程序和基础saas功能
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.mapper.EnterpriseUserMapper;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @date 2023-05-19 02:58
|
||||
*/
|
||||
@Repository
|
||||
public class EnterpriseUserDAO {
|
||||
|
||||
@Resource
|
||||
private EnterpriseUserMapper enterpriseUserMapper;
|
||||
|
||||
|
||||
public EnterpriseUserDO getUserInfoById(String userId){
|
||||
if(StringUtils.isAnyBlank(userId)){
|
||||
return null;
|
||||
}
|
||||
return enterpriseUserMapper.getUserInfoById( userId);
|
||||
}
|
||||
|
||||
public List<EnterpriseUserDO> getUserInfoByUserIds(List<String> userIdList){
|
||||
if(CollectionUtils.isEmpty(userIdList)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return enterpriseUserMapper.getUserInfoByUserIds( userIdList);
|
||||
}
|
||||
|
||||
public List<EnterpriseUserDO> searchUserByRegionIdsAndKeyword(List<String> regionIds, String keyword, List<String> leaderRegionIds){
|
||||
if(CollectionUtils.isEmpty(regionIds)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return enterpriseUserMapper.searchUserByRegionIdsAndKeyword( regionIds, keyword, leaderRegionIds);
|
||||
}
|
||||
|
||||
public boolean isExistDeptUser(String regionId){
|
||||
if(StringUtils.isBlank(regionId)){
|
||||
return false;
|
||||
}
|
||||
return enterpriseUserMapper.getUserCountByRegionId( regionId) > CommonConstants.ZERO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门负责人
|
||||
* @param regionId
|
||||
* @return
|
||||
*/
|
||||
public List<EnterpriseUserDO> getUserListByDeptLeader(String regionId){
|
||||
if(StringUtils.isBlank(regionId)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return enterpriseUserMapper.getUserListByDeptLeader( regionId);
|
||||
}
|
||||
|
||||
public List<EnterpriseUserDO> getUserListByDeptLeaders(List<String> regionIds){
|
||||
if(CollectionUtils.isEmpty(regionIds)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return enterpriseUserMapper.getUserListByDeptLeaders( regionIds);
|
||||
}
|
||||
|
||||
|
||||
public List<EnterpriseUserDO> getUserListByRegionIds(List<String> regionIds){
|
||||
if(CollectionUtils.isEmpty(regionIds)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return enterpriseUserMapper.getUserListByRegionIds( regionIds);
|
||||
}
|
||||
|
||||
public Map<String, String> getUserNameAndMobile(List<String> userIds){
|
||||
List<EnterpriseUserDO> userList = getUserInfoByUserIds(userIds);
|
||||
return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), v -> v.getName() + " " + v.getMobile()));
|
||||
}
|
||||
|
||||
public Map<String, String> getUserNameMap(List<String> userIds){
|
||||
List<EnterpriseUserDO> userList = getUserInfoByUserIds(userIds);
|
||||
return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), v -> v.getName()));
|
||||
}
|
||||
|
||||
public Map<String, EnterpriseUserDO> getUserMap(List<String> userIds){
|
||||
List<EnterpriseUserDO> userList = getUserInfoByUserIds(userIds);
|
||||
return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), Function.identity()));
|
||||
}
|
||||
|
||||
public EnterpriseUserDO selectByMobile(String mobile) {
|
||||
return enterpriseUserMapper.selectByMobile( mobile);
|
||||
}
|
||||
|
||||
public String getUserName(String userId){
|
||||
EnterpriseUserDO userInfo = getUserInfoById(userId);
|
||||
return Optional.ofNullable(userInfo).map(EnterpriseUserDO::getName).orElse(StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
public EnterpriseUserDO selectByInvestmentManager(String investmentManager) {
|
||||
if (StringUtil.isEmpty(investmentManager)) {
|
||||
return null;
|
||||
}
|
||||
return enterpriseUserMapper.selectByInvestmentManager( investmentManager);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.entity.SysRoleDO;
|
||||
import com.cool.store.enums.Role;
|
||||
import com.cool.store.mapper.EnterpriseUserRoleMapper;
|
||||
import com.cool.store.mapper.SysRoleMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author zhangnan
|
||||
* @date 2022-04-14 18:38
|
||||
*/
|
||||
@Repository
|
||||
public class EnterpriseUserRoleDao {
|
||||
|
||||
@Resource
|
||||
private EnterpriseUserRoleMapper enterpriseUserRoleMapper;
|
||||
@Resource
|
||||
private SysRoleMapper sysRoleMapper;
|
||||
|
||||
/**
|
||||
* 根据角色id查询用户id列表
|
||||
* @param roleIds
|
||||
* @return
|
||||
*/
|
||||
public List<String> selectUserIdsByRoleIdList( List<Long> roleIds) {
|
||||
if( CollectionUtils.isEmpty(roleIds)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return enterpriseUserRoleMapper.selectUserIdsByRoleIdList(roleIds);
|
||||
}
|
||||
|
||||
public List<String> selectUserIdsByRole( Role role) {
|
||||
if(Objects.isNull(role)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return enterpriseUserRoleMapper.selectUserIdsByRoleIdList( Arrays.asList(Long.valueOf(role.getId())));
|
||||
}
|
||||
|
||||
public List<String> getUserIdsByRoleIds( List<String> roleIds, List<String> userIds){
|
||||
if(CollectionUtils.isEmpty(roleIds) || CollectionUtils.isEmpty(userIds)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return enterpriseUserRoleMapper.getUserIdsByRoleIds(roleIds, userIds);
|
||||
}
|
||||
|
||||
public List<Long> getUserRoleIds( String userId){
|
||||
if(StringUtils.isAnyBlank(userId)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return enterpriseUserRoleMapper.getUserRoleIds(userId);
|
||||
}
|
||||
|
||||
public Boolean checkIsAdmin( String userId) {
|
||||
|
||||
// 1.取出所有用户角色
|
||||
// 2.匹配是否有管理员角色
|
||||
List<SysRoleDO> sysRoleDOList = sysRoleMapper.listRoleByUserId(userId);
|
||||
return ListUtils.emptyIfNull(sysRoleDOList)
|
||||
.stream()
|
||||
.anyMatch(role-> StringUtils.equals(Role.MASTER.getRoleEnum(),role.getRoleEnum()));
|
||||
}
|
||||
|
||||
public List<String> getUserIdsByRoleIdList( List<Long> roleIdList) {
|
||||
return enterpriseUserRoleMapper.getUserIdsByRoleIdList(roleIdList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.entity.HyPartnerUserInfoDO;
|
||||
import com.cool.store.mapper.HyPartnerUserInfoMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/6/8 19:41
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Repository
|
||||
public class HyPartnerUserInfoDAO {
|
||||
|
||||
|
||||
@Resource
|
||||
HyPartnerUserInfoMapper hyPartnerUserInfoMapper;
|
||||
|
||||
|
||||
public int updateByPrimaryKeySelective(HyPartnerUserInfoDO hyPartnerUserInfoDO){
|
||||
return hyPartnerUserInfoMapper.updateByPrimaryKeySelective(hyPartnerUserInfoDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据PartnerId查询用户
|
||||
* @param partnerId
|
||||
* @return
|
||||
*/
|
||||
public HyPartnerUserInfoDO selectByPartnerId(String partnerId){
|
||||
if (StringUtils.isEmpty(partnerId)){
|
||||
return null;
|
||||
}
|
||||
return hyPartnerUserInfoMapper.selectByPartnerId(partnerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据mobile查询用户
|
||||
* @param mobile
|
||||
* @return
|
||||
*/
|
||||
public HyPartnerUserInfoDO selectByMobile(String mobile){
|
||||
if (StringUtils.isEmpty(mobile)){
|
||||
return null;
|
||||
}
|
||||
return hyPartnerUserInfoMapper.selectByMobile(mobile);
|
||||
}
|
||||
|
||||
public HyPartnerUserInfoDO selectByOpenid(String openid){
|
||||
if (StringUtils.isEmpty(openid)){
|
||||
return null;
|
||||
}
|
||||
return hyPartnerUserInfoMapper.selectByOpenid(openid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据PartnerIds批量查询用户
|
||||
* @param partnerIds
|
||||
* @return
|
||||
*/
|
||||
public List<HyPartnerUserInfoDO> selectByPartnerIds(List<String> partnerIds){
|
||||
if (CollectionUtils.isEmpty(partnerIds)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return hyPartnerUserInfoMapper.selectByPartnerIds(partnerIds);
|
||||
}
|
||||
|
||||
public int insertSelective( HyPartnerUserInfoDO record){
|
||||
return hyPartnerUserInfoMapper.insertSelective(record);
|
||||
}
|
||||
|
||||
public int updateJoinKnowById(Integer isWritePartnerKnow, Long id){
|
||||
if (id == null || isWritePartnerKnow == null){
|
||||
return 0;
|
||||
}
|
||||
return hyPartnerUserInfoMapper.updateJoinKnowById(isWritePartnerKnow, id);
|
||||
}
|
||||
|
||||
public int updateByPartnerId(HyPartnerUserInfoDO record){
|
||||
if(StringUtils.isBlank(record.getPartnerId())){
|
||||
return 0;
|
||||
}
|
||||
return hyPartnerUserInfoMapper.updateByPartnerId(record);
|
||||
}
|
||||
|
||||
|
||||
public String selectLastCrmCreateTime() {
|
||||
return hyPartnerUserInfoMapper.selectLastCrmCreateTime();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.dto.RegionNode;
|
||||
import com.cool.store.entity.RegionDO;
|
||||
import com.cool.store.mapper.RegionMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author shoul
|
||||
* @ClassName RegionDao
|
||||
* @Description 用一句话描述什么
|
||||
*/
|
||||
@Repository
|
||||
public class RegionDao {
|
||||
|
||||
@Resource
|
||||
private RegionMapper regionMapper;
|
||||
|
||||
|
||||
public RegionNode getRegionByRegionId( String regionId) {
|
||||
return regionMapper.getRegionByRegionId( regionId);
|
||||
}
|
||||
|
||||
public List<RegionDO> getRegionByRegionIds( List<String> regionIds) {
|
||||
if (CollectionUtils.isEmpty(regionIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return regionMapper.getRegionByRegionIds( regionIds);
|
||||
}
|
||||
|
||||
|
||||
public RegionNode getRootRegion(String eid) {
|
||||
return regionMapper.getRegionByRegionId( "1");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取区域根据区域id列表(包含删除)
|
||||
*
|
||||
* 区域id
|
||||
* @param regionIds 区域id列表
|
||||
* @return List<RegionDO>
|
||||
*/
|
||||
public List<RegionDO> getAllRegionByRegionIds( List<Long> regionIds) {
|
||||
if (CollectionUtils.isEmpty(regionIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return regionMapper.getByIds( regionIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取区域根据区域id(包含删除)
|
||||
*
|
||||
*
|
||||
* @param regionId
|
||||
* @return
|
||||
*/
|
||||
public RegionDO getRegionById( Long regionId) {
|
||||
if ( Objects.isNull(regionId)) {
|
||||
return null;
|
||||
}
|
||||
return regionMapper.getByRegionId( regionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
* @param id 区域id
|
||||
* @return RegionDO
|
||||
*/
|
||||
public RegionDO selectById(Long id) {
|
||||
if(Objects.isNull(id)) {
|
||||
return null;
|
||||
}
|
||||
return regionMapper.getByRegionId( id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的区域包含删除区域
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<RegionDO> getRegionsByEid( Long regionId) {
|
||||
return regionMapper.getRegionsByEid( regionId);
|
||||
}
|
||||
|
||||
|
||||
public List<RegionDO> getSubRegion( Long parentId) {
|
||||
if ( Objects.isNull(parentId)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return regionMapper.getSubRegion( parentId);
|
||||
}
|
||||
|
||||
public List<RegionDO> getRegionList( List<String> regionIds) {
|
||||
if ( CollectionUtils.isEmpty(regionIds)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return regionMapper.getRegionByRegionIds( regionIds);
|
||||
}
|
||||
|
||||
|
||||
public RegionDO getByRegionIdExcludeDeleted( Long regionId) {
|
||||
if ( Objects.isNull(regionId)) {
|
||||
return null;
|
||||
}
|
||||
return regionMapper.getByRegionIdExcludeDeleted( regionId);
|
||||
}
|
||||
|
||||
public List<String> getSubIdsByRegionIds( List<String> regionIds) {
|
||||
if (CollectionUtils.isEmpty(regionIds)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
List<String> regionPaths = regionMapper.getRegionPathByRegionIds( regionIds);
|
||||
regionPaths = regionPaths.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(regionPaths)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return regionMapper.getSubIdsByRegionIds( regionPaths);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据regionIds 的 全路径查下级
|
||||
*
|
||||
*
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
public List<String> listSubIdsByRegionIds( List<String> regionIds) {
|
||||
if (CollectionUtils.isEmpty(regionIds)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
List<Long> regionIdList = regionIds.stream()
|
||||
.map(a -> Long.valueOf(a)).collect(Collectors.toList());
|
||||
List<RegionDO> regionDOList = regionMapper.getRegionPathByIds( regionIdList);
|
||||
List<String> fullRegionPathList = ListUtils.emptyIfNull(regionDOList)
|
||||
.stream()
|
||||
.map(RegionDO::getFullRegionPath)
|
||||
.collect(Collectors.toList());
|
||||
fullRegionPathList = fullRegionPathList.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(fullRegionPathList)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return regionMapper.getSubIdsByRegionIds( fullRegionPathList);
|
||||
}
|
||||
|
||||
|
||||
public Map<Long, String> getRegionNameMap(List<Long> regionIds) {
|
||||
List<RegionDO> regionList = getAllRegionByRegionIds( regionIds);
|
||||
if (CollectionUtils.isEmpty(regionList)) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
return regionList.stream().collect(Collectors.toMap(k -> k.getId(), v -> v.getName(), (k1, k2) -> k1));
|
||||
}
|
||||
|
||||
public List<RegionDO> getCompRegionByRegionIds(List<Long> compParentIdList) {
|
||||
return regionMapper.getCompRegionByRegionIds( compParentIdList);
|
||||
}
|
||||
|
||||
|
||||
public List<RegionDO> getRegionByParentIds(List<String> regionIdList) {
|
||||
return regionMapper.getRegionByParentIds(regionIdList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.dto.UserRoleDTO;
|
||||
import com.cool.store.entity.SysRoleDO;
|
||||
import com.cool.store.mapper.SysRoleMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhangnan
|
||||
* @description:
|
||||
* @date 2022/4/18 10:57 PM
|
||||
*/
|
||||
@Repository
|
||||
public class SysRoleDao {
|
||||
|
||||
@Resource
|
||||
private SysRoleMapper sysRoleMapper;
|
||||
|
||||
/**
|
||||
* 根据角色id列表查询
|
||||
* @param roleIds
|
||||
* @return
|
||||
*/
|
||||
public List<SysRoleDO> selectRoleByRoleIds( List<Long> roleIds) {
|
||||
if(CollectionUtils.isEmpty(roleIds)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return sysRoleMapper.getRoleByRoleIds( roleIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色id列表查询
|
||||
* @param userIdList
|
||||
* @return
|
||||
*/
|
||||
public List<UserRoleDTO> getUserRoleNameByUserIdList( List<String> userIdList) {
|
||||
if(CollectionUtils.isEmpty(userIdList)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return sysRoleMapper.getUserRoleNameByUserIdList( userIdList);
|
||||
}
|
||||
|
||||
public Map<Long, String> getRoleNameMap( List<Long> roleIds){
|
||||
List<SysRoleDO> sysRoleDOS = selectRoleByRoleIds( roleIds);
|
||||
if(CollectionUtils.isEmpty(sysRoleDOS)){
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
return sysRoleDOS.stream().collect(Collectors.toMap(k->k.getId(), v->v.getRoleName(), (k1, k2)->k1));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.entity.UserRegionMappingDO;
|
||||
import com.cool.store.mapper.UserRegionMappingMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: UserRegionMappingDAO
|
||||
* @Description:
|
||||
* @date 2022-03-03 9:50
|
||||
*/
|
||||
@Service
|
||||
public class UserRegionMappingDAO {
|
||||
|
||||
@Autowired
|
||||
private UserRegionMappingMapper userRegionMappingMapper;
|
||||
|
||||
/**
|
||||
* 根据人员id列表查询人员所属部门
|
||||
*
|
||||
* @param userIds
|
||||
* @return
|
||||
*/
|
||||
public List<UserRegionMappingDO> listUserRegionMappingByUserId( List<String> userIds){
|
||||
return userRegionMappingMapper.listUserRegionMappingByUserId( userIds);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询部门下的人员
|
||||
*
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
public List<UserRegionMappingDO> selectUserListByRegionIds( List<String> regionIds){
|
||||
return userRegionMappingMapper.selectUserListByRegionIds(regionIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取区域的直连人员数量
|
||||
*
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
public List<HashMap<String,Long>> getRegionUserCount(List<String> regionIds){
|
||||
return userRegionMappingMapper.getRegionUserCount(regionIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据Userids和regionids查询数据
|
||||
*
|
||||
* @param userIds
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
public List<UserRegionMappingDO> listByUserIdsAndRegionIds(List<String> userIds,List<String> regionIds){
|
||||
return userRegionMappingMapper.listByUserIdsAndRegionIds(userIds,regionIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户所在的部门
|
||||
*
|
||||
* @param userIds
|
||||
* @return
|
||||
*/
|
||||
public List<UserRegionMappingDO> getRegionIdsByUserIds( List<String> userIds){
|
||||
if(CollectionUtils.isEmpty(userIds)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return userRegionMappingMapper.getRegionIdsByUserIds( userIds);
|
||||
}
|
||||
|
||||
public List<String> getRegionIdsByUserId( String userId){
|
||||
if(StringUtils.isAnyBlank( userId)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
List<UserRegionMappingDO> regionMappings = getRegionIdsByUserIds( Arrays.asList(userId));
|
||||
return ListUtils.emptyIfNull(regionMappings).stream().map(UserRegionMappingDO::getRegionId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门有哪些用户
|
||||
*
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
public List<String> getUserIdsByRegionIds( List<String> regionIds){
|
||||
return userRegionMappingMapper.getUserIdsByRegionIds( regionIds);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @date 2023-06-06 02:29
|
||||
*/
|
||||
@Mapper
|
||||
public interface EnterpriseUserMapper {
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
EnterpriseUserDO getUserInfoById(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* 批量获取用户信息
|
||||
* @param userIdList
|
||||
* @return
|
||||
*/
|
||||
List<EnterpriseUserDO> getUserInfoByUserIds( @Param("userIdList") List<String> userIdList);
|
||||
|
||||
/**
|
||||
* 根据关键字搜索部门下的用户
|
||||
* @param regionIds
|
||||
* @param keyword
|
||||
* @param leaderRegionIds
|
||||
* @return
|
||||
*/
|
||||
List<EnterpriseUserDO> searchUserByRegionIdsAndKeyword( @Param("regionIds") List<String> regionIds, @Param("keyword") String keyword, @Param("leaderRegionIds") List<String> leaderRegionIds);
|
||||
|
||||
/**
|
||||
* 获取部门用户数
|
||||
* @param regionId
|
||||
* @return
|
||||
*/
|
||||
Integer getUserCountByRegionId( @Param("regionId") String regionId);
|
||||
|
||||
/**
|
||||
* 获取部门负责人用户列表
|
||||
* @param regionId
|
||||
* @return
|
||||
*/
|
||||
List<EnterpriseUserDO> getUserListByDeptLeader( @Param("regionId")String regionId);
|
||||
|
||||
/**
|
||||
* 根据开发经理获取用户列表
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
List<EnterpriseUserDO> getUserListByDeptLeaders( @Param("regionIds") List<String> regionIds);
|
||||
|
||||
/**
|
||||
* 获取部门人员
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
List<EnterpriseUserDO> getUserListByRegionIds( @Param("regionIds") List<String> regionIds);
|
||||
|
||||
EnterpriseUserDO selectByMobile( @Param("mobile") String mobile);
|
||||
|
||||
EnterpriseUserDO selectByInvestmentManager( @Param("investmentManager") String investmentManager);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.entity.EnterpriseUserRole;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface EnterpriseUserRoleMapper {
|
||||
/**
|
||||
* 主键查询
|
||||
*/
|
||||
EnterpriseUserRole selectByPrimaryKey( @Param("id") String id);
|
||||
|
||||
/**
|
||||
* 根据userId查询该用户与钉钉角色、职位的映射关系
|
||||
*/
|
||||
List<EnterpriseUserRole> selectDingRoleMappingByUserId( @Param("userId") String userId);
|
||||
|
||||
List<EnterpriseUserRole> listsUserRoleByUserIdListAndSource( @Param("userIds") List<String> userIds, @Param("source") String source);
|
||||
|
||||
List<EnterpriseUserRole> selectMdtRoleMappingByUserId( @Param("userId") String userId);
|
||||
/**
|
||||
* 根据角色id查询
|
||||
*/
|
||||
List<EnterpriseUserRole> selectByRoleId( @Param("roleId") String roleId);
|
||||
|
||||
/**
|
||||
* 根据userId查询
|
||||
*/
|
||||
List<Long> selectIdsByUserId( @Param("userId") String userId);
|
||||
|
||||
List<Long> selectIdsByUserIds( @Param("userIds") List<String> userIds);
|
||||
|
||||
/**
|
||||
* 根据用户id列表查询
|
||||
*/
|
||||
List<EnterpriseUserRole> selectByUserIdList( @Param("userIds") List<String> userIds);
|
||||
|
||||
EnterpriseUserRole selectByUserIdAndRoleId( @Param("userId") String userId, @Param("roleId") String roleId);
|
||||
/**
|
||||
* 获取某个角色的用户
|
||||
*
|
||||
* @param userIds
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
List<String> selectUserIdByRoleId( @Param("userIds") List<String> userIds, @Param("roleId") String roleId);
|
||||
/**
|
||||
* 获取用户有哪些角色
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<Long> selectRoleIdsByUserId( @Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* 获取角色下的用户
|
||||
*
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
List<String> selectUserIdsByRoleId( @Param("roleId") String roleId);
|
||||
|
||||
/**
|
||||
* 获取角色列表下的用户
|
||||
*
|
||||
* @param roleIds
|
||||
* @return
|
||||
*/
|
||||
List<String> selectUserIdsByRoleIdList( @Param("roleIds") List<Long> roleIds);
|
||||
|
||||
List<String> getUserIdsByRoleIds( @Param("roleIds")List<String> roleIds, @Param("userIds")List<String> userIds);
|
||||
|
||||
List<Long> getUserRoleIds( @Param("userId") String userId);
|
||||
|
||||
List<String> getUserIdsByRoleIdList( @Param("roleIdList")List<Long> roleIdList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.entity.HyPartnerUserInfoDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @date 2023-05-29 03:53
|
||||
*/
|
||||
@Mapper
|
||||
public interface HyPartnerUserInfoMapper {
|
||||
/**
|
||||
*
|
||||
* 默认插入方法,只会给有值的字段赋值
|
||||
* 会对传进来的字段做判空处理,如果字段为空,则使用数据库默认字段或者null
|
||||
* dateTime:2023-05-29 03:53
|
||||
*/
|
||||
int insertSelective(@Param("record") HyPartnerUserInfoDO record);
|
||||
|
||||
/**
|
||||
*
|
||||
* 默认更新方法,根据主键更新,不会把null值更新到数据库,避免覆盖之前有值的
|
||||
* dateTime:2023-05-29 03:53
|
||||
*/
|
||||
int updateByPrimaryKeySelective(@Param("record") HyPartnerUserInfoDO record);
|
||||
|
||||
/**
|
||||
* 根据partnerID查询用户信息
|
||||
* @param partnerId
|
||||
* @return
|
||||
*/
|
||||
HyPartnerUserInfoDO selectByPartnerId(@Param("partnerId") String partnerId);
|
||||
|
||||
HyPartnerUserInfoDO selectByMobile(@Param("mobile") String mobile);
|
||||
|
||||
HyPartnerUserInfoDO selectByOpenid(@Param("openid") String openid);
|
||||
|
||||
|
||||
/**
|
||||
* 根据partnerIDs批量查询用户信息
|
||||
* @param partnerIdList
|
||||
* @return
|
||||
*/
|
||||
List<HyPartnerUserInfoDO> selectByPartnerIds(@Param("partnerIdList") List<String> partnerIdList);
|
||||
|
||||
int updateJoinKnowById(@Param("isWritePartnerKnow")Integer isWritePartnerKnow, @Param("id")Long id);
|
||||
|
||||
int selectByHourDateCount(@Param("selectTime") String hourDayDate, @Param("now") String now);
|
||||
|
||||
int updateByPartnerId(@Param("record") HyPartnerUserInfoDO record);
|
||||
|
||||
String selectLastCrmCreateTime();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.dto.RegionNode;
|
||||
import com.cool.store.entity.RegionDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author shoul
|
||||
*/
|
||||
@Mapper
|
||||
public interface RegionMapper {
|
||||
|
||||
/**
|
||||
* 获取所有的区域包含删除区域
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<RegionDO> getRegionsByEid( @Param("regionId") Long regionId);
|
||||
|
||||
/**
|
||||
* 获取区域列表
|
||||
*
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
List<RegionDO> getRegionByRegionIdsForMap( @Param("regionIds") List<String> regionIds);
|
||||
/**
|
||||
* 获取区域
|
||||
*
|
||||
* @param regionId
|
||||
* @return
|
||||
*/
|
||||
RegionNode getRegionByRegionId( @Param("regionId") String regionId);
|
||||
|
||||
/**
|
||||
* 获取区域列表(不包含删除)
|
||||
*
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
List<RegionDO> getRegionByRegionIds( @Param("regionIds") List<String> regionIds);
|
||||
|
||||
/**
|
||||
* 区域列表(包含删除)
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<RegionDO> getByIds(@Param("list")List<Long> ids);
|
||||
|
||||
List<RegionDO> getRegionPathByIds(@Param("list")List<Long> ids);
|
||||
|
||||
RegionDO getByRegionId( @Param("regionId") Long regionId);
|
||||
|
||||
List<RegionDO> getRegionsByParentId( @Param("parentId") Long parentId);
|
||||
|
||||
List<RegionDO> listRegionByIds( @Param("regionIds") List<Long> regionIds);
|
||||
|
||||
List<RegionDO> listRegionByRegionPath(@Param("regionPath") String regionPath);
|
||||
|
||||
/**
|
||||
* 筛选删除状态的
|
||||
*
|
||||
* @param regionId
|
||||
* @return
|
||||
*/
|
||||
RegionDO getByRegionIdExcludeDeleted( @Param("regionId") Long regionId);
|
||||
|
||||
/**
|
||||
* 获取子区域
|
||||
*
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
List<RegionDO> getSubRegion( @Param("parentId")Long parentId);
|
||||
/**
|
||||
* 获取区域范围内的区域id
|
||||
*
|
||||
* @param regionPaths
|
||||
* @return
|
||||
*/
|
||||
List<String> getSubIdsByRegionIds( @Param("regionPaths")List<String> regionPaths);
|
||||
|
||||
List<String> getSubIdsByRegionpaths( @Param("regionPaths")List<String> regionPaths);
|
||||
|
||||
List<String> getRegionPathByRegionIds( @Param("regionIds")List<String> regionIds);
|
||||
|
||||
List<RegionDO> getCompRegionByRegionIds(@Param("compParentIdList") List<Long> compParentIdList);
|
||||
|
||||
int countByRegionIdList(@Param("regionIdList") List<String> regionIdList);
|
||||
|
||||
List<RegionDO> getRegionByParentIds(@Param("regionIdList") List<String> regionIdList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.entity.SysMenuDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*
|
||||
* @author shoul
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysMenuMapper {
|
||||
/**
|
||||
* 查询菜单(从平台库查询)
|
||||
* @param parentIds
|
||||
* @param platformType
|
||||
* @param env
|
||||
* @return
|
||||
*/
|
||||
List<SysMenuDO> selectMenuAll(@Param("list") List<Long> parentIds,
|
||||
@Param("platformType") String platformType,
|
||||
@Param("env") String env);
|
||||
|
||||
SysMenuDO selectMenu(@Param("id")Long id);
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.dto.UserRoleDTO;
|
||||
import com.cool.store.entity.EnterpriseUserRole;
|
||||
import com.cool.store.entity.SysRoleDO;
|
||||
import com.cool.store.vo.SysRoleVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysRoleMapper {
|
||||
|
||||
List<SysRoleVO> getRoleUserByRoleEnum(@Param("roleEnum") String roleEnum,
|
||||
@Param("positionType") String positionType);
|
||||
|
||||
List<SysRoleVO> getRoleUserByRoleAuth(@Param("roleAuth") String roleAuth,
|
||||
@Param("positionType") String positionType);
|
||||
|
||||
/**
|
||||
* 根据用户角色查询角色下的用户人数
|
||||
*
|
||||
* @param roleId
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Integer getPersonNumsByRoles( @Param("roleId") Long roleId);
|
||||
|
||||
List<UserRoleDTO> userAndRolesByUserId(@Param("userIdList") List<String> userIdList);
|
||||
|
||||
/**
|
||||
* 通过id查询所有用户和角色的关联关系
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<String> selectRolesByuserId(@Param("userId") String userId);
|
||||
|
||||
String getHighestPriorityRoleIdByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* 根据角色名称查询是否存在
|
||||
* @param roleName
|
||||
* @return
|
||||
*/
|
||||
List<SysRoleDO> getRolesByName(@Param("roleName") String roleName);
|
||||
|
||||
/**
|
||||
* 查询角色详情
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
SysRoleDO getRole( @Param("roleId") Long roleId);
|
||||
|
||||
/**
|
||||
* roleEnum 不能为空
|
||||
*
|
||||
* @param roleEnum
|
||||
* @return
|
||||
*/
|
||||
SysRoleDO getRoleByRoleEnum( @Param("roleEnum") String roleEnum);
|
||||
|
||||
/**
|
||||
* 批量查询角色详情
|
||||
*
|
||||
* @param roleIdList
|
||||
* @return
|
||||
*/
|
||||
List<SysRoleDO> getRoleList( @Param("roleIdList") List<Long> roleIdList);
|
||||
|
||||
/**
|
||||
* 批量查询角色详情(包括钉钉角色)
|
||||
* @param roleIdList
|
||||
* @return
|
||||
*/
|
||||
List<SysRoleDO> getRoleByRoleIds( @Param("roleIdList") List<Long> roleIdList);
|
||||
/**
|
||||
* 批量查询角色名称列表
|
||||
*
|
||||
* @param roleIdList
|
||||
* @return
|
||||
*/
|
||||
List<String> getRoleNameList( @Param("roleIdList") List<Long> roleIdList);
|
||||
|
||||
/**
|
||||
* 查优先级最高的角色
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
SysRoleDO getHighestPrioritySysRoleDoByUserId(@Param("userId") String userId);
|
||||
/**
|
||||
* 根据用户id查询角色,包括钉钉同步角色
|
||||
*/
|
||||
List<SysRoleDO> getSysRoleByUserId(@Param("userId") String userId);
|
||||
|
||||
List<SysRoleDO> listRoleByUserId(@Param("userId") String userId);
|
||||
/**
|
||||
* 查询钉钉角色中的人员Id
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
List<String> selectUserByDingRole(@Param("roleId") Long roleId);
|
||||
/**
|
||||
* 根据职位id获取人员列表
|
||||
|
||||
* @param positionIds
|
||||
* @return
|
||||
*/
|
||||
List<String> getPositionUserIds( @Param("positionIds") List<String> positionIds);
|
||||
|
||||
List<EnterpriseUserRole> selectUserRoleBySourceAndUserId(@Param("source") String source ,
|
||||
@Param("userIdList") List<String> userIdList);
|
||||
|
||||
List<String> getUserIdListByRoleIdList(@Param("roleIdList") List<Long> roleIdList);
|
||||
/**
|
||||
* 获取用户岗位信息
|
||||
* @param userIdList
|
||||
* @return
|
||||
*/
|
||||
List<UserRoleDTO> getUserRoleNameByUserIdList( @Param("userIdList") List<String> userIdList);
|
||||
|
||||
/**
|
||||
* 根据岗位来源和角色名称获取角色
|
||||
企业id
|
||||
* @param synDingRoleId 角色名称
|
||||
* @param source 岗位来源
|
||||
* @return: java.util.List<com.coolcollege.intelligent.model.system.SysRoleDO>
|
||||
* @Author: xugangkun
|
||||
* @Date: 2021/3/22 16:11
|
||||
*/
|
||||
List<SysRoleDO> selectBySynDingRoleIdAndSource( @Param("source") String source, @Param("synDingRoleId") Long synDingRoleId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.entity.SysRoleMenuDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* describe:
|
||||
*
|
||||
* @author zhouyiping
|
||||
* @date 2020/09/23
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysRoleMenuMapper {
|
||||
|
||||
List<SysRoleMenuDO> listSysRoleMenuByRoleIdOld(@Param("roleId")Long roleId,
|
||||
@Param("platform")String platform);
|
||||
|
||||
List<SysRoleMenuDO> listSysRoleMenuByRoleId(@Param("roleId")Long roleId,
|
||||
@Param("platform")String platform);
|
||||
|
||||
List<SysRoleMenuDO> listSysRoleMenuByPlatform( @Param("platform")String platform);
|
||||
|
||||
List<Long> listSysRoleMenuIdByMenuId(@Param("platform")String platform,
|
||||
@Param("menuId")Long menuId);
|
||||
|
||||
List<SysRoleMenuDO> listRoleMenuIdByMenuIds(@Param("menuIds")List<Long> menuIds);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.entity.UserRegionMappingDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2022/2/24 16:08
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserRegionMappingMapper {
|
||||
|
||||
/**
|
||||
* 根据人员id列表查询人员所属部门
|
||||
*
|
||||
* @param userIds
|
||||
* @return
|
||||
*/
|
||||
List<UserRegionMappingDO> listUserRegionMappingByUserId( @Param("userIds") List<String> userIds);
|
||||
|
||||
/**
|
||||
* 查询部门下的人员
|
||||
*
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
List<UserRegionMappingDO> selectUserListByRegionIds( @Param("regionIds") List<String> regionIds);
|
||||
|
||||
/**
|
||||
* 查询指定部门人员数量
|
||||
*
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
Integer selectUserCountByRegionIds( @Param("regionIds") List<Long> regionIds);
|
||||
|
||||
/**
|
||||
* 获取区域的直连人员数量
|
||||
*
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
List<HashMap<String,Long>> getRegionUserCount( @Param("regionIds") List<String> regionIds);
|
||||
|
||||
/**
|
||||
* 根据Userids和regionids查询数据
|
||||
*
|
||||
* @param userIds
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
List<UserRegionMappingDO> listByUserIdsAndRegionIds(@Param("userIds") List<String> userIds,@Param("regionIds") List<String> regionIds);
|
||||
|
||||
/**
|
||||
* 获取用户属于哪些部门
|
||||
*
|
||||
* @param userIds
|
||||
* @return
|
||||
*/
|
||||
List<UserRegionMappingDO> getRegionIdsByUserIds(@Param("userIds") List<String> userIds);
|
||||
|
||||
/**
|
||||
* 获取部门有哪些用户
|
||||
*
|
||||
* @param regionIds
|
||||
* @return
|
||||
*/
|
||||
List<String> getUserIdsByRegionIds(@Param("regionIds") List<String> regionIds);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?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">
|
||||
<mapper namespace="com.cool.store.mapper.EnterpriseUserMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.EnterpriseUserDO">
|
||||
<id column="id" jdbcType="VARCHAR" property="id"/>
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
|
||||
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
||||
<result column="mobile" jdbcType="VARCHAR" property="mobile"/>
|
||||
<result column="email" jdbcType="VARCHAR" property="email"/>
|
||||
<result column="org_email" jdbcType="VARCHAR" property="orgEmail"/>
|
||||
<result column="main_admin" jdbcType="BIT" property="mainAdmin"/>
|
||||
<result column="is_admin" jdbcType="BIT" property="isAdmin"/>
|
||||
<result column="unionid" jdbcType="VARCHAR" property="unionid"/>
|
||||
<result column="avatar" jdbcType="VARCHAR" property="avatar"/>
|
||||
<result column="jobnumber" jdbcType="VARCHAR" property="jobnumber"/>
|
||||
<result column="is_leader" jdbcType="BIT" property="isLeader"/>
|
||||
<result column="is_leader_in_depts" jdbcType="VARCHAR" property="isLeaderInDepts"/>
|
||||
<result column="face_url" jdbcType="VARCHAR" property="faceUrl"/>
|
||||
<result column="user_status" jdbcType="TINYINT" property="userStatus"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.cool.store.entity.EnterpriseUserDO">
|
||||
<result column="user_region_ids" jdbcType="LONGVARCHAR" property="userRegionIds"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, name, remark, mobile, email, org_email, main_admin, is_admin, unionid,
|
||||
avatar, jobnumber, is_leader, is_leader_in_depts, face_url, user_status, create_time
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
user_region_ids
|
||||
</sql>
|
||||
|
||||
<select id="getUserInfoById" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>,
|
||||
<include refid="Blob_Column_List"/>
|
||||
from
|
||||
enterprise_user_${enterpriseId}
|
||||
where
|
||||
user_id = #{userId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getUserInfoByUserIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>,
|
||||
<include refid="Blob_Column_List"/>
|
||||
from
|
||||
enterprise_user_${enterpriseId}
|
||||
<where>
|
||||
<if test="userIdList !=null and userIdList.size>0">
|
||||
<foreach collection="userIdList" item="userId" open="and user_id in (" close=")" separator=",">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="searchUserByRegionIdsAndKeyword" resultMap="BaseResultMap">
|
||||
select
|
||||
user_id, name, mobile
|
||||
from
|
||||
enterprise_user_${enterpriseId}
|
||||
<where>
|
||||
active = true
|
||||
and <foreach collection="regionIds" item="regionId" separator=" or " open="(" close=")">user_region_ids like concat('%', #{regionId}, '%')</foreach>
|
||||
<if test="keyword != null">
|
||||
and (name like concat("%", #{keyword}, "%") or mobile like concat("%", #{keyword}, "%"))
|
||||
</if>
|
||||
<if test="leaderRegionIds != null and leaderRegionIds.size()>0">
|
||||
and <foreach collection="leaderRegionIds" item="regionId" separator=" or " open="(" close=")">user_region_ids like concat('%', #{regionId}, '%')</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getUserCountByRegionId" resultType="integer">
|
||||
select count(1) from enterprise_user_${enterpriseId} where active = true and user_region_ids like concat("%", #{regionId}, "%")
|
||||
</select>
|
||||
|
||||
<select id="getUserListByDeptLeader" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>,
|
||||
<include refid="Blob_Column_List"/>
|
||||
from
|
||||
enterprise_user_${enterpriseId}
|
||||
where
|
||||
is_leader_in_depts like concat("%", #{regionId}, "%") and active = true
|
||||
</select>
|
||||
|
||||
<select id="getUserListByDeptLeaders" resultMap="BaseResultMap">
|
||||
select
|
||||
user_id, name, mobile
|
||||
from
|
||||
enterprise_user_${enterpriseId}
|
||||
where
|
||||
active = true and <foreach collection="regionIds" separator="or" open="(" close=")" item="regionId"> is_leader_in_depts like concat("%", #{regionId}, "%") </foreach>
|
||||
</select>
|
||||
|
||||
<select id="getUserListByRegionIds" resultMap="BaseResultMap">
|
||||
select
|
||||
user_id, name, mobile
|
||||
from
|
||||
enterprise_user_${enterpriseId}
|
||||
where
|
||||
active = true and is_leader = 0 and
|
||||
<foreach collection="regionIds" separator="or" open="(" close=")" item="regionId">
|
||||
user_region_ids like concat("%", #{regionId}, "%")
|
||||
</foreach>
|
||||
ORDER BY
|
||||
CASE WHEN jobnumber='' OR jobnumber IS NULL THEN 1 ELSE 0 END,
|
||||
SUBSTR(jobnumber,1,1),
|
||||
CAST(SUBSTR(jobnumber,2) AS UNSIGNED) ASC
|
||||
</select>
|
||||
|
||||
<select id="selectByMobile" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"/> FROM enterprise_user_${enterpriseId} WHERE mobile =#{mobile} and active = true LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="selectByInvestmentManager" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM enterprise_user_${enterpriseId} WHERE ( mobile = #{investmentManager} or `name` = #{investmentManager} ) and active = true LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?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">
|
||||
|
||||
<mapper namespace="com.cool.store.mapper.EnterpriseUserRoleMapper">
|
||||
|
||||
<!-- 可根据自己的需求,是否要使用 -->
|
||||
<resultMap type="com.cool.store.entity.EnterpriseUserRole" id="enterpriseUserRoleMap">
|
||||
<result property="id" column="id"/>
|
||||
<result property="roleId" column="role_id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByPrimaryKey" resultMap="enterpriseUserRoleMap">
|
||||
select * from enterprise_user_role_${enterpriseId} where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectDingRoleMappingByUserId" resultMap="enterpriseUserRoleMap">
|
||||
SELECT
|
||||
eur.*
|
||||
FROM
|
||||
enterprise_user_role_${enterpriseId} eur
|
||||
LEFT JOIN sys_role_${enterpriseId} sr on eur.role_id = sr.id
|
||||
WHERE
|
||||
user_id = #{userId}
|
||||
and (sr.source = 'sync' OR sr.id IS NULL)
|
||||
</select>
|
||||
|
||||
<select id="listsUserRoleByUserIdListAndSource" resultMap="enterpriseUserRoleMap">
|
||||
SELECT
|
||||
eur.*
|
||||
FROM
|
||||
enterprise_user_role_${enterpriseId} eur
|
||||
LEFT JOIN sys_role_${enterpriseId} sr on eur.role_id = sr.id
|
||||
where user_id in
|
||||
<foreach item="userId" collection="userIds" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
and (sr.source = #{source} OR sr.id IS NULL)
|
||||
</select>
|
||||
|
||||
<select id="selectMdtRoleMappingByUserId" resultMap="enterpriseUserRoleMap">
|
||||
SELECT
|
||||
eur.*
|
||||
FROM
|
||||
enterprise_user_role_${enterpriseId} eur
|
||||
LEFT JOIN sys_role_${enterpriseId} sr on eur.role_id = sr.id
|
||||
WHERE
|
||||
user_id = #{userId}
|
||||
and (sr.syn_ding_role_id is not null OR sr.id IS NULL)
|
||||
</select>
|
||||
|
||||
<select id="selectByRoleId" resultMap="enterpriseUserRoleMap">
|
||||
select * from enterprise_user_role_${enterpriseId} where role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectIdsByUserId" resultType="java.lang.Long">
|
||||
select id from enterprise_user_role_${enterpriseId} where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectIdsByUserIds" resultType="java.lang.Long">
|
||||
select id from enterprise_user_role_${enterpriseId} where user_id in
|
||||
<foreach item="userId" collection="userIds" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectByUserIdList" resultMap="enterpriseUserRoleMap">
|
||||
select id, user_id, role_id
|
||||
from enterprise_user_role_${enterpriseId}
|
||||
where user_id in
|
||||
<foreach item="userId" collection="userIds" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectByUserIdAndRoleId" resultMap="enterpriseUserRoleMap">
|
||||
select * from enterprise_user_role_${enterpriseId}
|
||||
where user_id = #{userId} and role_id = #{roleId}
|
||||
order by id asc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectUserIdByRoleId" resultType="string">
|
||||
select
|
||||
user_id
|
||||
from
|
||||
enterprise_user_role_${enterpriseId}
|
||||
where role_id = #{roleId} and user_id in
|
||||
<foreach item="userId" collection="userIds" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="selectRoleIdsByUserId" resultType="java.lang.Long">
|
||||
select role_id as roleId from enterprise_user_role_${enterpriseId} where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectUserIdsByRoleId" resultType="java.lang.String">
|
||||
select
|
||||
user_id
|
||||
from
|
||||
enterprise_user_role_${enterpriseId}
|
||||
where role_id = #{roleId}
|
||||
</select>
|
||||
<select id="selectUserIdsByRoleIdList" resultType="java.lang.String">
|
||||
select
|
||||
DISTINCT a.user_id
|
||||
from
|
||||
enterprise_user_role_${enterpriseId} a left join enterprise_user_${enterpriseId} b on a.user_id=b.user_id
|
||||
where
|
||||
b.user_id != 'a100000001'
|
||||
and b.user_status = '1'
|
||||
and b.active = true
|
||||
and a.role_id in
|
||||
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getUserIdsByRoleIds" resultType="string">
|
||||
select
|
||||
user_id
|
||||
from
|
||||
enterprise_user_role_${enterpriseId}
|
||||
where
|
||||
role_id in <foreach collection="roleIds" open="(" close=")" separator="," item="roleId">#{roleId}</foreach>
|
||||
and
|
||||
user_id in <foreach collection="userIds" open="(" close=")" separator="," item="userId">#{userId}</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getUserRoleIds" resultType="long">
|
||||
select role_id from enterprise_user_role_${enterpriseId} where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="getUserIdsByRoleIdList" resultType="java.lang.String">
|
||||
select user_id
|
||||
from enterprise_user_role_${enterpriseId}
|
||||
where role_id in (
|
||||
<foreach collection="roleIdList" item="id" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,340 @@
|
||||
<?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">
|
||||
<mapper namespace="com.cool.store.mapper.HyPartnerUserInfoMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyPartnerUserInfoDO">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="partner_id" jdbcType="VARCHAR" property="partnerId" />
|
||||
<result column="mobile" jdbcType="VARCHAR" property="mobile" />
|
||||
<result column="username" jdbcType="VARCHAR" property="username" />
|
||||
<result column="live_area" jdbcType="VARCHAR" property="liveArea" />
|
||||
<result column="want_shop_area" jdbcType="VARCHAR" property="wantShopArea" />
|
||||
<result column="accept_adjust_type" jdbcType="TINYINT" property="acceptAdjustType" />
|
||||
<result column="invite_code" jdbcType="VARCHAR" property="inviteCode" />
|
||||
<result column="is_write_partner_know" jdbcType="TINYINT" property="isWritePartnerKnow" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="shop_code" jdbcType="VARCHAR" property="shopCode" />
|
||||
<result column="shop_name" jdbcType="VARCHAR" property="shopName" />
|
||||
<result column="shop_id" jdbcType="VARCHAR" property="shopId" />
|
||||
<result column="recommend_partner_id" jdbcType="VARCHAR" property="recommendPartnerId" />
|
||||
<result column="recommend_partner_name" jdbcType="VARCHAR" property="recommendPartnerName" />
|
||||
<result column="recommend_partner_mobile" jdbcType="VARCHAR" property="recommendPartnerMobile" />
|
||||
<result column="user_channel_id" jdbcType="BIGINT" property="userChannelId" />
|
||||
<result column="crm_create_time" jdbcType="TIMESTAMP" property="crmCreateTime" />
|
||||
<result column="openid" jdbcType="VARCHAR" property="openid" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, partner_id, mobile, username, live_area, want_shop_area, accept_adjust_type,
|
||||
invite_code, is_write_partner_know, create_time, update_time, shop_code, shop_name, shop_id,
|
||||
recommend_partner_id, recommend_partner_name, recommend_partner_mobile,user_channel_id,openid
|
||||
</sql>
|
||||
<select id="selectByPartnerId" resultMap="BaseResultMap" >
|
||||
select
|
||||
<include refid="Base_Column_List"></include>
|
||||
from hy_partner_user_info
|
||||
where partner_id = #{partnerId}
|
||||
</select>
|
||||
|
||||
<select id="selectByMobile" resultMap="BaseResultMap" >
|
||||
select
|
||||
<include refid="Base_Column_List"></include>
|
||||
from hy_partner_user_info
|
||||
where mobile = #{mobile}
|
||||
</select>
|
||||
|
||||
<select id="selectByOpenid" resultMap="BaseResultMap" >
|
||||
select
|
||||
<include refid="Base_Column_List"></include>
|
||||
from hy_partner_user_info
|
||||
where openid = #{openid}
|
||||
</select>
|
||||
|
||||
<select id="selectByPartnerIds" resultMap="BaseResultMap" >
|
||||
select
|
||||
<include refid="Base_Column_List"></include>
|
||||
from hy_partner_user_info
|
||||
<where>
|
||||
<if test="partnerIdList!=null and partnerIdList.size>0">
|
||||
<foreach collection="partnerIdList" open="and partner_id in (" close=")" separator="," item="partnerId">
|
||||
#{partnerId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectByHourDateCount" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
count(*)
|
||||
FROM
|
||||
hy_partner_line_info a
|
||||
LEFT JOIN hy_partner_user_info b ON a.partner_id = b.partner_id
|
||||
AND a.deleted = 0
|
||||
LEFT JOIN hy_partner_user_channel c ON b.user_channel_id = c.channel_id
|
||||
LEFT JOIN enterprise_user d ON a.investment_manager = d.user_id
|
||||
AND d.deleted = 0
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
partner_id,
|
||||
IFNULL( COUNT( 1 ), 0 ) AS followCount
|
||||
FROM
|
||||
hy_partner_line_info
|
||||
WHERE
|
||||
( deleted = 1 OR ( deleted = 0 AND line_status IN ( 0, 3 ) AND close_time IS NOT NULL ) )
|
||||
AND investment_manager IS NOT NULL
|
||||
GROUP BY
|
||||
partner_id
|
||||
) tl_l ON b.partner_id = tl_l.partner_id
|
||||
WHERE (b.update_time BETWEEN #{selectTime} and #{now} or
|
||||
a.update_time BETWEEN #{selectTime} and #{now} ) and b.partner_id is not null
|
||||
</select>
|
||||
<select id="selectLastCrmCreateTime" resultType="java.lang.String">
|
||||
SELECT crm_create_time as crmCreateTime FROM hy_partner_user_info ORDER BY crm_create_time desc limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
||||
insert into hy_partner_user_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="record.partnerId != null">
|
||||
partner_id,
|
||||
</if>
|
||||
<if test="record.mobile != null">
|
||||
mobile,
|
||||
</if>
|
||||
<if test="record.username != null">
|
||||
username,
|
||||
</if>
|
||||
<if test="record.liveArea != null">
|
||||
live_area,
|
||||
</if>
|
||||
<if test="record.wantShopArea != null">
|
||||
want_shop_area,
|
||||
</if>
|
||||
<if test="record.acceptAdjustType != null">
|
||||
accept_adjust_type,
|
||||
</if>
|
||||
<if test="record.inviteCode != null">
|
||||
invite_code,
|
||||
</if>
|
||||
<if test="record.isWritePartnerKnow != null">
|
||||
is_write_partner_know,
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="record.shopCode != null">
|
||||
shop_code,
|
||||
</if>
|
||||
<if test="record.shopName != null">
|
||||
shop_name,
|
||||
</if>
|
||||
<if test="record.shopId != null">
|
||||
shop_id,
|
||||
</if>
|
||||
<if test="record.recommendPartnerId != null">
|
||||
recommend_partner_id,
|
||||
</if>
|
||||
<if test="record.recommendPartnerName != null">
|
||||
recommend_partner_name,
|
||||
</if>
|
||||
<if test="record.recommendPartnerMobile != null">
|
||||
recommend_partner_mobile,
|
||||
</if>
|
||||
<if test="record.userChannelId!=null">
|
||||
user_channel_id,
|
||||
</if>
|
||||
<if test="record.ecWantShopArea!=null">
|
||||
ec_want_shop_area,
|
||||
</if>
|
||||
<if test="record.crmCreateTime!=null">
|
||||
crm_create_time,
|
||||
</if>
|
||||
<if test="record.openid!=null">
|
||||
openid,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="record.partnerId != null">
|
||||
#{record.partnerId},
|
||||
</if>
|
||||
<if test="record.mobile != null">
|
||||
#{record.mobile},
|
||||
</if>
|
||||
<if test="record.username != null">
|
||||
#{record.username},
|
||||
</if>
|
||||
<if test="record.liveArea != null">
|
||||
#{record.liveArea},
|
||||
</if>
|
||||
<if test="record.wantShopArea != null">
|
||||
#{record.wantShopArea},
|
||||
</if>
|
||||
<if test="record.acceptAdjustType != null">
|
||||
#{record.acceptAdjustType},
|
||||
</if>
|
||||
<if test="record.inviteCode != null">
|
||||
#{record.inviteCode},
|
||||
</if>
|
||||
<if test="record.isWritePartnerKnow != null">
|
||||
#{record.isWritePartnerKnow},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
#{record.createTime},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
#{record.updateTime},
|
||||
</if>
|
||||
<if test="record.shopCode != null">
|
||||
#{record.shopCode},
|
||||
</if>
|
||||
<if test="record.shopName != null">
|
||||
#{record.shopName},
|
||||
</if>
|
||||
<if test="record.shopId != null">
|
||||
#{record.shopId},
|
||||
</if>
|
||||
<if test="record.recommendPartnerId != null">
|
||||
#{record.recommendPartnerId},
|
||||
</if>
|
||||
<if test="record.recommendPartnerName != null">
|
||||
#{record.recommendPartnerName},
|
||||
</if>
|
||||
<if test="record.recommendPartnerMobile != null">
|
||||
#{record.recommendPartnerMobile},
|
||||
</if>
|
||||
<if test="record.userChannelId != null">
|
||||
#{record.userChannelId},
|
||||
</if>
|
||||
<if test="record.ecWantShopArea != null">
|
||||
#{record.ecWantShopArea},
|
||||
</if>
|
||||
<if test="record.crmCreateTime != null">
|
||||
#{record.crmCreateTime},
|
||||
</if>
|
||||
<if test="record.openid != null">
|
||||
#{record.openid},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective">
|
||||
update hy_partner_user_info
|
||||
<set>
|
||||
<if test="record.partnerId != null">
|
||||
partner_id = #{record.partnerId},
|
||||
</if>
|
||||
<if test="record.mobile != null">
|
||||
mobile = #{record.mobile},
|
||||
</if>
|
||||
<if test="record.username != null">
|
||||
username = #{record.username},
|
||||
</if>
|
||||
<if test="record.liveArea != null">
|
||||
live_area = #{record.liveArea},
|
||||
</if>
|
||||
<if test="record.wantShopArea != null">
|
||||
want_shop_area = #{record.wantShopArea},
|
||||
</if>
|
||||
<if test="record.acceptAdjustType != null">
|
||||
accept_adjust_type = #{record.acceptAdjustType},
|
||||
</if>
|
||||
<if test="record.inviteCode != null">
|
||||
invite_code = #{record.inviteCode},
|
||||
</if>
|
||||
<if test="record.isWritePartnerKnow != null">
|
||||
is_write_partner_know = #{record.isWritePartnerKnow},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime},
|
||||
</if>
|
||||
<if test="record.shopCode != null">
|
||||
shop_code = #{record.shopCode},
|
||||
</if>
|
||||
<if test="record.shopName != null">
|
||||
shop_name = #{record.shopName},
|
||||
</if>
|
||||
<if test="record.shopId != null">
|
||||
shop_id = #{record.shopId},
|
||||
</if>
|
||||
<if test="record.recommendPartnerId != null">
|
||||
recommend_partner_id = #{record.recommendPartnerId},
|
||||
</if>
|
||||
<if test="record.recommendPartnerName != null">
|
||||
recommend_partner_name = #{record.recommendPartnerName},
|
||||
</if>
|
||||
<if test="record.recommendPartnerMobile != null">
|
||||
recommend_partner_mobile = #{record.recommendPartnerMobile},
|
||||
</if>
|
||||
<if test="record.ecWantShopArea != null">
|
||||
ec_want_shop_area = #{record.ecWantShopArea},
|
||||
</if>
|
||||
<if test="record.openid != null">
|
||||
openid = #{record.openid},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{record.id}
|
||||
</update>
|
||||
|
||||
<update id="updateJoinKnowById">
|
||||
update hy_partner_user_info
|
||||
set `is_write_partner_know`=#{isWritePartnerKnow,jdbcType=INTEGER}
|
||||
where id=#{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<update id="updateByPartnerId">
|
||||
update hy_partner_user_info
|
||||
<set>
|
||||
<if test="record.mobile != null">
|
||||
mobile = #{record.mobile},
|
||||
</if>
|
||||
<if test="record.username != null">
|
||||
username = #{record.username},
|
||||
</if>
|
||||
<if test="record.liveArea != null">
|
||||
live_area = #{record.liveArea},
|
||||
</if>
|
||||
<if test="record.wantShopArea != null">
|
||||
want_shop_area = #{record.wantShopArea},
|
||||
</if>
|
||||
<if test="record.acceptAdjustType != null">
|
||||
accept_adjust_type = #{record.acceptAdjustType},
|
||||
</if>
|
||||
<if test="record.inviteCode != null">
|
||||
invite_code = #{record.inviteCode},
|
||||
</if>
|
||||
<if test="record.isWritePartnerKnow != null">
|
||||
is_write_partner_know = #{record.isWritePartnerKnow},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime},
|
||||
</if>
|
||||
<if test="record.shopCode != null">
|
||||
shop_code = #{record.shopCode},
|
||||
</if>
|
||||
<if test="record.shopName != null">
|
||||
shop_name = #{record.shopName},
|
||||
</if>
|
||||
<if test="record.shopId != null">
|
||||
shop_id = #{record.shopId},
|
||||
</if>
|
||||
<if test="record.recommendPartnerId != null">
|
||||
recommend_partner_id = #{record.recommendPartnerId},
|
||||
</if>
|
||||
<if test="record.recommendPartnerName != null">
|
||||
recommend_partner_name = #{record.recommendPartnerName},
|
||||
</if>
|
||||
<if test="record.recommendPartnerMobile != null">
|
||||
recommend_partner_mobile = #{record.recommendPartnerMobile},
|
||||
</if>
|
||||
</set>
|
||||
where partner_id = #{record.partnerId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
335
coolstore-partner-dao/src/main/resources/mapper/RegionMapper.xml
Normal file
335
coolstore-partner-dao/src/main/resources/mapper/RegionMapper.xml
Normal file
@@ -0,0 +1,335 @@
|
||||
<?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" >
|
||||
<mapper namespace="com.cool.store.mapper.RegionMapper">
|
||||
|
||||
<sql id="fields">
|
||||
id ,
|
||||
id as regionId,
|
||||
name ,
|
||||
parent_id as parentId,
|
||||
group_id as groupId,
|
||||
store_id as storeId,
|
||||
create_time as createTime,
|
||||
create_name as createName,
|
||||
update_time as updateTime,
|
||||
update_name as updateName,
|
||||
syn_ding_dept_id as synDingDeptId,
|
||||
region_type as regionType,
|
||||
region_path as regionPath,
|
||||
deleted as deleted,
|
||||
third_dept_id as thirdDeptId
|
||||
</sql>
|
||||
|
||||
<select id="getRegionByRegionIdsForMap" resultType="com.cool.store.entity.RegionDO">
|
||||
select
|
||||
id ,
|
||||
id as regionId,
|
||||
name
|
||||
from region_${enterpriseId} where id in
|
||||
<foreach collection="regionIds" index="index" item="regionId"
|
||||
separator="," open="(" close=")">
|
||||
#{regionId, jdbcType=BIGINT}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getRegionByRegionId" resultType="com.cool.store.dto.RegionNode">
|
||||
select
|
||||
id ,
|
||||
id as regionId,
|
||||
name as name ,
|
||||
parent_id as parentId,
|
||||
group_id as groupId,
|
||||
create_time as createTime,
|
||||
create_name as createName,
|
||||
update_time as updateTime,
|
||||
update_name as updateName,
|
||||
syn_ding_dept_id as synDingDeptId,
|
||||
region_type as regionType,
|
||||
region_path as regionPath,
|
||||
store_num as storeCount
|
||||
from region_${enterpriseId} where id = #{regionId, jdbcType=BIGINT} and deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="getRegionByRegionIds" resultType="com.cool.store.entity.RegionDO">
|
||||
select
|
||||
id ,
|
||||
id as regionId,
|
||||
name ,
|
||||
parent_id as parentId,
|
||||
group_id as groupId,
|
||||
create_time as createTime,
|
||||
create_name as createName,
|
||||
syn_ding_dept_id as synDingDeptId,
|
||||
update_time as updateTime,
|
||||
update_name as updateName,
|
||||
region_path as regionPath,
|
||||
store_num as storeNum,
|
||||
store_id as storeId,
|
||||
region_type as regionType,
|
||||
is_external_node as isExternalNode,
|
||||
third_dept_id as thirdDeptId
|
||||
from region_${enterpriseId} where id in
|
||||
<foreach collection="regionIds" index="index" item="regionId"
|
||||
separator="," open="(" close=")">
|
||||
#{regionId, jdbcType=BIGINT}
|
||||
</foreach>
|
||||
and deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="getByIds" resultType="com.cool.store.entity.RegionDO">
|
||||
select
|
||||
id ,
|
||||
id as regionId,
|
||||
name ,
|
||||
parent_id as parentId,
|
||||
group_id as groupId,
|
||||
create_time as createTime,
|
||||
create_name as createName,
|
||||
update_time as updateTime,
|
||||
update_name as updateName,
|
||||
store_id as storeId,
|
||||
order_num as orderNum,
|
||||
deleted as deleted,
|
||||
region_path as regionPath
|
||||
from region_${enterpriseId}
|
||||
where id in (
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getByRegionId" resultType="com.cool.store.entity.RegionDO">
|
||||
select
|
||||
id ,
|
||||
id as regionId,
|
||||
name as name ,
|
||||
parent_id as parentId,
|
||||
group_id as groupId,
|
||||
create_time as createTime,
|
||||
create_name as createName,
|
||||
update_time as updateTime,
|
||||
update_name as updateName,
|
||||
syn_ding_dept_id as synDingDeptId,
|
||||
store_id as storeId,
|
||||
region_type as regionType,
|
||||
region_path as regionPath,
|
||||
deleted,
|
||||
store_num as storeNum
|
||||
from region_${enterpriseId}
|
||||
where id = #{regionId}
|
||||
</select>
|
||||
|
||||
<select id="getRegionsByParentId" resultType="com.cool.store.entity.RegionDO">
|
||||
select
|
||||
id ,
|
||||
region_id as regionId,
|
||||
name ,
|
||||
parent_id as parentId,
|
||||
group_id as groupId,
|
||||
create_time as createTime,
|
||||
create_name as createName,
|
||||
update_time as updateTime,
|
||||
update_name as updateName,
|
||||
region_path as regionPath,
|
||||
region_type as regionType,
|
||||
store_num as storeNum,
|
||||
store_id as storeId
|
||||
from region_${enterpriseId}
|
||||
where parent_id = #{parentId} and deleted = 0
|
||||
order by region_type
|
||||
</select>
|
||||
|
||||
<select id="listRegionByIds" resultType="com.cool.store.entity.RegionDO">
|
||||
select
|
||||
id ,
|
||||
region_id as regionId,
|
||||
name as name ,
|
||||
parent_id as parentId,
|
||||
group_id as groupId,
|
||||
create_time as createTime,
|
||||
create_name as createName,
|
||||
update_time as updateTime,
|
||||
update_name as updateName,
|
||||
vds_group_corp_id as vdsGroupCorpId,
|
||||
syn_ding_dept_id as synDingDeptId,
|
||||
region_type as regionType,
|
||||
deleted as deleted,
|
||||
region_path as regionPath,
|
||||
store_num as storeNum
|
||||
from region_${enterpriseId}
|
||||
where deleted = 0
|
||||
and id in (
|
||||
<foreach collection="regionIds" item="regionId" separator=",">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="listRegionByRegionPath" resultType="com.cool.store.entity.RegionDO">
|
||||
select
|
||||
id ,
|
||||
region_id as regionId,
|
||||
name as name ,
|
||||
parent_id as parentId,
|
||||
group_id as groupId,
|
||||
create_time as createTime,
|
||||
create_name as createName,
|
||||
update_time as updateTime,
|
||||
update_name as updateName,
|
||||
vds_group_corp_id as vdsGroupCorpId,
|
||||
syn_ding_dept_id as synDingDeptId,
|
||||
region_type as regionType,
|
||||
deleted as deleted
|
||||
from region_${enterpriseId}
|
||||
where deleted = 0
|
||||
and region_path like concat(#{regionPath},'%')
|
||||
</select>
|
||||
|
||||
<select id="getRegionPathByIds" resultType="com.cool.store.entity.RegionDO">
|
||||
select
|
||||
id,
|
||||
name,
|
||||
region_path
|
||||
from region_${enterpriseId}
|
||||
where id in (
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getRegionsByEid" resultType="com.cool.store.entity.RegionDO">
|
||||
select
|
||||
id ,
|
||||
region_id as regionId,
|
||||
name ,
|
||||
parent_id as parentId,
|
||||
create_time as createTime,
|
||||
update_time as updateTime,
|
||||
order_num as orderNum,
|
||||
deleted as deleted
|
||||
from region_${enterpriseId} where id != 1
|
||||
<if test="regionId!=null">
|
||||
and region_path like concat('%/',#{regionId},'/%')
|
||||
</if>
|
||||
order by id
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getSubRegion" resultType="com.cool.store.entity.RegionDO">
|
||||
select
|
||||
id ,
|
||||
id as regionId,
|
||||
name ,
|
||||
parent_id as parentId,
|
||||
group_id as groupId,
|
||||
create_time as createTime,
|
||||
create_name as createName,
|
||||
syn_ding_dept_id as synDingDeptId,
|
||||
update_time as updateTime,
|
||||
update_name as updateName,
|
||||
region_path as regionPath,
|
||||
store_num as storeNum,
|
||||
store_id as storeId,
|
||||
region_type as regionType,
|
||||
syn_ding_dept_id as synDingDeptId
|
||||
from region_${enterpriseId}
|
||||
where deleted = 0 and parent_id = #{parentId}
|
||||
</select>
|
||||
|
||||
<select id="getByRegionIdExcludeDeleted" resultType="com.cool.store.entity.RegionDO">
|
||||
select
|
||||
id ,
|
||||
id as regionId,
|
||||
name as name ,
|
||||
parent_id as parentId,
|
||||
group_id as groupId,
|
||||
create_time as createTime,
|
||||
create_name as createName,
|
||||
update_time as updateTime,
|
||||
update_name as updateName,
|
||||
syn_ding_dept_id as synDingDeptId,
|
||||
store_id as storeId,
|
||||
region_type as regionType,
|
||||
region_path as regionPath,
|
||||
deleted,
|
||||
store_num as storeNum
|
||||
from region_${enterpriseId}
|
||||
where id = #{regionId} and deleted = 0;
|
||||
</select>
|
||||
|
||||
<select id="getSubIdsByRegionIds" resultType="string">
|
||||
select
|
||||
id
|
||||
from
|
||||
region_${enterpriseId}
|
||||
where
|
||||
deleted = 0
|
||||
and
|
||||
<foreach collection="regionPaths" separator=" or " open="(" close=")" item="region" > region_path like concat(#{region}, "%")</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getSubIdsByRegionpaths" resultType="string">
|
||||
select
|
||||
id
|
||||
from
|
||||
region_${enterpriseId}
|
||||
where
|
||||
deleted = 0
|
||||
and region_type = 'path'
|
||||
and
|
||||
<foreach collection="regionPaths" separator=" or " open="(" close=")" item="region" > region_path like concat('%',#{region}, "%")</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getRegionPathByRegionIds" resultType="string">
|
||||
select
|
||||
region_path
|
||||
from
|
||||
region_${enterpriseId}
|
||||
where
|
||||
deleted = 0
|
||||
and
|
||||
id in <foreach collection="regionIds" separator="," open="(" close=")" item="region" > #{region}</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getCompRegionByRegionIds" resultType="com.cool.store.entity.RegionDO">
|
||||
select
|
||||
<include refid="fields"></include>
|
||||
from region_${enterpriseId}
|
||||
where region_type = 'path'
|
||||
and deleted = 0
|
||||
and (
|
||||
region_path like
|
||||
<foreach collection="stringCompParentIdList" item="id" separator="or region_path like" close="">
|
||||
concat('%/',#{id},'/%')
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
<select id="countByRegionIdList" resultType="java.lang.Integer">
|
||||
select
|
||||
count(0)
|
||||
from region_${enterpriseId}
|
||||
where id in (
|
||||
<foreach collection="regionIdList" separator="," item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getRegionByParentIds" resultType="com.cool.store.entity.RegionDO">
|
||||
select <include refid="fields"/>
|
||||
from region_${enterpriseId}
|
||||
WHERE
|
||||
deleted = 0
|
||||
AND parent_id in (
|
||||
<foreach collection="regionIdList" separator="," item="id">
|
||||
#{id}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?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" >
|
||||
<mapper namespace="com.cool.store.mapper.SysMenuMapper">
|
||||
|
||||
<resultMap type="com.cool.store.entity.SysMenuDO"
|
||||
id="SysMenuDOResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="code" column="code"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="alias" column="alias"/>
|
||||
<result property="path" column="path"/>
|
||||
<result property="perms" column="perms"/>
|
||||
<result property="source" column="source"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="category" column="category"/>
|
||||
<result property="action" column="action"/>
|
||||
<result property="platform" column="platform"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="target" column="target"/>
|
||||
<result property="component" column="component"/>
|
||||
<result property="icon" column="icon"/>
|
||||
<result property="menuType" column="menu_type"/>
|
||||
<result property="env" column="env"/>
|
||||
<result property="commonFunctionsIcon" column="common_functions_icon"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectMenuAll" resultMap="SysMenuDOResult">
|
||||
select
|
||||
id ,
|
||||
name ,
|
||||
parent_id ,
|
||||
code ,
|
||||
alias ,
|
||||
path ,
|
||||
perms ,
|
||||
source ,
|
||||
sort ,
|
||||
category ,
|
||||
action ,
|
||||
remark ,
|
||||
platform,
|
||||
type,
|
||||
target,
|
||||
component,
|
||||
icon,
|
||||
menu_type,
|
||||
env,
|
||||
common_functions_icon
|
||||
from sys_menu_v2
|
||||
<where>
|
||||
platform=#{platformType}
|
||||
<if test="list!=null and list.size>0">
|
||||
and parent_id in
|
||||
<foreach collection="list" item="parentId" open="(" close=")" separator=",">
|
||||
#{parentId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="env != null and env != ''">
|
||||
and (env = #{env} or env is null or env = '')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMenu" resultMap="SysMenuDOResult">
|
||||
select *
|
||||
from sys_menu_v2
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,341 @@
|
||||
<?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" >
|
||||
<mapper namespace="com.cool.store.mapper.SysRoleMapper">
|
||||
|
||||
<resultMap type="com.cool.store.entity.SysRoleDO" id="sysRoleMap">
|
||||
<result property="id" column="id"/>
|
||||
<result property="roleName" column="role_name"/>
|
||||
<result property="isInternal" column="is_internal"/>
|
||||
<result property="roleAuth" column="role_auth"/>
|
||||
<result property="source" column="source"/>
|
||||
<result property="positionType" column="position_type"/>
|
||||
<result property="appMenu" column="app_menu"/>
|
||||
<result property="synDingRoleId" column="syn_ding_role_id"/>
|
||||
<result property="priority" column="priority"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="createUser" column="create_user"/>
|
||||
<result property="updateUser" column="update_user"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="sysRoleVo" type="com.cool.store.vo.SysRoleVO">
|
||||
<id column="id" property="id" jdbcType="BIGINT"/>
|
||||
<result column="role_name" property="roleName" jdbcType="VARCHAR"/>
|
||||
<result column="is_internal" property="isInternal" jdbcType="BIGINT"/>
|
||||
<result column="role_auth" property="roleAuth" jdbcType="BIGINT"/>
|
||||
|
||||
<collection property="enterpriseDOs" ofType="com.cool.store.entity.EnterpriseUserDO">
|
||||
<id column="cid" property="id" jdbcType="BIGINT"/>
|
||||
<result column="user_id" property="userId" jdbcType="VARCHAR"/>
|
||||
<result column="name" property="name" jdbcType="VARCHAR"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="getRoleUserByRoleEnum" resultMap="sysRoleVo">
|
||||
select
|
||||
a.id ,
|
||||
a.role_name ,
|
||||
a.is_internal ,
|
||||
c.id as cid,
|
||||
c.user_id ,
|
||||
c.name
|
||||
from sys_role_${enterpriseId} a
|
||||
left join enterprise_user_role_${enterpriseId} b on a.id=b.role_id
|
||||
left join enterprise_user_${enterpriseId} c on c.user_id=b.user_id and c.active = true
|
||||
and c.user_status= '1'
|
||||
<where>
|
||||
(c.user_id != 'a100000001' or c.user_id is null)
|
||||
and a.role_enum = #{roleEnum}
|
||||
<if test="positionType !=null and positionType!=''">
|
||||
and a.position_type=#{positionType}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getRoleUserByRoleAuth" resultMap="sysRoleVo">
|
||||
select
|
||||
a.id ,
|
||||
a.role_name ,
|
||||
a.is_internal ,
|
||||
c.id as cid,
|
||||
c.user_id ,
|
||||
c.name
|
||||
from sys_role_${enterpriseId} a
|
||||
left join enterprise_user_role_${enterpriseId} b on a.id=b.role_id
|
||||
left join enterprise_user_${enterpriseId} c on c.user_id=b.user_id and c.active = true
|
||||
and c.user_status = '1'
|
||||
<where>
|
||||
(c.user_id != 'a100000001' or c.user_id is null)
|
||||
|
||||
<if test="roleAuth!=null">
|
||||
and role_auth = #{roleAuth, jdbcType=VARCHAR}
|
||||
</if>
|
||||
-- and a.source = 'create'
|
||||
<if test="positionType !=null and positionType!=''">
|
||||
and a.position_type=#{positionType}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getPersonNumsByRoles" resultType="integer">
|
||||
select count(a.id) as count
|
||||
from enterprise_user_${enterpriseId} a
|
||||
left join enterprise_user_role_${enterpriseId} b on a.user_id =b.user_id
|
||||
left join sys_role_${enterpriseId} c on c.id=b.role_id
|
||||
where a.active=true
|
||||
-- and c.source = 'create'
|
||||
<if test="roleId!=null ">
|
||||
and c.id= #{roleId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getUserIdListByRoleIdList" resultType="java.lang.String">
|
||||
select
|
||||
distinct a.user_id
|
||||
from enterprise_user_${enterpriseId} a
|
||||
left join enterprise_user_role_${enterpriseId} b on a.user_id=b.user_id
|
||||
<where>
|
||||
and a.active=true
|
||||
and a.user_id != 'a100000001'
|
||||
-- and c.source = 'create'
|
||||
and b.role_id in (
|
||||
<foreach collection="roleIdList" separator="," item="roleId">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
)
|
||||
</where>
|
||||
</select>
|
||||
<select id="userAndRolesByUserId" resultType="com.cool.store.dto.UserRoleDTO">
|
||||
select
|
||||
a.role_id as roleId,
|
||||
a.user_id as userId,
|
||||
b.role_name as roleName,
|
||||
b.role_auth as roleAuth,
|
||||
b.role_enum as roleEnum,
|
||||
b.priority as priority
|
||||
from enterprise_user_role_${enterpriseId} a left join sys_role_${enterpriseId} b on a.role_id=b.id
|
||||
<where>
|
||||
<if test="userIdList != null and userIdList.size>0">
|
||||
<foreach collection="userIdList" item="userId" separator="," open="a.user_id in (" close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</if>
|
||||
-- and b.source = 'create'
|
||||
AND b.role_name IS NOT NULL
|
||||
</where>
|
||||
order by b.priority
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getRolesByName" resultType="com.cool.store.entity.SysRoleDO">
|
||||
select
|
||||
id as id,
|
||||
role_name as roleName,
|
||||
role_auth as roleAuth
|
||||
from sys_role_${enterpriseId}
|
||||
where role_name=#{roleName} and source ='create'
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getRole" resultType="com.cool.store.entity.SysRoleDO">
|
||||
select
|
||||
id as id,
|
||||
role_name as roleName,
|
||||
role_auth as roleAuth,
|
||||
is_internal as isInternal,
|
||||
`source` as source,
|
||||
priority as priority,
|
||||
app_menu as appMenu,
|
||||
position_type as positionType,
|
||||
role_enum as roleEnum
|
||||
from sys_role_${enterpriseId}
|
||||
where id = #{roleId}
|
||||
</select>
|
||||
|
||||
<select id="getRoleByRoleEnum" resultType="com.cool.store.entity.SysRoleDO">
|
||||
select
|
||||
id as id,
|
||||
role_name as roleName,
|
||||
role_auth as roleAuth,
|
||||
is_internal as isInternal,
|
||||
`source` as source,
|
||||
priority as priority,
|
||||
app_menu as appMenu,
|
||||
position_type as positionType,
|
||||
role_enum as roleEnum
|
||||
from sys_role_${enterpriseId}
|
||||
where role_enum = #{roleEnum}
|
||||
</select>
|
||||
|
||||
<select id="getRoleList" resultType="com.cool.store.entity.SysRoleDO">
|
||||
select
|
||||
id as id,
|
||||
role_name as roleName,
|
||||
role_auth as roleAuth,
|
||||
`source` as source,
|
||||
priority as priority,
|
||||
is_internal as isInternal,
|
||||
app_menu as appMenu,
|
||||
position_type as positionType
|
||||
from sys_role_${enterpriseId}
|
||||
where 1 = 1
|
||||
-- source='create'
|
||||
<foreach collection="roleIdList" item="roleId" separator="," open="and id in (" close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getRoleByRoleIds" resultType="com.cool.store.entity.SysRoleDO">
|
||||
select
|
||||
id as id,
|
||||
role_name as roleName,
|
||||
role_auth as roleAuth,
|
||||
`source` as source,
|
||||
priority as priority,
|
||||
is_internal as isInternal,
|
||||
app_menu as appMenu,
|
||||
create_time as createTime,
|
||||
update_time as updateTime,
|
||||
position_type as positionType
|
||||
from sys_role_${enterpriseId}
|
||||
where 1 = 1
|
||||
<foreach collection="roleIdList" item="roleId" separator="," open="and id in (" close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getRoleNameList" resultType="java.lang.String">
|
||||
select
|
||||
role_name as roleName
|
||||
from sys_role_${enterpriseId}
|
||||
where source='create'
|
||||
<foreach collection="roleIdList" item="roleId" separator="," open="and id in (" close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getHighestPrioritySysRoleDoByUserId" resultType="com.cool.store.entity.SysRoleDO">
|
||||
select
|
||||
c.id as id,
|
||||
c.role_name as roleName,
|
||||
c.role_auth as roleAuth,
|
||||
c.position_type as positionType,
|
||||
c.app_menu as appMenu,
|
||||
c.role_enum as roleEnum
|
||||
from enterprise_user_${enterpriseId} a
|
||||
left join enterprise_user_role_${enterpriseId} b on a.user_id =b.user_id
|
||||
left join sys_role_${enterpriseId} c on c.id=b.role_id
|
||||
where a.user_id= #{userId}
|
||||
and a.active = true
|
||||
ORDER BY c.priority is null , c.priority, position_type desc
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getSysRoleByUserId" resultType="com.cool.store.entity.SysRoleDO">
|
||||
select c.id as id,
|
||||
c.role_name as roleName,
|
||||
c.role_auth as roleAuth,
|
||||
c.source as source
|
||||
from enterprise_user_${enterpriseId} a
|
||||
left join enterprise_user_role_${enterpriseId} b on a.user_id = b.user_id
|
||||
left join sys_role_${enterpriseId} c on c.id = b.role_id
|
||||
where a.user_id = #{userId}
|
||||
and a.active = true
|
||||
AND c.role_name IS NOT NULL
|
||||
</select>
|
||||
|
||||
<select id="listRoleByUserId" resultType="com.cool.store.entity.SysRoleDO">
|
||||
select c.id as id,
|
||||
c.role_name as roleName,
|
||||
c.role_auth as roleAuth,
|
||||
c.source as source,
|
||||
c.role_enum as roleEnum
|
||||
from enterprise_user_role_${enterpriseId} b
|
||||
left join sys_role_${enterpriseId} c on c.id = b.role_id
|
||||
where b.user_id = #{userId}
|
||||
|
||||
</select>
|
||||
<select id="selectRolesByuserId" resultType="java.lang.String">
|
||||
select
|
||||
role_id
|
||||
from enterprise_user_role_${enterpriseId}
|
||||
where user_id = #{userId}
|
||||
-- and sr.source = 'create'
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getHighestPriorityRoleIdByUserId" resultType="java.lang.String">
|
||||
select
|
||||
eur.role_id
|
||||
from enterprise_user_role_${enterpriseId} eur
|
||||
left join sys_role_${enterpriseId} sr
|
||||
on eur.role_id = sr.id
|
||||
where user_id = #{userId}
|
||||
ORDER BY sr.priority is null , sr.priority
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getPositionUserIds" resultType="java.lang.String">
|
||||
select eu.user_id from
|
||||
enterprise_user_role_${enterpriseId} eur
|
||||
left join enterprise_user_${enterpriseId} eu USING(user_id)
|
||||
where eur.role_id in
|
||||
<foreach collection="positionIds" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
and eu.active = true
|
||||
</select>
|
||||
|
||||
<select id="selectUserByDingRole" resultType="java.lang.String">
|
||||
select b.user_id from sys_role_${enterpriseId} a
|
||||
left join enterprise_user_role_${enterpriseId} b on a.id=b.role_id
|
||||
left join enterprise_user_${enterpriseId} c on b.user_id=c.user_id
|
||||
where role_id=#{roleId} and c.active=true
|
||||
</select>
|
||||
|
||||
<select id="selectUserRoleBySourceAndUserId" resultType="com.cool.store.entity.EnterpriseUserRole">
|
||||
select b.role_id as roleId,
|
||||
b.user_id as userId
|
||||
from sys_role_${enterpriseId} a
|
||||
left join enterprise_user_role_${enterpriseId} b on a.id=b.role_id
|
||||
<where>
|
||||
<if test="userIdList!=null and userIdList.size>0">
|
||||
<foreach collection="userIdList" separator="," open="and b.user_id in(" close=")" item="userId">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="source!=null and source!=''">
|
||||
and a.source = #{source}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getUserRoleNameByUserIdList" resultType="com.cool.store.dto.UserRoleDTO">
|
||||
select
|
||||
a.user_id as userId,
|
||||
group_concat(b.role_name) as roleName
|
||||
from enterprise_user_role_${enterpriseId} a left join sys_role_${enterpriseId} b on a.role_id=b.id
|
||||
where
|
||||
<foreach collection="userIdList" item="userId" separator="," open="a.user_id in (" close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
group by a.user_id
|
||||
</select>
|
||||
|
||||
<select id="selectBySynDingRoleIdAndSource" resultType="com.cool.store.entity.SysRoleDO">
|
||||
select id, role_name as roleName, is_internal as isInternal, role_auth as roleAuth, `source`,
|
||||
position_type as positionType, app_menu as appMenu, syn_ding_role_id as synDingRoleId,
|
||||
priority, create_time as createTime, update_time as updateTime,role_enum as roleEnum
|
||||
from sys_role_${enterpriseId}
|
||||
<where>
|
||||
<if test="source != null and source != ''">
|
||||
and source = #{source}
|
||||
</if>
|
||||
<if test="synDingRoleId != null">
|
||||
and syn_ding_role_id = #{synDingRoleId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY priority
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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" >
|
||||
<mapper namespace="com.cool.store.mapper.SysRoleMenuMapper">
|
||||
|
||||
<resultMap id="baseResult" type="com.cool.store.entity.SysRoleMenuDO">
|
||||
<result property="id" column="id"/>
|
||||
<result property="menuId" column="menu_id"/>
|
||||
<result property="roleId" column="role_id"/>
|
||||
<result property="platform" column="platform"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="listSysRoleMenuByRoleIdOld" resultMap="baseResult">
|
||||
select * from
|
||||
sys_role_menu_${enterpriseId}
|
||||
where role_id=#{roleId} and platform=#{platform}
|
||||
</select>
|
||||
<select id="listSysRoleMenuByRoleId" resultMap="baseResult">
|
||||
select * from
|
||||
sys_role_menu_v2_${enterpriseId}
|
||||
where role_id=#{roleId} and platform=#{platform}
|
||||
</select>
|
||||
|
||||
<select id="listSysRoleMenuByPlatform" resultMap="baseResult">
|
||||
select * from
|
||||
sys_role_menu_v2_${enterpriseId}
|
||||
where platform=#{platform}
|
||||
order by id asc
|
||||
</select>
|
||||
|
||||
<select id="listSysRoleMenuIdByMenuId" resultType="java.lang.Long">
|
||||
select DISTINCT role_id from
|
||||
sys_role_menu_v2_${enterpriseId}
|
||||
where menu_id=#{menuId} and platform=#{platform}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="listRoleMenuIdByMenuIds" resultMap="baseResult">
|
||||
select * from
|
||||
sys_role_menu_${enterpriseId}
|
||||
where
|
||||
menu_id in
|
||||
<foreach collection="menuIds" open="(" close=")" separator="," item="menuId">#{menuId}</foreach>
|
||||
order by id asc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,110 @@
|
||||
<?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" >
|
||||
<mapper namespace="com.cool.store.mapper.UserRegionMappingMapper">
|
||||
<resultMap type="com.cool.store.entity.UserRegionMappingDO" id="BaseMap">
|
||||
<result property="id" column="id"/>
|
||||
<result property="regionId" column="region_id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="createId" column="create_id"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateId" column="update_id"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, region_id, user_id, create_id, create_time, update_id, update_time
|
||||
</sql>
|
||||
|
||||
<select id="listUserRegionMappingByUserId" resultMap="BaseMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from user_region_mapping_${enterpriseId}
|
||||
<if test="userIds !=null and userIds.size >0">
|
||||
where user_id in
|
||||
<foreach collection="userIds" open="(" close=")" separator="," item="userId">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectUserListByRegionIds" resultMap="BaseMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from user_region_mapping_${enterpriseId}
|
||||
<if test="regionIds !=null and regionIds.size >0">
|
||||
where region_id in
|
||||
<foreach collection="regionIds" open="(" close=")" separator="," item="regionId">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectUserCountByRegionIds" resultType="integer">
|
||||
select
|
||||
count(1) as userNum
|
||||
from user_region_mapping_${enterpriseId}
|
||||
<if test="regionIds !=null and regionIds.size >0">
|
||||
where region_id in
|
||||
<foreach collection="regionIds" open="(" close=")" separator="," item="regionId">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getRegionUserCount" resultType="java.util.HashMap">
|
||||
select region_id as regionId , count(*) as userCount
|
||||
from user_region_mapping_${enterpriseId}
|
||||
<if test="regionIds !=null and regionIds.size >0">
|
||||
where region_id in
|
||||
<foreach collection="regionIds" open="(" close=")" separator="," item="regionId">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
group by regionId;
|
||||
</select>
|
||||
|
||||
<select id="listByUserIdsAndRegionIds" resultType="com.cool.store.entity.UserRegionMappingDO">
|
||||
select
|
||||
user_id as userId,
|
||||
region_id as regionId
|
||||
from
|
||||
user_region_mapping_${enterpriseId}
|
||||
where 1= 1
|
||||
<if test="userIds !=null and userIds.size >0">
|
||||
and user_id in
|
||||
<foreach collection="userIds" open="(" close=")" separator="," item="userId">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="regionIds !=null and regionIds.size >0">
|
||||
and region_id in
|
||||
<foreach collection="regionIds" open="(" close=")" separator="," item="regionId">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getRegionIdsByUserIds" resultMap="BaseMap">
|
||||
select
|
||||
id, user_id, region_id
|
||||
from
|
||||
user_region_mapping_${enterpriseId}
|
||||
where
|
||||
user_id in
|
||||
<foreach collection="userIds" open="(" close=")" separator="," item="userId">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getUserIdsByRegionIds" resultType="string">
|
||||
select
|
||||
distinct(user_id)
|
||||
from
|
||||
user_region_mapping_${enterpriseId}
|
||||
where
|
||||
region_id in
|
||||
<foreach collection="regionIds" open="(" close=")" separator="," item="regionId">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user