fix: 优化SQL
This commit is contained in:
parent
ebc2e3a22b
commit
3e01554ae5
@ -116,6 +116,9 @@ public class UserServiceImpl implements UserService {
|
||||
Map<String, Object> queryConditions = new HashMap<>();
|
||||
queryConditions.put("excludeUid", uid);
|
||||
queryConditions.put("currentLevel", currentLevel); // 添加当前用户的等级作为查询条件
|
||||
System.out.println("==============================" +
|
||||
queryConditions.toString() +
|
||||
"============================");
|
||||
List<UserInfo> userInfos;
|
||||
log.info("要查询的用户类型是:{}", userListParam.getUserType());
|
||||
if (Objects.equals(userListParam.getUserType(), "activate")) {
|
||||
|
@ -41,11 +41,28 @@
|
||||
</select>
|
||||
|
||||
<!-- getUserListAll 方法 -->
|
||||
<!-- <select id="getUserListAll" resultType="com.guaiguailang.harmony.domain.entity.UserInfo">-->
|
||||
<!-- SELECT * FROM user_info-->
|
||||
<!-- <where>-->
|
||||
<!-- <if test="merchantCode != 'ALL'">-->
|
||||
<!-- WHERE merchant_code = #{merchantCode}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="queryConditions.excludeUid != null">-->
|
||||
<!-- AND id != #{queryConditions.excludeUid}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="queryConditions.currentLevel != null">-->
|
||||
<!-- AND role_id IN (-->
|
||||
<!-- SELECT role_id FROM system_role WHERE level >= #{queryConditions.currentLevel}-->
|
||||
<!-- )-->
|
||||
<!-- </if>-->
|
||||
<!-- </where>-->
|
||||
<!-- LIMIT #{limit},#{end}-->
|
||||
<!-- </select>-->
|
||||
<select id="getUserListAll" resultType="com.guaiguailang.harmony.domain.entity.UserInfo">
|
||||
SELECT * FROM user_info
|
||||
<where>
|
||||
<if test="merchantCode != 'ALL'">
|
||||
WHERE merchant_code = #{merchantCode}
|
||||
merchant_code = #{merchantCode}
|
||||
</if>
|
||||
<if test="queryConditions.excludeUid != null">
|
||||
AND id != #{queryConditions.excludeUid}
|
||||
@ -58,7 +75,6 @@
|
||||
</where>
|
||||
LIMIT #{limit}, #{end}
|
||||
</select>
|
||||
|
||||
<select id="getUserListNum" resultType="com.guaiguailang.harmony.domain.vo.UserListNum">
|
||||
SELECT
|
||||
SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) AS userActivatedNum,
|
||||
|
Loading…
Reference in New Issue
Block a user