2021-07-20 18:27:35 +08:00
|
|
|
<?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">
|
2021-07-28 18:07:25 +08:00
|
|
|
<mapper namespace="com.xhpc.system.mapper.XhpcUserPrivilegeMapper">
|
2021-07-20 18:27:35 +08:00
|
|
|
|
2021-07-29 10:09:11 +08:00
|
|
|
<resultMap type="com.xhpc.system.domain.XhpcUserPrivilege" id="XhpcUserPrivilegeResult">
|
2021-07-20 18:27:35 +08:00
|
|
|
<result column="user_id" property="userId"/>
|
|
|
|
|
<result column="charging_station_id" property="chargingStationId"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
|
2021-07-29 10:09:11 +08:00
|
|
|
<insert id="insert" parameterType="com.xhpc.system.domain.XhpcUserPrivilege">
|
2021-07-20 18:27:35 +08:00
|
|
|
insert into xhpc_user_privilege(
|
|
|
|
|
<if test="null != userId and '' != userId">
|
|
|
|
|
user_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingStationId and '' != chargingStationId">
|
|
|
|
|
charging_station_id
|
|
|
|
|
</if>
|
|
|
|
|
)values(
|
|
|
|
|
<if test="null != userId and '' != userId">
|
|
|
|
|
#{userId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingStationId and '' != chargingStationId">
|
|
|
|
|
#{chargingStationId}
|
|
|
|
|
</if>
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<delete id="delete" parameterType="Long">
|
2021-08-02 18:36:17 +08:00
|
|
|
delete from xhpc_user_privilege where user_id = #{userId}
|
2021-07-20 18:27:35 +08:00
|
|
|
</delete>
|
|
|
|
|
|
2021-08-02 18:36:17 +08:00
|
|
|
<select id="dataCheckedKeys" parameterType="Long" resultType="java.lang.Long">
|
2021-07-20 18:27:35 +08:00
|
|
|
select charging_station_id chargingStationId from xhpc_user_privilege where user_id = #{userId}
|
|
|
|
|
</select>
|
|
|
|
|
|
2021-07-29 10:09:11 +08:00
|
|
|
<select id="getOperatorId" parameterType="java.lang.String" resultType="java.util.Map">
|
2021-07-30 17:23:38 +08:00
|
|
|
select distinct xo.operator_id operatorId, xo.name, xo.contact_name contactName,
|
2021-07-20 18:27:35 +08:00
|
|
|
xo.contact_phone contactPhone, xo.phone, xo.attribute,
|
|
|
|
|
xdb.dict_value attributenName
|
|
|
|
|
from xhpc_operator `xo`
|
|
|
|
|
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'operator_attribute' and xdb.dict_key = xo.attribute
|
2021-07-30 17:23:38 +08:00
|
|
|
JOIN xhpc_charging_station xcs on xcs.operator_id = xo.operator_id
|
2021-07-20 18:27:35 +08:00
|
|
|
where xo.del_flag = 0
|
|
|
|
|
<if test="null != operatorIds and '' != operatorIds">
|
2021-11-13 15:21:10 +08:00
|
|
|
and xo.operator_id in
|
2021-07-20 18:27:35 +08:00
|
|
|
<foreach collection="operatorIds" index="index" item="item" open="(" separator="," close=")">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY xo.create_time DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
2021-07-29 10:09:11 +08:00
|
|
|
<select id="getOperatorIdByUserId" parameterType="java.lang.String" resultType="java.util.Map">
|
2021-07-20 18:27:35 +08:00
|
|
|
select xo.operator_id operatorId, xo.name, xo.contact_name contactName,
|
|
|
|
|
xo.contact_phone contactPhone, xo.phone, xo.attribute,
|
|
|
|
|
xdb.dict_value attributenName
|
|
|
|
|
from xhpc_operator `xo`
|
|
|
|
|
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'operator_attribute' and xdb.dict_key = xo.attribute
|
|
|
|
|
where xo.del_flag = 0
|
|
|
|
|
<if test="null != operatorIds and '' != operatorIds">
|
|
|
|
|
and operator_id in
|
|
|
|
|
(select operator_id
|
|
|
|
|
from xhpc_charging_station
|
|
|
|
|
where charging_station_id in (
|
|
|
|
|
select charging_station_id from xhpc_user_privilege where user_id = #{userId})
|
|
|
|
|
GROUP BY operator_id)
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY xo.create_time DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
2021-07-29 10:09:11 +08:00
|
|
|
<select id="groupProvinceByOperatorId" parameterType="java.lang.String" resultType="java.util.Map">
|
2021-07-20 18:27:35 +08:00
|
|
|
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="null != userId and '' != userId">
|
|
|
|
|
and xcs.charging_station_id in (
|
|
|
|
|
select charging_station_id from xhpc_user_privilege where user_id = #{userId})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != operatorId and '' != operatorId">
|
|
|
|
|
and xcs.operator_id = #{operatorId}
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY `pxa`.pcode
|
2021-07-30 17:23:38 +08:00
|
|
|
) and code != 100000
|
2021-07-20 18:27:35 +08:00
|
|
|
</select>
|
|
|
|
|
|
2021-07-29 10:09:11 +08:00
|
|
|
<select id="groupCityByOperatorId" parameterType="java.lang.String" resultType="java.util.Map">
|
2021-07-20 18:27:35 +08:00
|
|
|
select `code` ,`name` from xhpc_area where `code` in (
|
2021-07-30 17:23:38 +08:00
|
|
|
select `xa`.pcode city
|
2021-07-20 18:27:35 +08:00
|
|
|
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="null != userId and '' != userId">
|
|
|
|
|
and xcs.charging_station_id in (
|
|
|
|
|
select charging_station_id from xhpc_user_privilege where user_id = #{userId})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != operatorId and '' != operatorId">
|
|
|
|
|
and xcs.operator_id = #{operatorId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != provinceCode and '' != provinceCode">
|
|
|
|
|
and pxa.pcode = #{provinceCode}
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY `pxa`.code
|
|
|
|
|
)
|
|
|
|
|
</select>
|
|
|
|
|
|
2021-07-29 10:09:11 +08:00
|
|
|
<select id="groupAreaByOperatorId" parameterType="java.lang.String" resultType="java.util.Map">
|
2021-07-20 18:27:35 +08:00
|
|
|
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="null != userId and '' != userId">
|
|
|
|
|
and xcs.charging_station_id in (
|
|
|
|
|
select charging_station_id from xhpc_user_privilege where user_id = #{userId})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != operatorId and '' != operatorId">
|
|
|
|
|
and xcs.operator_id = #{operatorId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != cityCode and '' != cityCode">
|
2021-07-30 17:23:38 +08:00
|
|
|
and xa.pcode = #{cityCode}
|
2021-07-20 18:27:35 +08:00
|
|
|
</if>
|
|
|
|
|
GROUP BY `xa`.code
|
|
|
|
|
)
|
|
|
|
|
</select>
|
|
|
|
|
|
2021-07-29 10:09:11 +08:00
|
|
|
<select id="dataPowerByOperatorId" parameterType="java.lang.String" resultType="java.util.Map">
|
2021-07-20 18:27:35 +08:00
|
|
|
|
2021-07-22 14:01:28 +08:00
|
|
|
select xcs.charging_station_id chargingStationId,xcs.name
|
2021-07-20 18:27:35 +08:00
|
|
|
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="null != userId and '' != userId">
|
|
|
|
|
and xcs.charging_station_id in (
|
|
|
|
|
select charging_station_id from xhpc_user_privilege where user_id = #{userId})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != operatorId and '' != operatorId">
|
|
|
|
|
and xcs.operator_id = #{operatorId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != code and '' != code">
|
|
|
|
|
and `xa`.`code` = #{code}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
2021-07-28 18:07:25 +08:00
|
|
|
</mapper>
|