132 lines
5.5 KiB
XML
132 lines
5.5 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.xhpc.user.mapper.MechanismMapper">
|
|
|
|
<select id="getLandUser" resultType="map">
|
|
select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId}
|
|
</select>
|
|
|
|
<select id="groupProvinceById" parameterType="java.lang.String" resultType="java.util.Map">
|
|
select `code` ,`name` from xhpc_area where `code` in (
|
|
select `pxa`.pcode province
|
|
from xhpc_charging_station xcs
|
|
LEFT JOIN xhpc_area `xa` on `xa`.`code` = xcs.area_code
|
|
LEFT JOIN xhpc_area pxa on `xa`.pcode = pxa.`code`
|
|
where xcs.del_flag = 0
|
|
<if test="type==1">
|
|
and xcs.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
|
|
</if>
|
|
<if test="type==2">
|
|
and xcs.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
|
|
</if>
|
|
<if test="type==3">
|
|
and xcs.operator_id=#{operatorId}
|
|
</if>
|
|
GROUP BY `pxa`.pcode
|
|
)
|
|
</select>
|
|
|
|
<select id="groupCityById" parameterType="java.lang.String" resultType="java.util.Map">
|
|
select `code` ,`name` from xhpc_area where `code` in (
|
|
select `xa`.pcode city
|
|
from xhpc_charging_station xcs
|
|
LEFT JOIN xhpc_area `xa` on `xa`.`code` = xcs.area_code
|
|
LEFT JOIN xhpc_area pxa on `xa`.pcode = pxa.`code`
|
|
where xcs.del_flag = 0
|
|
<if test="type==1">
|
|
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
|
|
</if>
|
|
<if test="type==2">
|
|
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
|
|
</if>
|
|
<if test="null != provinceCode and '' != provinceCode">
|
|
and pxa.pcode = #{provinceCode}
|
|
</if>
|
|
<if test="type==3">
|
|
and xcs.operator_id=#{operatorId}
|
|
</if>
|
|
GROUP BY `pxa`.code
|
|
)
|
|
</select>
|
|
|
|
<select id="groupAreaById" parameterType="java.lang.String" resultType="java.util.Map">
|
|
select `code` ,`name` from xhpc_area where `code` in (
|
|
select `xa`.code
|
|
from xhpc_charging_station xcs
|
|
LEFT JOIN xhpc_area `xa` on `xa`.`code` = xcs.area_code
|
|
LEFT JOIN xhpc_area pxa on `xa`.pcode = pxa.`code`
|
|
where xcs.del_flag = 0
|
|
<if test="type==1">
|
|
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
|
|
</if>
|
|
<if test="type==2">
|
|
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
|
|
</if>
|
|
<if test="null != cityCode and '' != cityCode">
|
|
and xa.pcode = #{cityCode}
|
|
</if>
|
|
<if test="type==3">
|
|
and xcs.operator_id=#{operatorId}
|
|
</if>
|
|
GROUP BY `xa`.code
|
|
)
|
|
</select>
|
|
|
|
<select id="groupOperatorById" parameterType="java.lang.String" resultType="java.util.Map">
|
|
|
|
select operator_id operatorId,name from xhpc_operator where operator_id in (
|
|
select xcs.operator_id
|
|
from xhpc_charging_station xcs
|
|
where xcs.del_flag = 0
|
|
<if test="type==1">
|
|
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
|
|
</if>
|
|
<if test="type==2">
|
|
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
|
|
</if>
|
|
<if test="null != code and '' != code">
|
|
and xcs.area_code = #{code}
|
|
</if>
|
|
)
|
|
</select>
|
|
|
|
<select id="dataCodeById" parameterType="java.lang.String" resultType="java.util.Map">
|
|
select xcs.charging_station_id chargingStationId,xcs.name
|
|
from xhpc_charging_station xcs
|
|
LEFT JOIN xhpc_area `xa` on `xa`.`code` = xcs.area_code
|
|
LEFT JOIN xhpc_area pxa on `xa`.pcode = pxa.`code`
|
|
where xcs.del_flag = 0
|
|
<if test="type==1">
|
|
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
|
|
</if>
|
|
<if test="type==2">
|
|
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
|
|
</if>
|
|
<if test="null != code and '' != code">
|
|
and `xa`.`code` = #{code}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="dataChargingStationId" parameterType="java.lang.String" resultType="java.util.Map">
|
|
select xcs.charging_station_id chargingStationId,xcs.name
|
|
from xhpc_charging_station xcs
|
|
LEFT JOIN xhpc_area `xa` on `xa`.`code` = xcs.area_code
|
|
LEFT JOIN xhpc_area pxa on `xa`.pcode = pxa.`code`
|
|
where xcs.del_flag = 0
|
|
<if test="type==1">
|
|
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
|
|
</if>
|
|
<if test="type==2">
|
|
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
|
|
</if>
|
|
<if test="null != operatorId ">
|
|
and xcs.operator_id =#{operatorId}
|
|
</if>
|
|
<if test="null != code and '' != code">
|
|
and xcs.area_code = #{code}
|
|
</if>
|
|
</select>
|
|
</mapper>
|