新增用户相关dao方法

This commit is contained in:
zhangchenbiao
2023-06-15 16:08:39 +08:00
parent 5c690435d4
commit 39782aec34
12 changed files with 93 additions and 2 deletions

View File

@@ -29,7 +29,7 @@ public class EnterpriseUserDAO {
return enterpriseUserMapper.getUserInfoById(userId);
}
public List<EnterpriseUserDO> getUserInfoByUserIds(List<String> userIdList){
public List<EnterpriseUserDO> getUserInfoByUserIds(List<String> userIdList){
if(CollectionUtils.isEmpty(userIdList)){
return Lists.newArrayList();
}
@@ -60,4 +60,8 @@ public class EnterpriseUserDAO {
}
return enterpriseUserMapper.deleteUserByUserId(userId);
}
public List<EnterpriseUserDO> searchUserByRegionIdsAndKeyword(List<String> regionIds, String keyword, boolean isLeader){
return enterpriseUserMapper.searchUserByRegionIdsAndKeyword(regionIds, keyword, isLeader);
}
}

View File

@@ -4,6 +4,7 @@ import com.cool.store.constants.CommonConstants;
import com.cool.store.entity.UserRegionMappingDO;
import com.cool.store.enums.DataSourceEnum;
import com.cool.store.mapper.UserRegionMappingMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
@@ -59,4 +60,28 @@ public class UserRegionMappingDAO {
return userRegionMappingMapper.deleteUserRegionByUserId(userId);
}
/**
* 获取一个区域下直挂的人
* @param regionId
* @return
*/
public List<String> getUserListByRegionId(String regionId){
if(StringUtils.isBlank(regionId)){
return Lists.newArrayList();
}
return userRegionMappingMapper.getUserListByRegionId(regionId);
}
/**
* 获取一个人所属的部门
* @param userId
* @return
*/
public List<String> getRegionIdsByUserId(String userId){
if(StringUtils.isBlank(userId)){
return Lists.newArrayList();
}
return userRegionMappingMapper.getRegionIdsByUserId(userId);
}
}

View File

@@ -52,4 +52,13 @@ public interface EnterpriseUserMapper {
* @return
*/
Integer deleteUserByUserId(@Param("userId") String userId);
/**
* 根据关键字搜索部门下的用户
* @param regionIds
* @param keyword
* @param isLeader
* @return
*/
List<EnterpriseUserDO> searchUserByRegionIdsAndKeyword(@Param("regionIds") List<String> regionIds, @Param("keyword") String keyword, @Param("isLeader") boolean isLeader);
}

View File

@@ -54,4 +54,18 @@ public interface UserRegionMappingMapper {
* @return
*/
Integer deleteUserRegionByUserId(@Param("userId") String userId);
/**
* 获取一个区域下是直挂的人
* @param regionId
* @return
*/
List<String> getUserListByRegionId(@Param("regionId") String regionId);
/**
* 获取人所在的区域
* @param userId
* @return
*/
List<String> getRegionIdsByUserId(@Param("userId") String userId);
}

View File

@@ -261,4 +261,23 @@
<update id="deleteUserByUserId">
update enterprise_user set deleted = 1 where user_id = #{userId}
</update>
<select id="searchUserByRegionIdsAndKeyword" resultMap="BaseResultMap">
select
user_id, name, mobile
from
enterprise_user
<where>
deleted = 0
<if test="regionIds != null and regionIds.size()>0">
and <foreach collection="regionIds" item="regionId" separator="or" open="(" close=")"> user_region_ids like concat("%", #{regionId}, "%") </foreach>
</if>
<if test="keyword != null">
and (name like concat("%", #{keyword}, "%") or mobile like concat("%", #{keyword}, "%"))
</if>
<if test="isLeader!= null and isLeader">
and is_leader = 1 and leader_dept_ids in <foreach collection="regionIds" item="regionId" separator="," open="(" close=")">#{regionId}</foreach>
</if>
</where>
</select>
</mapper>

View File

@@ -123,4 +123,12 @@
update user_region_mapping set deleted = 1 where user_id = #{userId}
</update>
<select id="getUserListByRegionId" resultType="string">
select user_id from user_region_mapping where region_id = #{regionId}
</select>
<select id="getRegionIdsByUserId" resultType="string">
select region_id from user_region_mapping where user_id = #{userId}
</select>
</mapper>

View File

@@ -141,5 +141,6 @@
<orderEntry type="library" name="Maven: io.netty:netty-all:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.6" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.groovy:groovy:2.5.10" level="project" />
<orderEntry type="library" name="Maven: com.aliyun:dytnsapi20200217:1.0.28" level="project" />
</component>
</module>

View File

@@ -59,6 +59,10 @@
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>dytnsapi20200217</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -106,6 +106,7 @@
<orderEntry type="library" name="Maven: io.netty:netty-all:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.6" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.groovy:groovy:2.5.10" level="project" />
<orderEntry type="library" name="Maven: com.aliyun:dytnsapi20200217:1.0.28" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.2.6.RELEASE" level="project" />

View File

@@ -36,7 +36,7 @@ customize_sub_table_size=10
mybatis.configuration.call-setters-on-nulls=true
mybatis.configuration.map-underscore-to-camel-case=true
isv.domain = http://localhost:31100
isv.domain = http://localhost:31100/isv
#rocketmq \u914D\u7F6E
rocketmq.accessKey=zK2oVEz4G1ts23d2

View File

@@ -104,6 +104,7 @@
<orderEntry type="library" name="Maven: io.netty:netty-all:4.1.48.Final" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.6" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.groovy:groovy:2.5.10" level="project" />
<orderEntry type="library" name="Maven: com.aliyun:dytnsapi20200217:1.0.28" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />

View File

@@ -176,6 +176,11 @@
<artifactId>xxl-job-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>dytnsapi20200217</artifactId>
<version>1.0.28</version>
</dependency>
</dependencies>
</dependencyManagement>