分页问题优化
parent
ca6512e483
commit
55c8cbd33e
|
|
@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
|
@ -161,12 +162,11 @@ public class WxBuildingInfoServiceImpl implements IWxBuildingInfoService
|
|||
@Override
|
||||
public List<WxBuildingInfo> getAuditPage(WxBuildingInfo buildingInfo) {
|
||||
LoginUser user = SecurityUtils.getLoginUser();
|
||||
System.out.println("user="+ JSON.toJSONString(user));
|
||||
// System.out.println("user="+ JSON.toJSONString(user));
|
||||
// 查询当前登录的用户的系统角色
|
||||
List<UserRole> userRoles = userRoleMapper.selectUserRoleList(UserRole.builder().userId(user.getUserid()).build());
|
||||
Set<String> userRoles = user.getRoles();//userRoleMapper.selectUserRoleList(UserRole.builder().userId(user.getUserid()).build());
|
||||
if(!StringUtils.isEmpty(userRoles)&&userRoles.size()>0){
|
||||
List<String> roleCodes = userRoles.stream().map(UserRole::getRoleCode).collect(Collectors.toList());
|
||||
if(roleCodes.contains("admin")){
|
||||
if(userRoles.contains("admin")){
|
||||
//查询所有
|
||||
buildingInfo.setCreatedId(null);
|
||||
}else {
|
||||
|
|
|
|||
|
|
@ -77,7 +77,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ORDER BY distance LIMIT 20
|
||||
</select>
|
||||
<select id="getBuildingByCity" resultType="com.ruoyi.system.domain.WxBuildingInfo">
|
||||
|
||||
select info.* from building_info info where info.is_deleted=0
|
||||
<if test="status != null and status != ''">
|
||||
AND info.status=#{status}
|
||||
</if>
|
||||
<if test="buildingName != null and buildingName != ''">
|
||||
AND info.building_name like CONCAT('%',#{buildingName},'%')
|
||||
</if>
|
||||
<if test="cityCode != null and cityCode != ''">
|
||||
AND info.city_code=#{cityCode}
|
||||
</if>
|
||||
<if test="isSupportlive != null and isSupportlive != ''">
|
||||
AND info.is_supportlive=#{isSupportlive}
|
||||
</if>
|
||||
<if test="createdId != null">
|
||||
AND created_id=#{createdId}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
<select id="getAllBuildingByCondition" resultType="com.ruoyi.system.domain.vo.BuildingInfoResponse">
|
||||
|
|
@ -98,19 +113,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND created_id=#{createdId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getAuditPage" parameterType="WxBuildingInfo" resultMap="WxBuildingInfoResult">
|
||||
SELECT * FROM building_info where 1=1
|
||||
<select id="getAuditPage" resultType="com.ruoyi.system.domain.WxBuildingInfo">
|
||||
select info.* from building_info info where info.is_deleted=0
|
||||
<if test="status != null and status != ''">
|
||||
AND status=#{status}
|
||||
AND info.status=#{status}
|
||||
</if>
|
||||
<if test="buildingName != null and buildingName != ''">
|
||||
AND building_name like CONCAT('%',#{buildingName},'%')
|
||||
AND info.building_name like CONCAT('%',#{buildingName},'%')
|
||||
</if>
|
||||
<if test="createdBy != null and createdBy != ''">
|
||||
AND created_by=#{createdBy}
|
||||
<if test="cityCode != null and cityCode != ''">
|
||||
AND info.city_code=#{cityCode}
|
||||
</if>
|
||||
<if test="isSupportlive != null and isSupportlive != ''">
|
||||
AND info.is_supportlive=#{isSupportlive}
|
||||
</if>
|
||||
<if test="createdId != null">
|
||||
AND created_id=#{createdId}
|
||||
AND info.created_id=#{createdId}
|
||||
</if>
|
||||
<if test="createdBy != null and createdBy != ''">
|
||||
AND info.created_by=#{createdBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue