小程序和基础saas功能
This commit is contained in:
@@ -0,0 +1,116 @@
|
|||||||
|
package com.cool.store.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public enum Role {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员
|
||||||
|
*/
|
||||||
|
MASTER("20000000", "管理员", 1,"master"),
|
||||||
|
/**
|
||||||
|
* 子管理员
|
||||||
|
*/
|
||||||
|
SUB_MASTER("80000000", "子管理员", 2,"sub_master"),
|
||||||
|
/**
|
||||||
|
* 普通员工
|
||||||
|
*/
|
||||||
|
EMPLOYEE("30000000", "未分配", 99999999,"employee"),
|
||||||
|
/**
|
||||||
|
* 部门负责人
|
||||||
|
*/
|
||||||
|
DEPT_LEADER("40000000", "部门负责人", 10,"dept_leader"),
|
||||||
|
/**
|
||||||
|
* 店长
|
||||||
|
*/
|
||||||
|
SHOPOWNER("50000000", "店长", 3,"shopowner"),
|
||||||
|
/**
|
||||||
|
* 运营
|
||||||
|
*/
|
||||||
|
OPERATOR("60000000", "运营", 4,"operator"),
|
||||||
|
/**
|
||||||
|
* 店员
|
||||||
|
*/
|
||||||
|
CLERK("70000000", "店员", 5,"clerk"),
|
||||||
|
|
||||||
|
MYSTERIOUS_GUEST("90000000", "神秘访客", 6,"mysterious_guest");
|
||||||
|
|
||||||
|
|
||||||
|
private static final Map<String, Role> MAP = Arrays.stream(values()).collect(
|
||||||
|
Collectors.toMap(Role::getRoleEnum, Function.identity()));
|
||||||
|
|
||||||
|
private static final Map<String, Role> ROLE_ID_MAP = Arrays.stream(values()).collect(
|
||||||
|
Collectors.toMap(Role::getId, Function.identity()));
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String name;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private Integer priority;
|
||||||
|
|
||||||
|
private String roleEnum;
|
||||||
|
|
||||||
|
|
||||||
|
Role(String id, String name, Integer priority, String roleEnum) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.priority = priority;
|
||||||
|
this.roleEnum=roleEnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleEnum() {
|
||||||
|
return roleEnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Role getByCode(String code) {
|
||||||
|
return MAP.get(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是管理员 及 子管理员
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isAdmin(String code){
|
||||||
|
if(MASTER.getRoleEnum().equals(code) || SUB_MASTER.getRoleEnum().equals(code)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id 判断 是否是管理员 及 子管理员
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isAdminById(String id){
|
||||||
|
if(MASTER.getId().equals(id) || SUB_MASTER.getId().equals(id)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否包含角色id
|
||||||
|
* @param roleId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isContainsRoleId(String roleId){
|
||||||
|
return ROLE_ID_MAP.containsKey(roleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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>
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package com.cool.store.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName RegionNode
|
||||||
|
* @Description 用一句话描述什么
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RegionNode {
|
||||||
|
/**
|
||||||
|
* 自增ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域ID
|
||||||
|
*/
|
||||||
|
private String regionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 父ID
|
||||||
|
*/
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
|
private String parentName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组ID
|
||||||
|
*/
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Long createTime;
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createName;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Long updateTime;
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子节点
|
||||||
|
*/
|
||||||
|
private List<RegionNode> children;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否有区域权限
|
||||||
|
*/
|
||||||
|
private Boolean isAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店数量
|
||||||
|
*/
|
||||||
|
private Long storeCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dinging部门id
|
||||||
|
*/
|
||||||
|
private String synDingDeptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* root path store
|
||||||
|
*/
|
||||||
|
private String regionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路径
|
||||||
|
*/
|
||||||
|
private String regionPath;
|
||||||
|
|
||||||
|
private String fullRegionPath;
|
||||||
|
|
||||||
|
public String getFullRegionPath() {
|
||||||
|
if(id != null && id == 1L){
|
||||||
|
return "/1/";
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(regionPath)) {
|
||||||
|
return regionPath + id + "/";
|
||||||
|
} else {
|
||||||
|
return "/" + id + "/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.cool.store.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe:
|
||||||
|
*
|
||||||
|
* @author zhouyiping
|
||||||
|
* @date 2020/11/06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserRoleDTO {
|
||||||
|
private String userId;
|
||||||
|
private String roleName;
|
||||||
|
private String roleAuth;
|
||||||
|
private Long roleId;
|
||||||
|
private Integer priority;
|
||||||
|
|
||||||
|
private String roleEnum;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.cool.store.dto.response;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rpc统一返回实体类
|
||||||
|
*
|
||||||
|
* @author byd
|
||||||
|
*/
|
||||||
|
public class ResultDTO<T extends Object> implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -2217360460304088285L;
|
||||||
|
|
||||||
|
private boolean success = true;
|
||||||
|
/**
|
||||||
|
* 返回码
|
||||||
|
*/
|
||||||
|
private int code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回信息
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回数据
|
||||||
|
*/
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccess(boolean success) {
|
||||||
|
this.success = success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(T data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultDTO() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultDTO(T data) {
|
||||||
|
super();
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultDTO(int code, String message, T data) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultDTO(int code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResultDTO successResult() {
|
||||||
|
return new ResultDTO(200000, "请求成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResultDTO successResult(Object data) {
|
||||||
|
return new ResultDTO(200000, "请求成功", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResultDTO failResult(String msg) {
|
||||||
|
return new ResultDTO(400000, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResultDTO failResult(int code, String msg) {
|
||||||
|
return new ResultDTO(code, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.cool.store.dto.wx;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: CodeSessionDTO
|
||||||
|
* @Description:
|
||||||
|
* @date 2023-05-29 14:28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CodeSessionDTO extends WXBaseResultDTO{
|
||||||
|
|
||||||
|
@JSONField(name = "session_key")
|
||||||
|
private String sessionKey;
|
||||||
|
|
||||||
|
@JSONField(name = "openid")
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
@JSONField(name = "unionid")
|
||||||
|
private String unionId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.cool.store.dto.wx;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: young.yu
|
||||||
|
* @Date: 2023-09-12 14:48
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MiniAppUrlLinkDTO extends WXBaseResultDTO{
|
||||||
|
@JSONField(name = "url_link")
|
||||||
|
private String urlLink;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.cool.store.dto.wx;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:
|
||||||
|
* @Date: 2023-09-12 14:48
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MiniAppUrlLinkReqDTO {
|
||||||
|
private String path;
|
||||||
|
private String query;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.cool.store.dto.wx;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: MiniProgramLoginDTO
|
||||||
|
* @Description:
|
||||||
|
* @date 2023-05-29 14:28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MiniProgramLoginDTO {
|
||||||
|
|
||||||
|
@NotBlank(message = "jsCode不能为空")
|
||||||
|
private String jsCode;
|
||||||
|
|
||||||
|
@NotBlank(message = "手机号code不能为空")
|
||||||
|
private String mobileCode;
|
||||||
|
|
||||||
|
@NotBlank(message = "用户encryptedData不能为空")
|
||||||
|
private String encryptedData;
|
||||||
|
|
||||||
|
@NotBlank(message = "ivStr不能为空")
|
||||||
|
private String ivStr;
|
||||||
|
|
||||||
|
private String userChannelEnum;
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.cool.store.dto.wx;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wxp
|
||||||
|
* @FileName: PhoneInfoDTO
|
||||||
|
* @Description:
|
||||||
|
* @date 2023-06-14 14:28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PhoneInfoDTO extends WXBaseResultDTO{
|
||||||
|
|
||||||
|
@JSONField(name = "phone_info")
|
||||||
|
private PhoneInfo phoneInfo;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class PhoneInfo{
|
||||||
|
/**
|
||||||
|
* 用户绑定的手机号(国外手机号会有区号)
|
||||||
|
*/
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 没有区号的手机号
|
||||||
|
*/
|
||||||
|
private String purePhoneNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区号
|
||||||
|
*/
|
||||||
|
private String countryCode;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.cool.store.dto.wx;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: WXBaseResultDTO
|
||||||
|
* @Description:
|
||||||
|
* @date 2023-05-29 14:52
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class WXBaseResultDTO {
|
||||||
|
|
||||||
|
private static final String SUCCESS_CODE = "0";
|
||||||
|
|
||||||
|
@JSONField(name = "errcode")
|
||||||
|
private String errCode;
|
||||||
|
|
||||||
|
@JSONField(name = "errmsg")
|
||||||
|
private String errMsg;
|
||||||
|
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return this.errCode == null || this.errCode.isEmpty() || this.errCode.equals("0");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package com.cool.store.entity;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @date 2023-06-06 02:29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EnterpriseUserDO implements Serializable {
|
||||||
|
@ApiModelProperty("用户主键id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty("手机号码")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@ApiModelProperty("员工的电子邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@ApiModelProperty("员工的企业邮箱")
|
||||||
|
private String orgEmail;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否是主管理员,0:否,1:是")
|
||||||
|
private Boolean mainAdmin;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否为企业的管理员, true表示是, false表示不是")
|
||||||
|
private Boolean isAdmin;
|
||||||
|
|
||||||
|
@ApiModelProperty("在当前isv全局范围内唯一标识一个用户的身份,用户无法修改")
|
||||||
|
private String unionid;
|
||||||
|
|
||||||
|
@ApiModelProperty("头像url")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
@ApiModelProperty("工号")
|
||||||
|
private String jobnumber;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否是部门的主管, true表示是, false表示不是")
|
||||||
|
private Boolean isLeader;
|
||||||
|
|
||||||
|
private String isLeaderInDepts;
|
||||||
|
|
||||||
|
@ApiModelProperty("人脸照片url")
|
||||||
|
private String faceUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户状态 0待审核 1正常 2冻结")
|
||||||
|
private Integer userStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("部门集合(region_ids)")
|
||||||
|
private String userRegionIds;
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.cool.store.entity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName EnterpriseUserRole
|
||||||
|
* @Description 用一句话描述什么
|
||||||
|
* @author 首亮
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EnterpriseUserRole {
|
||||||
|
private Long id;
|
||||||
|
private String roleId;
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
//创建时间
|
||||||
|
private Date createTime;
|
||||||
|
//更新时间
|
||||||
|
public EnterpriseUserRole(String roleId, String userId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
this.userId = userId;
|
||||||
|
this.createTime = new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
public static List<EnterpriseUserRole> convertList(List<Long> roleIds, String userId){
|
||||||
|
List<EnterpriseUserRole> resultList = new ArrayList<>();
|
||||||
|
for (Long roleId : roleIds) {
|
||||||
|
resultList.add(new EnterpriseUserRole(String.valueOf(roleId), userId));
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
package com.cool.store.entity;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @date 2023-05-29 03:53
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class HyPartnerUserInfoDO implements Serializable {
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("hy_partner_user_info.partner_id")
|
||||||
|
private String partnerId;
|
||||||
|
|
||||||
|
@ApiModelProperty("手机号")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@ApiModelProperty("申请人姓名")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@ApiModelProperty("常驻区域")
|
||||||
|
private String liveArea;
|
||||||
|
|
||||||
|
@ApiModelProperty("意向开店区域")
|
||||||
|
private String wantShopArea;
|
||||||
|
|
||||||
|
@ApiModelProperty("0不接受调剂、1全国调剂、2省内调剂、3市内调剂")
|
||||||
|
private Integer acceptAdjustType;
|
||||||
|
|
||||||
|
@ApiModelProperty("邀请码")
|
||||||
|
private String inviteCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否填写加盟需知")
|
||||||
|
private Integer isWritePartnerKnow;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("店铺编码")
|
||||||
|
private String shopCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("店铺名称")
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
@ApiModelProperty("店铺ID")
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
@ApiModelProperty("推荐加盟商id")
|
||||||
|
private String recommendPartnerId;
|
||||||
|
|
||||||
|
@ApiModelProperty("推荐加盟商姓名")
|
||||||
|
private String recommendPartnerName;
|
||||||
|
|
||||||
|
@ApiModelProperty("推荐加盟商手机号")
|
||||||
|
private String recommendPartnerMobile;
|
||||||
|
|
||||||
|
@ApiModelProperty("hy_partner_user_channel.channel_id")
|
||||||
|
private Integer userChannelId;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty("ec意向区域")
|
||||||
|
private String ecWantShopArea;
|
||||||
|
|
||||||
|
@ApiModelProperty("ec创建时间")
|
||||||
|
private Date crmCreateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("微信openid")
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
package com.cool.store.entity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName RegionDO
|
||||||
|
* @Description 区域
|
||||||
|
*/
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RegionDO {
|
||||||
|
/**
|
||||||
|
* 自增ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域ID
|
||||||
|
*/
|
||||||
|
private String regionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 父ID
|
||||||
|
*/
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父ID
|
||||||
|
*/
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Long createTime;
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createName;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Long updateTime;
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dinging部门id
|
||||||
|
*/
|
||||||
|
private String synDingDeptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除标记
|
||||||
|
*/
|
||||||
|
private Boolean deleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* root path store
|
||||||
|
*/
|
||||||
|
private String regionType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域路径
|
||||||
|
*/
|
||||||
|
private String regionPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域门店数量
|
||||||
|
*/
|
||||||
|
private Integer storeNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域门店范围是否 非DO 同步时用到的
|
||||||
|
*/
|
||||||
|
private Boolean storeRange = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店地址 非DO
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店经度 非DO
|
||||||
|
*/
|
||||||
|
private String longitude;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 纬度 非DO
|
||||||
|
*/
|
||||||
|
private String latitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店编号 非DO
|
||||||
|
*/
|
||||||
|
private String storeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店开业日期 非DO
|
||||||
|
*/
|
||||||
|
private String openDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店ID
|
||||||
|
*/
|
||||||
|
private String storeId;
|
||||||
|
|
||||||
|
public String fullRegionPath;
|
||||||
|
|
||||||
|
private Integer orderNum;
|
||||||
|
|
||||||
|
private Integer unclassifiedFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通讯录code 非DO
|
||||||
|
*/
|
||||||
|
private String contactCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店扩展信息
|
||||||
|
*/
|
||||||
|
private String extendField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方唯一id
|
||||||
|
*/
|
||||||
|
private String thirdDeptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店状态
|
||||||
|
*/
|
||||||
|
private String storeStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是外部组织节点
|
||||||
|
*/
|
||||||
|
private Boolean isExternalNode;
|
||||||
|
|
||||||
|
public RegionDO(Long id, String name, String parentId, String groupId, Long createTime, String createName) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.parentId = parentId;
|
||||||
|
this.groupId = groupId;
|
||||||
|
this.createTime = createTime;
|
||||||
|
this.createName = createName;
|
||||||
|
}
|
||||||
|
public String getFullRegionPath() {
|
||||||
|
if(id != null && id == 1L){
|
||||||
|
return "/1/";
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(regionPath)) {
|
||||||
|
return regionPath + id + "/";
|
||||||
|
} else {
|
||||||
|
return "/" + id + "/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
package com.cool.store.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单表
|
||||||
|
*
|
||||||
|
* @author shoul
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysMenuDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 父级ID
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
/**
|
||||||
|
* 菜单编号
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
/**
|
||||||
|
* 菜单名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 菜单别名
|
||||||
|
*/
|
||||||
|
private String alias;
|
||||||
|
/**
|
||||||
|
* 请求地址(前端路由)
|
||||||
|
*/
|
||||||
|
private String path;
|
||||||
|
/**
|
||||||
|
* 后端权限标识
|
||||||
|
*/
|
||||||
|
private String perms;
|
||||||
|
/**
|
||||||
|
* 菜单资源(图片)
|
||||||
|
*/
|
||||||
|
private String source;
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
/**
|
||||||
|
* 菜单类型(菜单,按钮)
|
||||||
|
*/
|
||||||
|
private Integer category;
|
||||||
|
/**
|
||||||
|
* 操作按钮类型(工具栏,操作栏,工具操作栏)
|
||||||
|
*/
|
||||||
|
private Integer action;
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 所属项目(PC,小程序)
|
||||||
|
*/
|
||||||
|
private String platform;
|
||||||
|
/**
|
||||||
|
* 是否已删除
|
||||||
|
*/
|
||||||
|
private Integer isDeleted;
|
||||||
|
/**
|
||||||
|
* 操作类型
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 是否新开页面
|
||||||
|
*/
|
||||||
|
private String target;
|
||||||
|
/**
|
||||||
|
* 组件
|
||||||
|
*/
|
||||||
|
private String component;
|
||||||
|
/**
|
||||||
|
* 图标
|
||||||
|
*/
|
||||||
|
private String icon;
|
||||||
|
/**
|
||||||
|
* 是否选中
|
||||||
|
*/
|
||||||
|
private Boolean isChecked;
|
||||||
|
|
||||||
|
private Integer menuType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单环境
|
||||||
|
*/
|
||||||
|
private String env;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 常用功能图标
|
||||||
|
*/
|
||||||
|
private String commonFunctionsIcon;
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package com.cool.store.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色表
|
||||||
|
*
|
||||||
|
* @author shoul
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SysRoleDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色名称
|
||||||
|
*/
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否预制
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
private Integer isInternal;
|
||||||
|
|
||||||
|
private String appMenu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位来源:(create:自建岗位, sync:从钉钉同步的角色, sync_position:钉钉同步的职位)
|
||||||
|
*/
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
private String roleAuth;
|
||||||
|
|
||||||
|
private String positionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钉钉角色id
|
||||||
|
*/
|
||||||
|
private Long synDingRoleId;
|
||||||
|
/**
|
||||||
|
* 角色排序
|
||||||
|
*/
|
||||||
|
private Integer priority;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色枚举用于判定逻辑
|
||||||
|
*/
|
||||||
|
private String roleEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
private String thirdUniqueId;
|
||||||
|
|
||||||
|
|
||||||
|
public SysRoleDO(Long id, String roleName, Integer isInternal, String source, String positionType) {
|
||||||
|
this.id = id;
|
||||||
|
this.roleName = roleName;
|
||||||
|
this.isInternal = isInternal;
|
||||||
|
this.source = source;
|
||||||
|
this.positionType = positionType;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.cool.store.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe:
|
||||||
|
*
|
||||||
|
* @author zhouyiping
|
||||||
|
* @date 2020/09/23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysRoleMenuDO {
|
||||||
|
private Long id;
|
||||||
|
private Long menuId;
|
||||||
|
private Long roleId;
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
public SysRoleMenuDO() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public SysRoleMenuDO(Long menuId, Long roleId, String platform) {
|
||||||
|
this.menuId = menuId;
|
||||||
|
this.roleId = roleId;
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package com.cool.store.entity;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2022/2/24 15:37
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserRegionMappingDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 映射主键 区域id
|
||||||
|
*/
|
||||||
|
private String regionId;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private String createId;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Long createTime;
|
||||||
|
/**
|
||||||
|
* 更新人id
|
||||||
|
*/
|
||||||
|
private String updateId;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Long updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
public static List<UserRegionMappingDO> convertList(String userId, List<String> regionIds, String operator){
|
||||||
|
if(CollectionUtils.isEmpty(regionIds)){
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
List<UserRegionMappingDO> userRegionList = new ArrayList<>();
|
||||||
|
for (String regionId : regionIds) {
|
||||||
|
UserRegionMappingDO result = new UserRegionMappingDO();
|
||||||
|
result.setUserId(userId);
|
||||||
|
result.setRegionId(regionId);
|
||||||
|
result.setCreateId(operator);
|
||||||
|
result.setUpdateId(operator);
|
||||||
|
result.setCreateTime(System.currentTimeMillis());
|
||||||
|
result.setUpdateTime(System.currentTimeMillis());
|
||||||
|
userRegionList.add(result);
|
||||||
|
}
|
||||||
|
return userRegionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UserRegionMappingDO convertDO(String userId, String regionId, String operator){
|
||||||
|
UserRegionMappingDO result = new UserRegionMappingDO();
|
||||||
|
result.setUserId(userId);
|
||||||
|
result.setRegionId(regionId);
|
||||||
|
result.setCreateId(operator);
|
||||||
|
result.setUpdateId(operator);
|
||||||
|
result.setCreateTime(System.currentTimeMillis());
|
||||||
|
result.setUpdateTime(System.currentTimeMillis());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.cool.store.request;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author wxp
|
||||||
|
* @Date 2023/5/31 11:01
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel
|
||||||
|
public class MobileUpdateRequest {
|
||||||
|
|
||||||
|
@NotBlank(message = "手机号code不能为空")
|
||||||
|
@ApiModelProperty("手机号code")
|
||||||
|
private String mobileCode;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.cool.store.vo;
|
||||||
|
|
||||||
|
import com.cool.store.entity.EnterpriseUserDO;
|
||||||
|
import com.cool.store.entity.SysMenuDO;
|
||||||
|
import com.cool.store.entity.SysRoleDO;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysRoleVO extends SysRoleDO {
|
||||||
|
/**
|
||||||
|
* 角色相关的人数
|
||||||
|
*/
|
||||||
|
private Long personNums;
|
||||||
|
/**
|
||||||
|
* 用户
|
||||||
|
*/
|
||||||
|
private List<EnterpriseUserDO> enterpriseDOs;
|
||||||
|
/**
|
||||||
|
* 角色下拥有的权限
|
||||||
|
*/
|
||||||
|
private List<SysMenuDO> sysMenuDOs;
|
||||||
|
/**
|
||||||
|
* 角色是否可删除
|
||||||
|
*/
|
||||||
|
private Boolean delete=true;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package com.cool.store.http;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cool.store.dto.wx.CodeSessionDTO;
|
||||||
|
import com.cool.store.dto.wx.MiniAppUrlLinkDTO;
|
||||||
|
import com.cool.store.dto.wx.MiniAppUrlLinkReqDTO;
|
||||||
|
import com.cool.store.dto.wx.PhoneInfoDTO;
|
||||||
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
|
import com.cool.store.exception.ServiceException;
|
||||||
|
import com.cool.store.mq.util.HttpRestTemplateService;
|
||||||
|
import com.cool.store.utils.RedisUtilPool;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: WechatRest
|
||||||
|
* @Description:微信api
|
||||||
|
* @date 2023-05-29 14:49
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class WechatRest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisUtilPool redisUtilPool;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private HttpRestTemplateService httpRestTemplateService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序Token 地址
|
||||||
|
*/
|
||||||
|
String ACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
|
||||||
|
/**
|
||||||
|
* 获取手机号码 地址
|
||||||
|
*/
|
||||||
|
String GET_USERPHONENUMBER = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=%s";
|
||||||
|
|
||||||
|
String GET_MINIAPP_URL_LINK = "https://api.weixin.qq.com/wxa/generate_urllink?access_token=%s";
|
||||||
|
|
||||||
|
|
||||||
|
public CodeSessionDTO miniProgramJsCodeSession(String appId, String secret, String jsCode){
|
||||||
|
log.info("WechatRest#miniProgramJsCodeSession, jsCode:{}", jsCode);
|
||||||
|
String url = "https://api.weixin.qq.com/sns/jscode2session";
|
||||||
|
HashMap requestMap = new HashMap();
|
||||||
|
requestMap.put("appid", appId);
|
||||||
|
requestMap.put("secret", secret);
|
||||||
|
requestMap.put("js_code", jsCode);
|
||||||
|
requestMap.put("grant_type","authorization_code");
|
||||||
|
try {
|
||||||
|
String responseStr = httpRestTemplateService.getForObject(url, String.class ,requestMap);
|
||||||
|
log.info("WechatRest#miniProgramJsCodeSession, url:{}, response:{}", url, responseStr);
|
||||||
|
if(StringUtils.isNotBlank(responseStr)){
|
||||||
|
return JSONObject.parseObject(responseStr, CodeSessionDTO.class);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("调用微信服务异常{}", e);
|
||||||
|
throw new ServiceException(ErrorCodeEnum.WX_SERVICE_ERROR);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccessToken(String appId, String secret) {
|
||||||
|
String cacheAccessToken = "wechat_mini_" + appId;
|
||||||
|
String accessToken = redisUtilPool.getString(cacheAccessToken);
|
||||||
|
if (StringUtils.isNotBlank(accessToken)) {
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
String reqUrl = String.format(ACCESS_TOKEN, appId, secret);
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = httpRestTemplateService.getForObject(reqUrl, JSONObject.class, new HashMap());
|
||||||
|
log.info("WechatRest#getAccessToken, reqUrl:{}, response:{}", reqUrl, JSONObject.toJSONString(jsonObject));
|
||||||
|
String token = jsonObject.getString("access_token");
|
||||||
|
if (StringUtils.isBlank(token)) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.GET_ACCESSTOKEN_ERROR);
|
||||||
|
}
|
||||||
|
redisUtilPool.setString(cacheAccessToken, token, 7000);
|
||||||
|
return token;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取微信小程序token异常", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public PhoneInfoDTO getUserPhoneNumber(String code, String accessToken){
|
||||||
|
String reqUrl = String.format(GET_USERPHONENUMBER, accessToken);
|
||||||
|
HashMap requestMap = new HashMap();
|
||||||
|
requestMap.put("code", code);
|
||||||
|
String responseStr = null;
|
||||||
|
try {
|
||||||
|
responseStr = httpRestTemplateService.postForObject(reqUrl, requestMap, String.class);
|
||||||
|
log.info("WechatRest#getUserPhoneNumber, reqUrl:{}, response:{}", reqUrl, responseStr);
|
||||||
|
if(StringUtils.isNotBlank(responseStr)){
|
||||||
|
return JSONObject.parseObject(responseStr, PhoneInfoDTO.class);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取手机号异常", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MiniAppUrlLinkDTO getMiniAppUrlLink(String accessToken, MiniAppUrlLinkReqDTO miniAppUrlLinkReqDTO){
|
||||||
|
String reqUrl = String.format(GET_MINIAPP_URL_LINK, accessToken);
|
||||||
|
String responseStr = null;
|
||||||
|
try {
|
||||||
|
responseStr = httpRestTemplateService.postForObject(reqUrl, miniAppUrlLinkReqDTO, String.class);
|
||||||
|
log.info("WechatRest#getUserPhoneNumber, reqUrl:{}, response:{}", reqUrl, responseStr);
|
||||||
|
if(StringUtils.isNotBlank(responseStr)){
|
||||||
|
return JSONObject.parseObject(responseStr, MiniAppUrlLinkDTO.class);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取手机号异常", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.cool.store.service;
|
package com.cool.store.service;
|
||||||
|
|
||||||
|
import com.cool.store.dto.wx.MiniAppUrlLinkReqDTO;
|
||||||
|
import com.cool.store.dto.wx.MiniProgramLoginDTO;
|
||||||
|
import com.cool.store.request.MobileUpdateRequest;
|
||||||
import com.cool.store.vo.PartnerUserInfoVO;
|
import com.cool.store.vo.PartnerUserInfoVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -10,15 +13,15 @@ import com.cool.store.vo.PartnerUserInfoVO;
|
|||||||
*/
|
*/
|
||||||
public interface WechatMiniAppService {
|
public interface WechatMiniAppService {
|
||||||
|
|
||||||
// PartnerUserInfoVO miniProgramLogin(MiniProgramLoginDTO param);
|
PartnerUserInfoVO miniProgramLogin(MiniProgramLoginDTO param);
|
||||||
//
|
|
||||||
// String getUserPhoneNumber(String mobileCode);
|
String getUserPhoneNumber(String mobileCode);
|
||||||
//
|
|
||||||
// String updateUserPhoneNumber(MobileUpdateRequest request, PartnerUserInfoVO userInfoVO);
|
String updateUserPhoneNumber(MobileUpdateRequest request, PartnerUserInfoVO userInfoVO);
|
||||||
//
|
|
||||||
PartnerUserInfoVO getUserInfo(String mobile, String openId);
|
PartnerUserInfoVO getUserInfo(String mobile, String openId);
|
||||||
//
|
|
||||||
// String getMiniAppUrl();
|
String getMiniAppUrl();
|
||||||
//
|
|
||||||
// String getMiniAppUrlLink(MiniAppUrlLinkReqDTO miniAppUrlLinkReqDTO);
|
String getMiniAppUrlLink(MiniAppUrlLinkReqDTO miniAppUrlLinkReqDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,26 +4,24 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.dao.*;
|
import com.cool.store.dao.*;
|
||||||
|
import com.cool.store.dto.wx.*;
|
||||||
import com.cool.store.entity.*;
|
import com.cool.store.entity.*;
|
||||||
import com.cool.store.enums.ErrorCodeEnum;
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
import com.cool.store.enums.UserChannelEnum;
|
import com.cool.store.enums.UserChannelEnum;
|
||||||
import com.cool.store.enums.UserPlatformTypeEnum;
|
|
||||||
import com.cool.store.exception.ServiceException;
|
import com.cool.store.exception.ServiceException;
|
||||||
|
import com.cool.store.http.WechatRest;
|
||||||
|
import com.cool.store.request.MobileUpdateRequest;
|
||||||
import com.cool.store.service.WechatMiniAppService;
|
import com.cool.store.service.WechatMiniAppService;
|
||||||
import com.cool.store.utils.AesUtil;
|
|
||||||
import com.cool.store.utils.RedisUtilPool;
|
import com.cool.store.utils.RedisUtilPool;
|
||||||
import com.cool.store.utils.UUIDUtils;
|
import com.cool.store.utils.UUIDUtils;
|
||||||
import com.cool.store.vo.PartnerUserInfoVO;
|
import com.cool.store.vo.PartnerUserInfoVO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangchenbiao
|
* @author zhangchenbiao
|
||||||
@@ -35,26 +33,14 @@ import java.util.Objects;
|
|||||||
@Service
|
@Service
|
||||||
public class WechatMiniAppServiceImpl implements WechatMiniAppService {
|
public class WechatMiniAppServiceImpl implements WechatMiniAppService {
|
||||||
|
|
||||||
// @Resource
|
@Resource
|
||||||
// private RedisUtilPool redisUtilPool;
|
private RedisUtilPool redisUtilPool;
|
||||||
// @Resource
|
@Resource
|
||||||
// private WechatRest wechatRest;
|
private WechatRest wechatRest;
|
||||||
// @Resource
|
@Resource
|
||||||
// private HyPartnerUserInfoDAO hyPartnerUserInfoDAO;
|
private HyPartnerUserInfoDAO hyPartnerUserInfoDAO;
|
||||||
// @Resource
|
@Resource
|
||||||
// private HyPartnerUserPlatformBindDAO hyPartnerUserPlatformBindDAO;
|
HyOpenAreaInfoDAO hyOpenAreaInfoDAO;
|
||||||
// @Resource
|
|
||||||
// private HyPartnerLineInfoDAO hyPartnerLineInfoDAO;
|
|
||||||
// @Resource
|
|
||||||
// HyOpenAreaInfoDAO hyOpenAreaInfoDAO;
|
|
||||||
// @Resource
|
|
||||||
// HyPartnerBaseInfoDAO hyPartnerBaseInfoDAO;
|
|
||||||
// @Resource
|
|
||||||
// HyPhoneLocationService hyPhoneLocationService;
|
|
||||||
//
|
|
||||||
// @Autowired
|
|
||||||
// private HyPartnerUserChannelMapper hyPartnerUserChannelMapper;
|
|
||||||
//
|
|
||||||
@Value("${weixin.appId}")
|
@Value("${weixin.appId}")
|
||||||
private String wxAppId;
|
private String wxAppId;
|
||||||
@Value("${weixin.appSecret}")
|
@Value("${weixin.appSecret}")
|
||||||
@@ -65,143 +51,119 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
|
|||||||
private Integer exhibition;
|
private Integer exhibition;
|
||||||
@Value("${recommended.channel.id}")
|
@Value("${recommended.channel.id}")
|
||||||
private Integer recommended;
|
private Integer recommended;
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public PartnerUserInfoVO miniProgramLogin(MiniProgramLoginDTO param) {
|
public PartnerUserInfoVO miniProgramLogin(MiniProgramLoginDTO param) {
|
||||||
// log.info("miniProgramLogin #param {}", JSONObject.toJSONString(param));
|
log.info("miniProgramLogin #param {}", JSONObject.toJSONString(param));
|
||||||
// PartnerUserInfoVO userInfoVO = new PartnerUserInfoVO();
|
PartnerUserInfoVO userInfoVO = new PartnerUserInfoVO();
|
||||||
// String jsCode = param.getJsCode();
|
String jsCode = param.getJsCode();
|
||||||
// String lockKey = "codeSession:" + wxAppId + CommonConstants.MOSAICS + jsCode;
|
String lockKey = "codeSession:" + wxAppId + CommonConstants.MOSAICS + jsCode;
|
||||||
// boolean lock = redisUtilPool.lock(lockKey);
|
boolean lock = redisUtilPool.lock(lockKey);
|
||||||
// if (!lock) {
|
if (!lock) {
|
||||||
// throw new ServiceException(ErrorCodeEnum.OPERATION_OVER_TIME);
|
throw new ServiceException(ErrorCodeEnum.OPERATION_OVER_TIME);
|
||||||
// }
|
}
|
||||||
// CodeSessionDTO codeSession = wechatRest.miniProgramJsCodeSession(wxAppId, wxAppSecret, jsCode);
|
CodeSessionDTO codeSession = wechatRest.miniProgramJsCodeSession(wxAppId, wxAppSecret, jsCode);
|
||||||
// String openid = codeSession.getOpenid();
|
String openid = codeSession.getOpenid();
|
||||||
// String sessionCacheKey = MessageFormat.format(CommonConstants.MINI_PROGRAM_SESSION_KEY, wxAppId, openid);
|
String sessionCacheKey = MessageFormat.format(CommonConstants.MINI_PROGRAM_SESSION_KEY, wxAppId, openid);
|
||||||
// redisUtilPool.setString(sessionCacheKey, codeSession.getSessionKey(), CommonConstants.THREE_DAY_SECONDS);
|
redisUtilPool.setString(sessionCacheKey, codeSession.getSessionKey(), CommonConstants.THREE_DAY_SECONDS);
|
||||||
// String unionId = codeSession.getUnionId();
|
String unionId = codeSession.getUnionId();
|
||||||
// log.info("小程序登录:{}", unionId);
|
log.info("小程序登录:{}", unionId);
|
||||||
// log.info("sessionKey {}", codeSession.getSessionKey());
|
log.info("sessionKey {}", codeSession.getSessionKey());
|
||||||
// /* String decryptUser = AesUtil.decryptWechat(codeSession.getSessionKey(), param.getEncryptedData(), param.getIvStr());
|
/* String decryptUser = AesUtil.decryptWechat(codeSession.getSessionKey(), param.getEncryptedData(), param.getIvStr());
|
||||||
// log.info("解密用户信息:{}", decryptUser);
|
log.info("解密用户信息:{}", decryptUser);
|
||||||
// MiniProgramUserVO miniProgramUser = JSON.parseObject(decryptUser, MiniProgramUserVO.class);
|
MiniProgramUserVO miniProgramUser = JSON.parseObject(decryptUser, MiniProgramUserVO.class);
|
||||||
// if (Objects.isNull(miniProgramUser)) {
|
if (Objects.isNull(miniProgramUser)) {
|
||||||
// throw new ServiceException(ErrorCodeEnum.GET_WECHAT_USER_INFO_FAIL);
|
throw new ServiceException(ErrorCodeEnum.GET_WECHAT_USER_INFO_FAIL);
|
||||||
// }*/
|
}*/
|
||||||
// // 获取小程序token
|
// 获取小程序token
|
||||||
// String accessToken = wechatRest.getAccessToken(wxAppId, wxAppSecret);
|
String accessToken = wechatRest.getAccessToken(wxAppId, wxAppSecret);
|
||||||
// // 获取手机号码
|
// 获取手机号码
|
||||||
// PhoneInfoDTO phoneInfoDTO = wechatRest.getUserPhoneNumber(param.getMobileCode(), accessToken);
|
PhoneInfoDTO phoneInfoDTO = wechatRest.getUserPhoneNumber(param.getMobileCode(), accessToken);
|
||||||
// if(phoneInfoDTO != null && phoneInfoDTO.getPhoneInfo() != null && StringUtils.isNotBlank(phoneInfoDTO.getPhoneInfo().getPhoneNumber())){
|
if(phoneInfoDTO != null && phoneInfoDTO.getPhoneInfo() != null && StringUtils.isNotBlank(phoneInfoDTO.getPhoneInfo().getPhoneNumber())){
|
||||||
//
|
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByOpenid(openid);
|
||||||
// HyPartnerUserPlatformBindDO hyPartnerUserPlatformBindDO = hyPartnerUserPlatformBindDAO.getByPlatformTypeAndUserId(UserPlatformTypeEnum.WECHAT.getCode(), openid);
|
if( hyPartnerUserInfoDO != null && !hyPartnerUserInfoDO.getMobile().equals(phoneInfoDTO.getPhoneInfo().getPhoneNumber())){
|
||||||
// HyPartnerUserInfoDO hyPartnerUserInfoDO = null;
|
throw new ServiceException(ErrorCodeEnum.WECHAT_BIND_OTHER_MOBILE);
|
||||||
// // 微信未授权过
|
}
|
||||||
// if(hyPartnerUserPlatformBindDO == null){
|
// 微信未授权过
|
||||||
// hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByMobile(phoneInfoDTO.getPhoneInfo().getPhoneNumber());
|
if(hyPartnerUserInfoDO == null){
|
||||||
// if(hyPartnerUserInfoDO != null){
|
hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByMobile(phoneInfoDTO.getPhoneInfo().getPhoneNumber());
|
||||||
// HyPartnerUserPlatformBindDO hy = hyPartnerUserPlatformBindDAO.getByPartnerId(hyPartnerUserInfoDO.getPartnerId());
|
if(hyPartnerUserInfoDO != null && StringUtils.isNotBlank(hyPartnerUserInfoDO.getOpenid()) && !openid.equals(hyPartnerUserInfoDO.getOpenid())){
|
||||||
// if (hy!=null){
|
throw new ServiceException(ErrorCodeEnum.MOBILE_WECHAT_EXIST);
|
||||||
// throw new ServiceException(ErrorCodeEnum.MOBILE_WECHAT_EXIST);
|
}
|
||||||
// }
|
if(hyPartnerUserInfoDO == null){
|
||||||
// }
|
hyPartnerUserInfoDO = new HyPartnerUserInfoDO();
|
||||||
// if(hyPartnerUserInfoDO == null){
|
hyPartnerUserInfoDO.setMobile(phoneInfoDTO.getPhoneInfo().getPhoneNumber());
|
||||||
// hyPartnerUserInfoDO = new HyPartnerUserInfoDO();
|
hyPartnerUserInfoDO.setOpenid(openid);
|
||||||
// hyPartnerUserInfoDO.setMobile(phoneInfoDTO.getPhoneInfo().getPhoneNumber());
|
hyPartnerUserInfoDO.setPartnerId(UUIDUtils.get32UUID());
|
||||||
// // hyPartnerUserInfoDO.setUsername(phoneInfoDTO.getPhoneInfo().getPhoneNumber());
|
hyPartnerUserInfoDO.setIsWritePartnerKnow(0);
|
||||||
// hyPartnerUserInfoDO.setPartnerId(UUIDUtils.get32UUID());
|
Integer channelId = null;
|
||||||
// hyPartnerUserInfoDO.setIsWritePartnerKnow(0);
|
String userChannel = param.getUserChannelEnum();
|
||||||
// Integer channelId = null;
|
if(StringUtils.isNotEmpty(userChannel)){
|
||||||
// String userChannel = param.getUserChannelEnum();
|
if(UserChannelEnum.EXHIBITION.getCode().equals(userChannel)){
|
||||||
// if(StringUtils.isNotEmpty(userChannel)){
|
channelId = exhibition;
|
||||||
// if(UserChannelEnum.EXHIBITION.getCode().equals(userChannel)){
|
}else if(UserChannelEnum.RECOMMENDED.getCode().equals(userChannel)){
|
||||||
// channelId = exhibition;
|
channelId = recommended;
|
||||||
// }else if(UserChannelEnum.RECOMMENDED.getCode().equals(userChannel)){
|
}else {
|
||||||
// channelId = recommended;
|
if (StringUtils.isNumeric(userChannel)) {
|
||||||
// }else {
|
channelId = Integer.valueOf(userChannel);
|
||||||
// if (StringUtils.isNumeric(userChannel)) {
|
}
|
||||||
// channelId = Integer.valueOf(userChannel);
|
}
|
||||||
// HyPartnerUserChannelDO hyPartnerUserChannelDO = hyPartnerUserChannelMapper.selectByChannelId(Long.valueOf(channelId));
|
}
|
||||||
// if (Objects.isNull(hyPartnerUserChannelDO)|| hyPartnerUserChannelDO.getChannelId() == null ) {
|
hyPartnerUserInfoDO.setUserChannelId(channelId);
|
||||||
// //用户渠道不存在
|
hyPartnerUserInfoDAO.insertSelective(hyPartnerUserInfoDO);
|
||||||
// throw new ServiceException(ErrorCodeEnum.USER_CHANNEL_NOT_EXISTS);
|
}else {
|
||||||
// }
|
hyPartnerUserInfoDO.setOpenid(openid);
|
||||||
//
|
hyPartnerUserInfoDAO.updateByPrimaryKeySelective(hyPartnerUserInfoDO);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
BeanUtil.copyProperties(hyPartnerUserInfoDO, userInfoVO);
|
||||||
// hyPartnerUserInfoDO.setUserChannelId(channelId);
|
}
|
||||||
// hyPartnerUserInfoDAO.insertSelective(hyPartnerUserInfoDO);
|
userInfoVO.setOpenid(openid);
|
||||||
// }
|
userInfoVO.setUnionId(unionId);
|
||||||
// hyPartnerUserPlatformBindDO = new HyPartnerUserPlatformBindDO();
|
return userInfoVO;
|
||||||
// hyPartnerUserPlatformBindDO.setPlatformType(UserPlatformTypeEnum.WECHAT.getCode());
|
}
|
||||||
// hyPartnerUserPlatformBindDO.setPlatformUserId(openid);
|
|
||||||
// hyPartnerUserPlatformBindDO.setBindTime(new Date());
|
|
||||||
// hyPartnerUserPlatformBindDO.setPartnerId(hyPartnerUserInfoDO.getPartnerId());
|
@Override
|
||||||
// hyPartnerUserPlatformBindDAO.insertSelective(hyPartnerUserPlatformBindDO);
|
public String getUserPhoneNumber(String mobileCode) {
|
||||||
// }else {
|
// 获取小程序token
|
||||||
// hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByPartnerId(hyPartnerUserPlatformBindDO.getPartnerId());
|
String accessToken = wechatRest.getAccessToken(wxAppId, wxAppSecret);
|
||||||
// }
|
// 获取手机号码
|
||||||
// if(!hyPartnerUserInfoDO.getMobile().equals(phoneInfoDTO.getPhoneInfo().getPhoneNumber())){
|
PhoneInfoDTO phoneInfoDTO = wechatRest.getUserPhoneNumber(mobileCode, accessToken);
|
||||||
// throw new ServiceException(ErrorCodeEnum.WECHAT_BIND_OTHER_MOBILE);
|
if(phoneInfoDTO != null && phoneInfoDTO.getPhoneInfo() != null && StringUtils.isNotBlank(phoneInfoDTO.getPhoneInfo().getPhoneNumber())){
|
||||||
// }
|
return phoneInfoDTO.getPhoneInfo().getPhoneNumber();
|
||||||
// BeanUtil.copyProperties(hyPartnerUserInfoDO, userInfoVO);
|
}
|
||||||
// HyPartnerLineInfoDO lineInfoDO = hyPartnerLineInfoDAO.getByPartnerId(hyPartnerUserInfoDO.getPartnerId());
|
return null;
|
||||||
// if (lineInfoDO != null){
|
}
|
||||||
// userInfoVO.setPartnerLineId(lineInfoDO.getId());
|
|
||||||
// userInfoVO.setLineStatus(lineInfoDO.getLineStatus());
|
@Override
|
||||||
// }
|
public String updateUserPhoneNumber(MobileUpdateRequest request, PartnerUserInfoVO userInfoVO) {
|
||||||
// }
|
String newMobile = "";
|
||||||
// userInfoVO.setOpenid(openid);
|
HyPartnerUserInfoDO oldUserInfo = hyPartnerUserInfoDAO.selectByMobile(userInfoVO.getMobile());
|
||||||
// userInfoVO.setUnionId(unionId);
|
if (oldUserInfo == null) {
|
||||||
// return userInfoVO;
|
throw new ServiceException(ErrorCodeEnum.PARTNER_USER_NOT_EXIST);
|
||||||
// }
|
}
|
||||||
//
|
// 获取小程序token
|
||||||
// public static void main(String[] args) {
|
String accessToken = wechatRest.getAccessToken(wxAppId, wxAppSecret);
|
||||||
//
|
// 获取手机号码
|
||||||
// }
|
PhoneInfoDTO phoneInfoDTO = wechatRest.getUserPhoneNumber(request.getMobileCode(), accessToken);
|
||||||
//
|
if(phoneInfoDTO != null && phoneInfoDTO.getPhoneInfo() != null && StringUtils.isNotBlank(phoneInfoDTO.getPhoneInfo().getPhoneNumber())){
|
||||||
// @Override
|
newMobile = phoneInfoDTO.getPhoneInfo().getPhoneNumber();
|
||||||
// public String getUserPhoneNumber(String mobileCode) {
|
if(newMobile.equals(oldUserInfo.getMobile())){
|
||||||
// // 获取小程序token
|
return newMobile;
|
||||||
// String accessToken = wechatRest.getAccessToken(wxAppId, wxAppSecret);
|
}
|
||||||
// // 获取手机号码
|
HyPartnerUserInfoDO newUserInfo = hyPartnerUserInfoDAO.selectByMobile(newMobile);
|
||||||
// PhoneInfoDTO phoneInfoDTO = wechatRest.getUserPhoneNumber(mobileCode, accessToken);
|
if (newUserInfo != null) {
|
||||||
// if(phoneInfoDTO != null && phoneInfoDTO.getPhoneInfo() != null && StringUtils.isNotBlank(phoneInfoDTO.getPhoneInfo().getPhoneNumber())){
|
throw new ServiceException(ErrorCodeEnum.NEW_MOBILE_HAS_EXIST);
|
||||||
// return phoneInfoDTO.getPhoneInfo().getPhoneNumber();
|
}
|
||||||
// }
|
oldUserInfo.setMobile(newMobile);
|
||||||
// return null;
|
hyPartnerUserInfoDAO.updateByPrimaryKeySelective(oldUserInfo);
|
||||||
// }
|
//修改意向申请信息中的手机号
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public String updateUserPhoneNumber(MobileUpdateRequest request, PartnerUserInfoVO userInfoVO) {
|
|
||||||
// String newMobile = "";
|
|
||||||
// HyPartnerUserInfoDO oldUserInfo = hyPartnerUserInfoDAO.selectByMobile(userInfoVO.getMobile());
|
|
||||||
// if (oldUserInfo == null) {
|
|
||||||
// throw new ServiceException(ErrorCodeEnum.PARTNER_USER_NOT_EXIST);
|
|
||||||
// }
|
|
||||||
// // 获取小程序token
|
|
||||||
// String accessToken = wechatRest.getAccessToken(wxAppId, wxAppSecret);
|
|
||||||
// // 获取手机号码
|
|
||||||
// PhoneInfoDTO phoneInfoDTO = wechatRest.getUserPhoneNumber(request.getMobileCode(), accessToken);
|
|
||||||
// if(phoneInfoDTO != null && phoneInfoDTO.getPhoneInfo() != null && StringUtils.isNotBlank(phoneInfoDTO.getPhoneInfo().getPhoneNumber())){
|
|
||||||
// newMobile = phoneInfoDTO.getPhoneInfo().getPhoneNumber();
|
|
||||||
// if(newMobile.equals(oldUserInfo.getMobile())){
|
|
||||||
// return newMobile;
|
|
||||||
// }
|
|
||||||
// HyPartnerUserInfoDO newUserInfo = hyPartnerUserInfoDAO.selectByMobile(newMobile);
|
|
||||||
// if (newUserInfo != null) {
|
|
||||||
// throw new ServiceException(ErrorCodeEnum.NEW_MOBILE_HAS_EXIST);
|
|
||||||
// }
|
|
||||||
// oldUserInfo.setMobile(newMobile);
|
|
||||||
// hyPartnerUserInfoDAO.updateByPrimaryKeySelective(oldUserInfo);
|
|
||||||
// //修改意向申请信息中的手机号
|
|
||||||
// hyPartnerBaseInfoDAO.updateByPartnerId(null, newMobile, oldUserInfo.getPartnerId());
|
// hyPartnerBaseInfoDAO.updateByPartnerId(null, newMobile, oldUserInfo.getPartnerId());
|
||||||
// }
|
}
|
||||||
// return newMobile;
|
return newMobile;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
@Override
|
@Override
|
||||||
public PartnerUserInfoVO getUserInfo(String mobile, String openId) {
|
public PartnerUserInfoVO getUserInfo(String mobile, String openId) {
|
||||||
PartnerUserInfoVO userInfoVO = new PartnerUserInfoVO();
|
PartnerUserInfoVO userInfoVO = new PartnerUserInfoVO();
|
||||||
@@ -211,37 +173,35 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
|
|||||||
userInfoVO.setPartnerId("");
|
userInfoVO.setPartnerId("");
|
||||||
return userInfoVO;
|
return userInfoVO;
|
||||||
}
|
}
|
||||||
// HyPartnerUserPlatformBindDO hyPartnerUserPlatformBindDO = hyPartnerUserPlatformBindDAO.getByPlatformTypeAndUserId(UserPlatformTypeEnum.WECHAT.getCode(), openId);
|
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByOpenid(openId);
|
||||||
// if(hyPartnerUserPlatformBindDO != null){
|
if(hyPartnerUserInfoDO != null){
|
||||||
// HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByPartnerId(hyPartnerUserPlatformBindDO.getPartnerId());
|
BeanUtil.copyProperties(hyPartnerUserInfoDO, userInfoVO);
|
||||||
// BeanUtil.copyProperties(hyPartnerUserInfoDO, userInfoVO);
|
if(StringUtils.isNotBlank(hyPartnerUserInfoDO.getWantShopArea())){
|
||||||
// userInfoVO.setOpenid(hyPartnerUserPlatformBindDO.getPlatformUserId());
|
HyOpenAreaInfoDO hyOpenAreaInfoDO = hyOpenAreaInfoDAO.selectById(Long.valueOf(hyPartnerUserInfoDO.getWantShopArea()));
|
||||||
// if(StringUtils.isNotBlank(hyPartnerUserInfoDO.getWantShopArea())){
|
userInfoVO.setWantShopAreaName(hyOpenAreaInfoDO.getAreaPath().replace("/", " ").trim());
|
||||||
// HyOpenAreaInfoDO hyOpenAreaInfoDO = hyOpenAreaInfoDAO.selectById(Long.valueOf(hyPartnerUserInfoDO.getWantShopArea()));
|
}
|
||||||
// userInfoVO.setWantShopAreaName(hyOpenAreaInfoDO.getAreaPath().replace("/", " ").trim());
|
/*HyPartnerLineInfoDO lineInfoDO = hyPartnerLineInfoDAO.getByPartnerId(hyPartnerUserInfoDO.getPartnerId());
|
||||||
// }
|
if (lineInfoDO != null){
|
||||||
// HyPartnerLineInfoDO lineInfoDO = hyPartnerLineInfoDAO.getByPartnerId(hyPartnerUserInfoDO.getPartnerId());
|
userInfoVO.setPartnerLineId(lineInfoDO.getId());
|
||||||
// if (lineInfoDO != null){
|
}*/
|
||||||
// userInfoVO.setPartnerLineId(lineInfoDO.getId());
|
}
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return userInfoVO;
|
return userInfoVO;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public String getMiniAppUrl() {
|
public String getMiniAppUrl() {
|
||||||
// MiniAppUrlLinkReqDTO miniAppUrlLinkReqDTO = new MiniAppUrlLinkReqDTO();
|
MiniAppUrlLinkReqDTO miniAppUrlLinkReqDTO = new MiniAppUrlLinkReqDTO();
|
||||||
// return getMiniAppUrlLink(miniAppUrlLinkReqDTO);
|
return getMiniAppUrlLink(miniAppUrlLinkReqDTO);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public String getMiniAppUrlLink(MiniAppUrlLinkReqDTO miniAppUrlLinkReqDTO) {
|
public String getMiniAppUrlLink(MiniAppUrlLinkReqDTO miniAppUrlLinkReqDTO) {
|
||||||
// String accessToken = wechatRest.getAccessToken(wxAppId, wxAppSecret);
|
String accessToken = wechatRest.getAccessToken(wxAppId, wxAppSecret);
|
||||||
// MiniAppUrlLinkDTO miniAppUrlLink = wechatRest.getMiniAppUrlLink(accessToken, miniAppUrlLinkReqDTO);
|
MiniAppUrlLinkDTO miniAppUrlLink = wechatRest.getMiniAppUrlLink(accessToken, miniAppUrlLinkReqDTO);
|
||||||
// if (miniAppUrlLink != null){
|
if (miniAppUrlLink != null){
|
||||||
// return miniAppUrlLink.getUrlLink();
|
return miniAppUrlLink.getUrlLink();
|
||||||
// }
|
}
|
||||||
// return null;
|
return null;
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,3 +50,4 @@ server.connection-timeout=18000000
|
|||||||
server.tomcat.basedir=/tmp/tomcat/partner-b
|
server.tomcat.basedir=/tmp/tomcat/partner-b
|
||||||
|
|
||||||
log4j2.formatMsgNoLookups=true
|
log4j2.formatMsgNoLookups=true
|
||||||
|
mybatis.configuration.variables.enterpriseId=e17cd2dc350541df8a8b0af9bd27f77d
|
||||||
@@ -7,7 +7,6 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
|||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
import org.springframework.cache.annotation.EnableCaching;
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.cool.store.controller;
|
||||||
|
|
||||||
|
import com.cool.store.context.PartnerUserHolder;
|
||||||
|
import com.cool.store.dto.wx.MiniProgramLoginDTO;
|
||||||
|
import com.cool.store.request.MobileUpdateRequest;
|
||||||
|
import com.cool.store.response.ResponseResult;
|
||||||
|
import com.cool.store.service.WechatMiniAppService;
|
||||||
|
import com.cool.store.vo.PartnerUserInfoVO;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: MiniProgramAppController
|
||||||
|
* @Description:
|
||||||
|
* @date 2023-05-29 14:28
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Api(tags = "微信小程序app接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping({"/v1/partnerManage/miniProgram" })
|
||||||
|
public class MiniProgramAppController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WechatMiniAppService wechatMiniAppService;
|
||||||
|
|
||||||
|
@ApiOperation("小程序登录")
|
||||||
|
@PostMapping("/login")
|
||||||
|
public ResponseResult<PartnerUserInfoVO> login(@RequestBody @Valid MiniProgramLoginDTO param) {
|
||||||
|
PartnerUserInfoVO userInfoVO = wechatMiniAppService.miniProgramLogin(param);
|
||||||
|
return ResponseResult.success(userInfoVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取手机号")
|
||||||
|
@GetMapping("/getUserPhoneNumber")
|
||||||
|
public ResponseResult<String> getUserPhoneNumber(@RequestParam(value = "mobileCode",required = true)String mobileCode) {
|
||||||
|
return ResponseResult.success(wechatMiniAppService.getUserPhoneNumber(mobileCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("更新手机号")
|
||||||
|
@PostMapping("/updateUserPhoneNumber")
|
||||||
|
public ResponseResult<String> updateUserPhoneNumber(@RequestBody @Valid MobileUpdateRequest request) {
|
||||||
|
PartnerUserInfoVO userInfoVO = PartnerUserHolder.getUser();
|
||||||
|
return ResponseResult.success(wechatMiniAppService.updateUserPhoneNumber(request, userInfoVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据mobile和openId获取用户信息")
|
||||||
|
@GetMapping("/getUserInfo")
|
||||||
|
public ResponseResult<PartnerUserInfoVO> getUserInfo(){
|
||||||
|
PartnerUserInfoVO userInfoVO = PartnerUserHolder.getUser();
|
||||||
|
return ResponseResult.success(userInfoVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package com.cool.store.controller;
|
||||||
|
|
||||||
|
import com.cool.store.dao.*;
|
||||||
|
import com.cool.store.entity.*;
|
||||||
|
import com.cool.store.response.ResponseResult;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/test")
|
||||||
|
public class TestController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserDAO enterpriseUserDAO;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserRoleDao enterpriseUserRoleDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private HyPartnerUserInfoDAO hyPartnerUserInfoDAO;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RegionDao regionDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysRoleDao sysRoleDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserRegionMappingDAO userRegionMappingDAO;
|
||||||
|
|
||||||
|
@GetMapping("/getUserInfo")
|
||||||
|
public ResponseResult getUserInfo(@RequestParam("userId")String userId){
|
||||||
|
EnterpriseUserDO enterpriseUser = enterpriseUserDAO.getUserInfoById(userId);
|
||||||
|
return ResponseResult.success(enterpriseUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getUserInfoByUserIds")
|
||||||
|
public ResponseResult getUserInfoByUserIds(@RequestParam(value = "userIdList", required = false) List<String> userIdList){
|
||||||
|
List<EnterpriseUserDO> enterpriseUserDOList = enterpriseUserDAO.getUserInfoByUserIds(userIdList);
|
||||||
|
return ResponseResult.success(enterpriseUserDOList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getUserRoleIds")
|
||||||
|
public ResponseResult getUserRoleIds(@RequestParam("userId")String userId){
|
||||||
|
List<Long> roleIdList = enterpriseUserRoleDao.getUserRoleIds(userId);
|
||||||
|
return ResponseResult.success(roleIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/selectByMobile")
|
||||||
|
public ResponseResult selectByMobile(@RequestParam("mobile")String mobile){
|
||||||
|
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByMobile(mobile);
|
||||||
|
return ResponseResult.success(hyPartnerUserInfoDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getRegionById")
|
||||||
|
public ResponseResult getRegionById(@RequestParam("regionId")Long regionId){
|
||||||
|
RegionDO regionDO = regionDao.getRegionById(regionId);
|
||||||
|
return ResponseResult.success(regionDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/selectRoleByRoleIds")
|
||||||
|
public ResponseResult selectRoleByRoleIds(@RequestParam("roleIds")List<Long> roleIds){
|
||||||
|
List<SysRoleDO> sysRoleDOList = sysRoleDao.selectRoleByRoleIds(roleIds);
|
||||||
|
return ResponseResult.success(sysRoleDOList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/listUserRegionMappingByUserId")
|
||||||
|
public ResponseResult listUserRegionMappingByUserId(@RequestParam("userIds")List<String> userIds){
|
||||||
|
List<UserRegionMappingDO> userRegionMappingDOList = userRegionMappingDAO.listUserRegionMappingByUserId(userIds);
|
||||||
|
return ResponseResult.success(userRegionMappingDOList);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
#mysql config
|
#mysql config
|
||||||
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_hy?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
|
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_36?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
|
||||||
default.datasource.username=hsay
|
default.datasource.username=coolstore
|
||||||
default.datasource.password=Z3J7xBbgouMD
|
default.datasource.password=CSCErYcXniNYm7bT
|
||||||
|
|
||||||
#redis
|
#redis
|
||||||
spring.redis.host=tstore-coolcollege.redis.rds.aliyuncs.com
|
spring.redis.host=tstore-coolcollege.redis.rds.aliyuncs.com
|
||||||
|
|||||||
@@ -50,3 +50,4 @@ server.connection-timeout=18000000
|
|||||||
server.tomcat.basedir=/tmp/tomcat/partner-b
|
server.tomcat.basedir=/tmp/tomcat/partner-b
|
||||||
|
|
||||||
log4j2.formatMsgNoLookups=true
|
log4j2.formatMsgNoLookups=true
|
||||||
|
mybatis.configuration.variables.enterpriseId=e17cd2dc350541df8a8b0af9bd27f77d
|
||||||
|
|||||||
Reference in New Issue
Block a user