Commit e84913c8 by 杨林龙

增加权限关联

1 parent 9e01defd
...@@ -17,7 +17,6 @@ public interface TrialDriveReportMapper extends CommonBaseMapper<ElectricFenceDr ...@@ -17,7 +17,6 @@ public interface TrialDriveReportMapper extends CommonBaseMapper<ElectricFenceDr
@DataPerm(showSql = true) @DataPerm(showSql = true)
List<TrialDriveReportExport> getTestDrivePageList(TrialDriveReportSearch search); List<TrialDriveReportExport> getTestDrivePageList(TrialDriveReportSearch search);
@DataPerm(showSql = true)
List<TrialDriveReportExport> getEffectiveTestDriveData(TrialDriveReportSearch search); List<TrialDriveReportExport> getEffectiveTestDriveData(TrialDriveReportSearch search);
List<String> getYearWithData(); List<String> getYearWithData();
......
...@@ -33,14 +33,6 @@ public class TrialDriveReportService { ...@@ -33,14 +33,6 @@ public class TrialDriveReportService {
List<String> splitList = Arrays.asList(splitArr); List<String> splitList = Arrays.asList(splitArr);
search.setSplitList(splitList); search.setSplitList(splitList);
Integer rolePermissionType = ShieldContextHolder.getRolePermissionType();
//非管理员 并且 数据权限不是全部 的需要加上用户权限涉及的全部用户id
boolean superAdminFlag = ShieldContextHolder.isSuperAdmin();
if (!superAdminFlag && !UserConstants.RolePermitCastType.all.getCode().equals(rolePermissionType)) {
Set<Long> userIdList = ShieldContextHolder.getVisibleCreatorIds();
search.setUserIdList(userIdList);
}
return trialDriveReportMapper.getTestDrivePageList(search); return trialDriveReportMapper.getTestDrivePageList(search);
} }
......
...@@ -32,10 +32,10 @@ ...@@ -32,10 +32,10 @@
tefs.sn, tefs.sn,
tefs.vin, tefs.vin,
tv.model_name vehicleTypeName tv.model_name vehicleTypeName
from t_electric_fence_sns tefs from t_vehicle tv
inner join t_electric_fence_sns tefs on tv.vin = tefs.vin
inner join t_electric_fence tef on tef.id = tefs.fence_id inner join t_electric_fence tef on tef.id = tefs.fence_id
left join t_user tu on tu.id = tef.created_by left join t_user tu on tu.id = tef.created_by
left join t_vehicle tv on tv.vin = tefs.vin
where tefs.fence_id = tef.id where tefs.fence_id = tef.id
and tef.biz_fence_type = 12 and tu.del_flag = 0 and tef.biz_fence_type = 12 and tu.del_flag = 0
<if test="keywords != null and keywords!='' "> <if test="keywords != null and keywords!='' ">
...@@ -44,12 +44,6 @@ ...@@ -44,12 +44,6 @@
or tu.username like '%${keywords}%' or tu.username like '%${keywords}%'
) )
</if> </if>
<if test="userIdList != null">
and tu.id IN
<foreach collection="userIdList" item="userId" index="index" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
<if test="splitList != null"> <if test="splitList != null">
and tv.model_name IN and tv.model_name IN
<foreach collection="splitList" item="vehicleTypeName" index="index" open="(" close=")" separator=","> <foreach collection="splitList" item="vehicleTypeName" index="index" open="(" close=")" separator=",">
......
...@@ -3,7 +3,11 @@ package cn.com.glsx.admin.modules.service; ...@@ -3,7 +3,11 @@ package cn.com.glsx.admin.modules.service;
import cn.com.glsx.Application; import cn.com.glsx.Application;
import cn.com.glsx.admin.modules.model.export.TrialDriveReportExport; import cn.com.glsx.admin.modules.model.export.TrialDriveReportExport;
import cn.com.glsx.admin.modules.model.param.TrialDriveReportSearch; import cn.com.glsx.admin.modules.model.param.TrialDriveReportSearch;
import cn.com.glsx.usercenter.api.dto.response.Organization;
import cn.com.glsx.usercenter.api.feign.OrganizationService;
import cn.com.glsx.usercenter.api.feign.UserService;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -11,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -11,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
...@@ -21,6 +26,12 @@ public class TrialDriveReportServiceTest { ...@@ -21,6 +26,12 @@ public class TrialDriveReportServiceTest {
@Autowired @Autowired
private TrialDriveReportService trialDriveReportService; private TrialDriveReportService trialDriveReportService;
@Autowired
private OrganizationService organizationService;
@Autowired
private UserService userService;
@Test @Test
public void search() { public void search() {
TrialDriveReportSearch trialDriveReportSearch = new TrialDriveReportSearch(); TrialDriveReportSearch trialDriveReportSearch = new TrialDriveReportSearch();
...@@ -43,4 +54,14 @@ public class TrialDriveReportServiceTest { ...@@ -43,4 +54,14 @@ public class TrialDriveReportServiceTest {
List<String> yearWithData = trialDriveReportService.getYearWithData(); List<String> yearWithData = trialDriveReportService.getYearWithData();
System.out.println("yearWithData = " + JSON.toJSONString(yearWithData)); System.out.println("yearWithData = " + JSON.toJSONString(yearWithData));
} }
@Test
public void test04() {
List userIdList = new ArrayList<Long>();
userIdList.add(Long.parseLong("6576"));
userIdList.add(Long.parseLong("6577"));
R<List<Organization>> listR = organizationService.getOrgsByUserIds(userIdList);
System.out.println(" = " +JSON.toJSONString(listR));
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!