1. 数据隔离

This commit is contained in:
邱贞招 2024-06-01 14:25:02 +08:00
parent a48b7ccf12
commit 11d55606f0
10 changed files with 53 additions and 19 deletions

View File

@ -41,7 +41,7 @@ public class EtOperatingAreaController extends BaseController
public TableDataInfo list(EtOperatingArea etOperatingArea)
{
startPage();
List<EtOperatingArea> list = etOperatingAreaService.selectEtOperatingAreaList(etOperatingArea);
List<EtOperatingArea> list = etOperatingAreaService.selectEtOperatingAreaListWithisolate(etOperatingArea);
return getDataTable(list);
}

View File

@ -31,6 +31,14 @@ public interface IEtOperatingAreaService extends IService<EtOperatingArea>
*/
public List<EtOperatingArea> selectEtOperatingAreaList(EtOperatingArea etOperatingArea);
/**
* 查询运营区列表
*
* @param etOperatingArea 运营区
* @return 运营区集合
*/
public List<EtOperatingArea> selectEtOperatingAreaListWithisolate(EtOperatingArea etOperatingArea);
/**
* 新增运营区
*

View File

@ -80,7 +80,6 @@ public class EtOperatingAreaServiceImpl extends ServiceImpl<EtOperatingAreaMappe
* @param etOperatingArea 运营区
* @return 运营区
*/
@DataScope(deptAlias = "d")
@Override
public List<EtOperatingArea> selectEtOperatingAreaList(EtOperatingArea etOperatingArea)
{
@ -101,6 +100,33 @@ public class EtOperatingAreaServiceImpl extends ServiceImpl<EtOperatingAreaMappe
return etOperatingAreas;
}
/**
* 查询运营区列表
*
* @param etOperatingArea 运营区 隔离
* @return 运营区
*/
@DataScope(deptAlias = "d")
@Override
public List<EtOperatingArea> selectEtOperatingAreaListWithisolate(EtOperatingArea etOperatingArea)
{
List<EtOperatingArea> etOperatingAreas = dao.selectEtOperatingAreaList(etOperatingArea);
for(EtOperatingArea area : etOperatingAreas){
Integer integer = asDeviceService.selectCountByAreaId(area.getAreaId());
area.setDeviceNum(integer);
List<String> list = etFeeRuleService.selectRuleNameListByAreaId(area.getAreaId());
StringBuilder ruleStr = new StringBuilder();
for (String rule : list) {
if (ruleStr.length() > 0) {
ruleStr.append(", ");
}
ruleStr.append(rule);
}
area.setRuleStr(ruleStr.toString().trim());
}
return etOperatingAreas;
}
/**
* 新增运营区
*

View File

@ -40,8 +40,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select a.article_id, a.area_id, a.classify_id, a.title, a.logo, a.master_picture, a.tag,a.is_hot, a.introduction, a.content, a.author,
a.create_by, a.create_time, a.update_by, a.update_time, a.remark, ac.classify_name from et_article a
left join et_article_classify ac on ac.classify_id = a.classify_id
inner join et_area_dept ad on ad.area_id = a.area_id
inner join sys_dept d on d.dept_id = ad.dept_id
left join et_area_dept ad on ad.area_id = a.area_id
left join sys_dept d on d.dept_id = ad.dept_id
where 1 = 1
<if test="classifyId != null and classifyId != ''"> and a.classify_id = #{classifyId}</if>
<if test="title != null and title != ''"> and a.title like concat('%', #{title}, '%')</if>

View File

@ -41,8 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
de.activation_time, de.online_status, de.create_by, de.create_time, de.update_by,
de.update_time, de.last_time, de.remark, de.status, de.lock_status, de.location,
de.remaining_power, de.voltage, de.qrcode, de.longitude, de.latitude, de.is_area_out_outage from et_device de
inner join et_area_dept ad on ad.area_id = de.area_id
inner join sys_dept d on d.dept_id = ad.dept_id
left join et_area_dept ad on ad.area_id = de.area_id
left join sys_dept d on d.dept_id = ad.dept_id
where 1 = 1
<if test="deviceName != null and deviceName != ''"> and de.device_name like concat('%', #{deviceName}, '%')</if>
<if test="mac != null and mac != ''"> and de.mac = #{mac}</if>

View File

@ -34,8 +34,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectEtAdminOrderList" parameterType="EtAdminOrder" resultMap="EtAdminOrderResult">
select ao.id, ao.area_id, ao.order_no, ao.device_mac, ao.sn, ao.admin_id, ao.before_electric, ao.after_electric, ao.open_time, ao.close_time, ao.type,
ao.fault_id, ao.repair_type, ao.status, ao.is_success, ao.is_effective, ao.address, ao.complete_time, ao.create_time, ao.remark from et_admin_order ao
inner join et_area_dept ad on ad.area_id = ao.area_id
inner join sys_dept d on d.dept_id = ad.dept_id
left join et_area_dept ad on ad.area_id = ao.area_id
left join sys_dept d on d.dept_id = ad.dept_id
where 1 = 1
<if test="orderNo != null and orderNo != ''"> and ao.order_no like concat('%', #{orderNo}, '%')</if>
<if test="deviceMac != null and deviceMac != ''"> and ao.device_mac like concat('%', #{deviceMac}, '%')</if>

View File

@ -28,9 +28,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectEtCapitalFlowList" parameterType="EtCapitalFlow" resultMap="EtCapitalFlowResult">
select cf.flow_id, cf.area_id, cf.order_no, cf.out_trade_no, cf.type, cf.bus_type, cf.amount, cf.handling_charge,
cf.operator_dividend, cf.operator_balance, cf.partner_dividend, cf.pay_type, cf.create_time,a.area_name from et_capital_flow cf
inner join et_operating_area a on a.area_id = cf.area_id
inner join et_area_dept ad on ad.area_id = cf.area_id
inner join sys_dept d on d.dept_id = ad.dept_id
left join et_operating_area a on a.area_id = cf.area_id
left join et_area_dept ad on ad.area_id = cf.area_id
left join sys_dept d on d.dept_id = ad.dept_id
where 1 = 1
<if test="areaId != null "> and cf.area_id = #{areaId}</if>
<if test="orderNo != null and orderNo != ''"> and cf.order_no = #{orderNo}</if>

View File

@ -18,13 +18,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectEtFaultVo">
select fault_id, areaId, user_id, device_mac, type, create_time, picture, detail, order_id, status from et_fault
select fault_id, area_id, user_id, device_mac, type, create_time, picture, detail, order_id, status from et_fault
</sql>
<select id="selectEtFaultList" parameterType="EtFault" resultMap="EtFaultResult">
select f.fault_id, f.area_id, f.user_id, f.device_mac, f.type, f.create_time, f.picture, f.detail, f.order_id, f.status from et_fault f
inner join et_area_dept ad on ad.area_id = f.area_id
inner join sys_dept d on d.dept_id = ad.dept_id
left join et_area_dept ad on ad.area_id = f.area_id
left join sys_dept d on d.dept_id = ad.dept_id
where 1 = 1
<if test="userId != null "> and f.user_id = #{userId}</if>
<if test="type != null and type != ''"> and f.type = #{type}</if>

View File

@ -60,8 +60,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.no_riding_outage, a.authentication, a.msg_switch, a.undercharge, a.error, a.agreement, a.deposit,
a.outage, a.appointment_service_fee, a.dispatch_fee, a.vehicle_management_fee, a.timeout_minutes,
a.auto_replacement_order, a.area_time_start, a.area_time_end from et_operating_area a
inner join et_area_dept ad on ad.area_id = a.area_id
inner join sys_dept d on d.dept_id = ad.dept_id
left join et_area_dept ad on ad.area_id = a.area_id
left join sys_dept d on d.dept_id = ad.dept_id
where 1 = 1
<if test="areaName != null and areaName != ''"> and a.area_name like concat('%', #{areaName}, '%')</if>
<!-- 数据范围过滤 -->

View File

@ -87,14 +87,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
et_operating_area oa ON o.area_id = oa.area_id
LEFT JOIN
et_user u ON u.user_id = o.user_id
inner join et_area_dept ad on ad.area_id = oa.area_id
inner join sys_dept d on d.dept_id = ad.dept_id
LEFT join et_area_dept ad on ad.area_id = oa.area_id
LEFT join sys_dept d on d.dept_id = ad.dept_id
where 1 = 1
<if test="orderNo != null and orderNo != ''"> and o.order_no like concat('%', #{orderNo}, '%')</if>
<if test="area != null and area != ''"> and oa.area_name like concat('%', #{area}, '%')</if>
<if test="userName != null and userName != ''"> and u.user_name like concat('%', #{userName}, '%')</if>
<if test="phonenumber != null and phonenumber != ''"> and u.phonenumber like concat('%', #{phonenumber}, '%')</if>
<if test="userId != null and userId != ''"> and u.user_id = #{userId}</if>
<if test="userId != null and userId != ''"> and o.user_id = #{userId}</if>
<if test="deviceMac != null and deviceMac != ''"> and o.device_mac like concat('%', #{deviceMac}, '%')</if>
<if test="sn != null and sn != ''"> and o.sn like concat('%', #{sn}, '%')</if>
<if test="type != null and type != ''"> and o.type = #{type}</if>