Files
jsowell-charger-web/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml
2025-04-07 15:01:16 +08:00

727 lines
37 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.jsowell.pile.mapper.PileStationInfoMapper">
<resultMap type="com.jsowell.pile.domain.PileStationInfo" id="PileStationInfoResult">
<result property="id" column="id" />
<result property="merchantId" column="merchant_id" />
<result property="stationName" column="station_name" />
<result property="deptId" column="dept_id" />
<result property="parkingId" column="parking_id" />
<result property="qrcodePrefix" column="qrcode_prefix" />
<result property="aloneApply" column="alone_apply" />
<result property="accountNumber" column="account_number" />
<result property="capacity" column="capacity" />
<result property="publicParking" column="public_parking" />
<result property="parkingNumber" column="parking_number" />
<result property="parkFeeDescribe" column="park_fee_describe" />
<result property="countryCode" column="country_code" />
<result property="areaCode" column="area_code" />
<result property="address" column="address" />
<result property="stationTel" column="station_tel" />
<result property="serviceTel" column="service_tel" />
<result property="stationType" column="station_type" />
<result property="stationStatus" column="station_status" />
<result property="stationAdminName" column="station_admin_name" />
<result property="parkNums" column="park_nums" />
<result property="stationLng" column="station_lng" />
<result property="stationLat" column="station_lat" />
<result property="siteGuide" column="site_guide" />
<result property="operatorName" column="operator_name" />
<result property="aMapStationName" column="amap_station_name" />
<result property="construction" column="construction" />
<result property="pictures" column="pictures" />
<result property="matchCars" column="match_cars" />
<result property="parkInfo" column="park_info" />
<result property="parkOwner" column="park_owner" />
<result property="parkManager" column="park_manager" />
<result property="openAllDay" column="open_all_day" />
<result property="businessHours" column="business_hours" />
<result property="parkFree" column="park_free" />
<result property="payment" column="payment" />
<result property="supportOrder" column="support_order" />
<result property="remark" column="remark" />
<result property="publicFlag" column="public_flag" />
<result property="aMapFlag" column="amap_flag" />
<result property="openFlag" column="open_flag" />
<result property="toiletFlag" column="toilet_flag" />
<result property="storeFlag" column="store_flag" />
<result property="restaurantFlag" column="restaurant_flag" />
<result property="loungeFlag" column="lounge_flag" />
<result property="canopyFlag" column="canopy_flag" />
<result property="printerFlag" column="printer_flag" />
<result property="barrierFlag" column="barrier_flag" />
<result property="parkingLockFlag" column="parking_lock_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="Base_Column_List">
id,merchant_id, station_name, dept_id, parking_id, qrcode_prefix, alone_apply, account_number, capacity, public_parking, parking_number,
park_fee_describe, country_code, area_code, address, station_tel, service_tel, station_type, station_status, station_admin_name, park_nums,
station_lng, station_lat, site_guide, operator_name, amap_station_name, construction, pictures, match_cars, park_info, park_owner,
park_manager, open_all_day, business_hours, park_free, payment, support_order, remark, public_flag, amap_flag,
open_flag, toilet_flag, store_flag, restaurant_flag, lounge_flag, canopy_flag, printer_flag, barrier_flag,
parking_lock_flag, create_by, create_time, update_by, update_time, del_flag
</sql>
<sql id="selectPileStationInfoVo">
select <include refid="Base_Column_List"/> from pile_station_info
</sql>
<select id="selectPileStationInfoList" parameterType="com.jsowell.pile.domain.PileStationInfo" resultMap="PileStationInfoResult">
<include refid="selectPileStationInfoVo"/>
<where>
<if test="merchantId != null and merchantId != ''"> and merchant_id = #{merchantId}</if>
<if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if>
<if test="parkingId != null and parkingId != ''"> and parking_id = #{parkingId}</if>
<if test="qrcodePrefix != null and qrcodePrefix != ''"> and qrcode_prefix = #{qrcodePrefix}</if>
<if test="aloneApply != null and aloneApply != ''"> and alone_apply = #{aloneApply}</if>
<if test="accountNumber != null and accountNumber != ''"> and account_number = #{accountNumber}</if>
<if test="capacity != null "> and capacity = #{capacity}</if>
<if test="publicParking != null and publicParking != ''"> and public_parking = #{publicParking}</if>
<if test="parkingNumber != null and parkingNumber != ''"> and parking_number = #{parkingNumber}</if>
<if test="parkFeeDescribe != null and parkFeeDescribe != ''"> and park_fee_describe = #{parkFeeDescribe}</if>
<if test="countryCode != null and countryCode != ''"> and country_code = #{countryCode}</if>
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
<if test="address != null and address != ''"> and address like concat('%', #{address}, '%')</if>
<if test="stationTel != null and stationTel != ''"> and station_tel = #{stationTel}</if>
<if test="serviceTel != null and serviceTel != ''"> and service_tel = #{serviceTel}</if>
<if test="stationType != null and stationType != ''"> and station_type = #{stationType}</if>
<if test="stationStatus != null and stationStatus != ''"> and station_status = #{stationStatus}</if>
<if test="stationAdminName != null and stationAdminName != ''"> and station_admin_name = #{stationAdminName}</if>
<if test="parkNums != null and parkNums != ''"> and park_nums = #{parkNums}</if>
<if test="stationLng != null and stationLng != ''"> and station_lng = #{stationLng}</if>
<if test="stationLat != null and stationLat != ''"> and station_lat = #{stationLat}</if>
<if test="siteGuide != null and siteGuide != ''"> and site_guide = #{siteGuide}</if>
<if test="operatorName != null and operatorName != ''"> and operator_name = #{operatorName}</if>
<if test="aMapStationName != null and aMapStationName != ''"> and amap_station_name = #{aMapStationName}</if>
<if test="construction != null and construction != ''"> and construction = #{construction}</if>
<if test="pictures != null and pictures != ''"> and pictures = #{pictures}</if>
<if test="matchCars != null and matchCars != ''"> and match_cars = #{matchCars}</if>
<if test="parkInfo != null and parkInfo != ''"> and park_info = #{parkInfo}</if>
<if test="parkOwner != null and parkOwner != ''"> and park_owner = #{parkOwner}</if>
<if test="parkManager != null and parkManager != ''"> and park_manager = #{parkManager}</if>
<if test="openAllDay != null and openAllDay != ''"> and open_all_day = #{openAllDay}</if>
<if test="businessHours != null and businessHours != ''">
and business_hours = #{businessHours}</if>
<if test="parkFree != null and parkFree != ''"> and park_free = #{parkFree}</if>
<if test="payment != null and payment != ''"> and payment = #{payment}</if>
<if test="supportOrder != null and supportOrder != ''"> and support_order = #{supportOrder}</if>
<if test="publicFlag != null and publicFlag != ''"> and public_flag = #{publicFlag}</if>
<if test="aMapFlag != null and aMapFlag != ''"> and amap_flag = #{aMapFlag}</if>
<if test="openFlag != null and openFlag != ''"> and open_flag = #{openFlag}</if>
<if test="toiletFlag != null and toiletFlag != ''"> and toilet_flag = #{toiletFlag}</if>
<if test="storeFlag != null and storeFlag != ''"> and store_flag = #{storeFlag}</if>
<if test="restaurantFlag != null and restaurantFlag != ''"> and restaurant_flag = #{restaurantFlag}</if>
<if test="loungeFlag != null and loungeFlag != ''"> and lounge_flag = #{loungeFlag}</if>
<if test="canopyFlag != null and canopyFlag != ''"> and canopy_flag = #{canopyFlag}</if>
<if test="printerFlag != null and printerFlag != ''"> and printer_flag = #{printerFlag}</if>
<if test="barrierFlag != null and barrierFlag != ''"> and barrier_flag = #{barrierFlag}</if>
<if test="parkingLockFlag != null and parkingLockFlag != ''"> and parking_lock_flag = #{parkingLockFlag}</if>
</where>
</select>
<select id="selectPileStationInfoById" parameterType="Long" resultMap="PileStationInfoResult">
<include refid="selectPileStationInfoVo"/>
where id = #{id}
</select>
<insert id="insertPileStationInfo" parameterType="com.jsowell.pile.domain.PileStationInfo">
insert into pile_station_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="merchantId != null">merchant_id,</if>
<if test="stationName != null">station_name,</if>
<if test="deptId != null">dept_id,</if>
<if test="parkingId != null">parking_id,</if>
<if test="qrcodePrefix != null">qrcode_prefix,</if>
<if test="aloneApply != null">alone_apply,</if>
<if test="accountNumber != null">account_number,</if>
<if test="capacity != null">capacity,</if>
<if test="publicParking != null">public_parking,</if>
<if test="parkingNumber != null">parking_number,</if>
<if test="parkFeeDescribe != null">park_fee_describe,</if>
<if test="countryCode != null">country_code,</if>
<if test="areaCode != null">area_code,</if>
<if test="address != null">address,</if>
<if test="stationTel != null">station_tel,</if>
<if test="serviceTel != null">service_tel,</if>
<if test="stationType != null">station_type,</if>
<if test="stationStatus != null">station_status,</if>
<if test="stationAdminName != null">station_admin_name,</if>
<if test="parkNums != null">park_nums,</if>
<if test="stationLng != null">station_lng,</if>
<if test="stationLat != null">station_lat,</if>
<if test="siteGuide != null">site_guide,</if>
<if test="operatorName != null">operator_name,</if>
<if test="aMapStationName != null">amap_station_name,</if>
<if test="construction != null">construction,</if>
<if test="pictures != null">pictures,</if>
<if test="matchCars != null">match_cars,</if>
<if test="parkInfo != null">park_info,</if>
<if test="parkOwner != null">park_owner,</if>
<if test="parkManager != null">park_manager,</if>
<if test="openAllDay != null">open_all_day,</if>
<if test="businessHours != null">business_hours,</if>
<if test="parkFree != null">park_free,</if>
<if test="payment != null">payment,</if>
<if test="supportOrder != null">support_order,</if>
<if test="remark != null">remark,</if>
<if test="publicFlag != null">public_flag,</if>
<if test="aMapFlag != null">amap_flag,</if>
<if test="openFlag != null">open_flag,</if>
<if test="toiletFlag != null">toilet_flag,</if>
<if test="storeFlag != null">store_flag,</if>
<if test="restaurantFlag != null">restaurant_flag,</if>
<if test="loungeFlag != null">lounge_flag,</if>
<if test="canopyFlag != null">canopy_flag,</if>
<if test="printerFlag != null">printer_flag,</if>
<if test="barrierFlag != null">barrier_flag,</if>
<if test="parkingLockFlag != null">parking_lock_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="merchantId != null">#{merchantId},</if>
<if test="stationName != null">#{stationName},</if>
<if test="deptId != null">#{deptId},</if>
<if test="parkingId != null">#{parkingId},</if>
<if test="qrcodePrefix != null">#{qrcodePrefix},</if>
<if test="aloneApply != null">#{aloneApply},</if>
<if test="accountNumber != null">#{accountNumber},</if>
<if test="capacity != null">#{capacity},</if>
<if test="publicParking != null">#{publicParking},</if>
<if test="parkingNumber != null">#{parkingNumber},</if>
<if test="parkFeeDescribe != null">#{parkFeeDescribe},</if>
<if test="countryCode != null">#{countryCode},</if>
<if test="areaCode != null">#{areaCode},</if>
<if test="address != null">#{address},</if>
<if test="stationTel != null">#{stationTel},</if>
<if test="serviceTel != null">#{serviceTel},</if>
<if test="stationType != null">#{stationType},</if>
<if test="stationStatus != null">#{stationStatus},</if>
<if test="stationAdminName != null">#{stationAdminName},</if>
<if test="parkNums != null">#{parkNums},</if>
<if test="stationLng != null">#{stationLng},</if>
<if test="stationLat != null">#{stationLat},</if>
<if test="siteGuide != null">#{siteGuide},</if>
<if test="operatorName != null">#{operatorName},</if>
<if test="aMapStationName != null">#{aMapStationName},</if>
<if test="construction != null">#{construction},</if>
<if test="pictures != null">#{pictures},</if>
<if test="matchCars != null">#{matchCars},</if>
<if test="parkInfo != null">#{parkInfo},</if>
<if test="parkOwner != null">#{parkOwner},</if>
<if test="parkManager != null">#{parkManager},</if>
<if test="openAllDay != null">#{openAllDay},</if>
<if test="businessHours != null">#{businessHours},</if>
<if test="parkFree != null">#{parkFree},</if>
<if test="payment != null">#{payment},</if>
<if test="supportOrder != null">#{supportOrder},</if>
<if test="remark != null">#{remark},</if>
<if test="publicFlag != null">#{publicFlag},</if>
<if test="aMapFlag != null">#{aMapFlag},</if>
<if test="openFlag != null">#{openFlag},</if>
<if test="toiletFlag != null">#{toiletFlag},</if>
<if test="storeFlag != null">#{storeFlag},</if>
<if test="restaurantFlag != null">#{restaurantFlag},</if>
<if test="loungeFlag != null">#{loungeFlag},</if>
<if test="canopyFlag != null">#{canopyFlag},</if>
<if test="printerFlag != null">#{printerFlag},</if>
<if test="barrierFlag != null">#{barrierFlag},</if>
<if test="parkingLockFlag != null">#{parkingLockFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updatePileStationInfo" parameterType="com.jsowell.pile.domain.PileStationInfo">
update pile_station_info
<trim prefix="SET" suffixOverrides=",">
<if test="merchantId != null">merchant_id = #{merchantId},</if>
<if test="stationName != null">station_name = #{stationName},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="parkingId != null">parking_id = #{parkingId},</if>
<if test="qrcodePrefix != null">qrcode_prefix = #{qrcodePrefix},</if>
<if test="aloneApply != null">alone_apply = #{aloneApply},</if>
<if test="accountNumber != null">account_number = #{accountNumber},</if>
<if test="capacity != null">capacity = #{capacity},</if>
<if test="publicParking != null">public_parking = #{publicParking},</if>
<if test="parkingNumber != null">parking_number = #{parkingNumber},</if>
<if test="parkFeeDescribe != null">park_fee_describe = #{parkFeeDescribe},</if>
<if test="countryCode != null">country_code = #{countryCode},</if>
<if test="areaCode != null">area_code = #{areaCode},</if>
<if test="address != null">address = #{address},</if>
<if test="stationTel != null">station_tel = #{stationTel},</if>
<if test="serviceTel != null">service_tel = #{serviceTel},</if>
<if test="stationType != null">station_type = #{stationType},</if>
<if test="stationStatus != null">station_status = #{stationStatus},</if>
<if test="stationAdminName != null">station_admin_name = #{stationAdminName},</if>
<if test="parkNums != null">park_nums = #{parkNums},</if>
<if test="stationLng != null">station_lng = #{stationLng},</if>
<if test="stationLat != null">station_lat = #{stationLat},</if>
<if test="siteGuide != null">site_guide = #{siteGuide},</if>
<if test="operatorName != null">operator_name = #{operatorName},</if>
<if test="aMapStationName != null">amap_station_name = #{aMapStationName},</if>
<if test="construction != null">construction = #{construction},</if>
<if test="pictures != null">pictures = #{pictures},</if>
<if test="matchCars != null">match_cars = #{matchCars},</if>
<if test="parkInfo != null">park_info = #{parkInfo},</if>
<if test="parkOwner != null">park_owner = #{parkOwner},</if>
<if test="parkManager != null">park_manager = #{parkManager},</if>
<if test="openAllDay != null">open_all_day = #{openAllDay},</if>
<if test="businessHours != null">business_hours = #{businessHours},</if>
<if test="parkFree != null">park_free = #{parkFree},</if>
<if test="payment != null">payment = #{payment},</if>
<if test="supportOrder != null">support_order = #{supportOrder},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="publicFlag != null">public_flag = #{publicFlag},</if>
<if test="aMapFlag != null">amap_flag = #{aMapFlag},</if>
<if test="openFlag != null">open_flag = #{openFlag},</if>
<if test="toiletFlag != null">toilet_flag = #{toiletFlag},</if>
<if test="storeFlag != null">store_flag = #{storeFlag},</if>
<if test="restaurantFlag != null">restaurant_flag = #{restaurantFlag},</if>
<if test="loungeFlag != null">lounge_flag = #{loungeFlag},</if>
<if test="canopyFlag != null">canopy_flag = #{canopyFlag},</if>
<if test="printerFlag != null">printer_flag = #{printerFlag},</if>
<if test="barrierFlag != null">barrier_flag = #{barrierFlag},</if>
<if test="parkingLockFlag != null">parking_lock_flag = #{parkingLockFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<select id="queryStationInfos" parameterType="com.jsowell.pile.dto.QueryStationDTO" resultType="com.jsowell.pile.vo.web.PileStationVO">
SELECT
t1.id as id,
t1.dept_id as deptId,
t1.parking_id as parkingId,
t1.station_name as stationName,
count(t2.id) as pileNum,
t1.area_code as areaCode,
t1.address as address,
t1.qrcode_prefix as qrcodePrefix,
t1.station_type as stationType,
t1.station_status as stationStatus,
t1.create_time as createTime,
t1.pictures as pictures,
t1.park_fee_describe as parkFeeDescribe,
t2.merchant_id as merchantId,
t3.merchant_name as merchantName,
t1.station_admin_name as stationAdminName,
t3.manager_name as merchantAdminName,
t3.manager_phone as managerPhone,
t1.station_tel as stationTel,
t1.match_cars as matchCars,
t1.station_lng as stationLng,
t1.station_lat as stationLat,
<if test="stationDTO.stationLng != null and stationDTO.stationLng != ''">
st_distance_sphere (POINT (#{stationDTO.stationLng} , #{stationDTO.stationLat}),POINT ( t1.station_lng, t1.station_lat )) distance,
IF(t1.station_lng IS NULL OR t1.station_lat IS NULL, 1, 0) AS is_missing,
</if>
t1.construction,
t1.business_hours as businessHours,
t3.organization_code as organizationCode,
t1.public_flag as publicFlag,
t1.amap_flag as aMapFlag,
t1.open_flag as openFlag
FROM
pile_station_info t1
left JOIN pile_basic_info t2 ON t1.id = t2.station_id and t2.del_flag = '0'
left JOIN pile_merchant_info t3 ON t3.id = t1.merchant_id and t3.del_flag = '0'
left join pile_model_info t4 on t2.model_id = t4.id and t2.del_flag = '0'
where
t1.del_flag = '0'
<if test="stationDTO.chargeMode != null and stationDTO.chargeMode != ''">
and t4.speed_type = #{stationDTO.chargeMode,jdbcType=VARCHAR}
</if>
<if test="stationDTO.startPower != null and stationDTO.startPower != '' and stationDTO.endPower != null and stationDTO.endPower != ''">
and t4.rated_power between #{stationDTO.startPower,jdbcType=VARCHAR} and #{stationDTO.endPower,jdbcType=VARCHAR}
</if>
<if test="stationDTO.stationName != null and stationDTO.stationName != ''">
and t1.station_name LIKE '%${stationDTO.stationName}%'
</if>
<if test="stationDTO.stationAddress != null and stationDTO.stationAddress != ''">
and t1.address LIKE '%${stationDTO.stationAddress}%'
</if>
<if test="stationDTO.areaCode != null and stationDTO.areaCode != ''">
and t1.area_code LIKE '%${stationDTO.areaCode}%'
</if>
<if test="stationDTO.publicFlag != null and stationDTO.publicFlag != ''">
and t1.public_flag = #{stationDTO.publicFlag,jdbcType=VARCHAR}
</if>
<if test="stationDTO.merchantId != null and stationDTO.merchantId != ''">
and t1.merchant_id = #{stationDTO.merchantId,jdbcType=VARCHAR}
</if>
<if test="stationDTO.stationAdminName != null and stationDTO.stationAdminName != ''">
and t1.station_admin_name = #{stationDTO.stationAdminName,jdbcType=VARCHAR}
</if>
<if test="stationDTO.address != null and stationDTO.address != ''">
and t1.address like concat('%', #{stationDTO.address,jdbcType=VARCHAR}, '%')
</if>
<if test="stationDTO.canopyFlag != null and stationDTO.canopyFlag != ''">
and t1.canopy_flag = #{stationDTO.canopyFlag,jdbcType=VARCHAR}
</if>
<if test="stationDTO.barrierFlag != null and stationDTO.barrierFlag != ''">
and t1.barrier_flag = #{stationDTO.barrierFlag,jdbcType=VARCHAR}
</if>
<if test="stationDTO.stationTel != null and stationDTO.stationTel != ''">
and t1.station_tel = #{stationDTO.stationTel,jdbcType=VARCHAR}
</if>
<if test="stationDTO.parkingLockFlag != null and stationDTO.parkingLockFlag != ''">
and t1.parking_lock_flag = #{stationDTO.parkingLockFlag,jdbcType=VARCHAR}
</if>
<!-- 数据范围过滤 -->
<if test="stationDTO.merchantDeptIds != null and stationDTO.merchantDeptIds.size() != 0">
and t3.dept_id in
<foreach collection="stationDTO.merchantDeptIds" item="merchantDeptId" open="(" separator="," close=")">
#{merchantDeptId}
</foreach>
</if>
<if test="stationDTO.stationDeptIds != null and stationDTO.stationDeptIds.size() != 0">
and t1.dept_id in
<foreach collection="stationDTO.stationDeptIds" item="stationDeptId" open="(" separator="," close=")">
#{stationDeptId}
</foreach>
</if>
<if test="stationDTO.stationIds != null and stationDTO.stationIds.size() != 0">
and t1.id in
<foreach collection="stationDTO.stationIds" item="stationId" open="(" separator="," close=")">
#{stationId}
</foreach>
</if>
GROUP BY
t1.id,
t1.station_name,
t1.area_code,
t1.address,
t1.station_type,
t1.station_status,
t1.create_time,
t1.pictures,
t2.merchant_id,
t3.merchant_name,
t3.manager_name,
t1.station_tel,
t1.match_cars,
t1.station_lng,
t1.station_lat,
t1.construction,
t1.business_hours,
t3.organization_code,
t1.public_flag,
t1.open_flag
<if test="stationDTO.stationLng != null and stationDTO.stationLng != ''">
ORDER BY
is_missing ASC,
distance ASC
</if>
</select>
<delete id="deletePileStationInfoByIds" parameterType="String">
delete from pile_station_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectStationListByMerchantId" resultMap="PileStationInfoResult">
<include refid="selectPileStationInfoVo"/>
where merchant_id = #{merchantId}
and del_flag = '0'
</select>
<select id="getStationInfoForThirdParty" resultType="com.jsowell.pile.vo.base.ThirdPartyStationInfoVO">
SELECT
t1.id,
t1.merchant_id AS merchantId,
t2.merchant_name AS merchantName,
t2.organization_code AS organizationCode,
t1.station_name AS stationName,
t1.dept_id AS deptId,
t1.parking_id AS parkingId,
t1.qrcode_prefix AS qrcodePrefix,
t1.alone_apply AS aloneApply,
t1.account_number AS accountNumber,
t1.capacity AS capacity,
t1.public_parking AS publicParking,
t1.parking_number AS parkingNumber,
t1.park_fee_describe AS parkFeeDescribe,
t1.country_code AS countryCode,
t1.area_code AS areaCode,
t1.address AS address,
t1.station_tel AS stationTel,
t1.service_tel AS serviceTel,
t1.station_type AS stationType,
t1.station_status AS stationStatus,
t1.station_admin_name AS stationAdminName,
t1.park_nums AS parkNums,
t1.station_lng AS stationLng,
t1.station_lat AS stationLat,
t1.site_guide AS siteGuide,
t1.construction AS construction,
t1.pictures AS pictures,
t1.match_cars AS matchCars,
t1.park_info AS parkInfo,
t1.park_owner AS parkOwner,
t1.park_manager AS parkManager,
t1.open_all_day AS openAllDay,
t1.business_hours AS businessHours,
t1.park_free AS parkFree,
t1.payment AS payment,
t1.support_order AS supportOrder,
t1.remark AS remark,
t1.public_flag AS publicFlag,
t1.amap_flag AS amapFlag,
t1.open_flag AS openFlag,
t1.toilet_flag AS toiletFlag,
t1.store_flag AS storeFlag,
t1.restaurant_flag AS restaurantFlag,
t1.lounge_flag AS loungeFlag,
t1.canopy_flag AS canopyFlag,
t1.printer_flag AS printerFlag,
t1.barrier_flag AS barrierFlag,
t1.parking_lock_flag AS parkingLockFlag,
t1.create_by AS createBy,
t1.create_time AS createTime,
t1.update_by AS updateBy,
t1.update_time AS updateTime,
t1.del_flag AS delFlag
FROM
pile_station_info t1
JOIN pile_merchant_info t2 ON t1.merchant_id = t2.id
AND t1.del_flag = '0'
and t1.public_flag = '1'
<if test="dto.address != null and dto.address != ''">
and t1.address like concat('%', #{dto.address}, '%')
</if>
<if test="dto.stationIds != null and dto.stationIds.size() != 0">
and t1.id in
<foreach collection="dto.stationIds" item="stationId" open="(" separator="," close=")">
#{stationId,jdbcType=VARCHAR}
</foreach>
</if>
</select>
<select id="selectStationInfoForThirdParty" resultType="com.jsowell.pile.vo.base.ThirdPartyStationInfoVO">
SELECT
t1.id,
t1.merchant_id AS merchantId,
t2.merchant_name AS merchantName,
t2.organization_code AS organizationCode,
t1.station_name AS stationName,
t1.dept_id AS deptId,
t1.parking_id AS parkingId,
t1.qrcode_prefix AS qrcodePrefix,
t1.alone_apply AS aloneApply,
t1.account_number AS accountNumber,
t1.capacity AS capacity,
t1.public_parking AS publicParking,
t1.parking_number AS parkingNumber,
t1.park_fee_describe AS parkFeeDescribe,
t1.country_code AS countryCode,
t1.area_code AS areaCode,
t1.address AS address,
t1.station_tel AS stationTel,
t1.service_tel AS serviceTel,
t1.station_type AS stationType,
t1.station_status AS stationStatus,
t1.station_admin_name AS stationAdminName,
t1.park_nums AS parkNums,
t1.station_lng AS stationLng,
t1.station_lat AS stationLat,
t1.site_guide AS siteGuide,
t1.construction AS construction,
t1.pictures AS pictures,
t1.match_cars AS matchCars,
t1.park_info AS parkInfo,
t1.park_owner AS parkOwner,
t1.park_manager AS parkManager,
t1.open_all_day AS openAllDay,
t1.business_hours AS businessHours,
t1.park_free AS parkFree,
t1.payment AS payment,
t1.support_order AS supportOrder,
t1.remark AS remark,
t1.public_flag AS publicFlag,
t1.amap_flag AS amapFlag,
t1.open_flag AS openFlag,
t1.toilet_flag AS toiletFlag,
t1.store_flag AS storeFlag,
t1.restaurant_flag AS restaurantFlag,
t1.lounge_flag AS loungeFlag,
t1.canopy_flag AS canopyFlag,
t1.printer_flag AS printerFlag,
t1.barrier_flag AS barrierFlag,
t1.parking_lock_flag AS parkingLockFlag,
t1.create_by AS createBy,
t1.create_time AS createTime,
t1.update_by AS updateBy,
t1.update_time AS updateTime,
t1.del_flag AS delFlag
FROM
pile_station_info t1
JOIN pile_merchant_info t2 ON t1.merchant_id = t2.id
join thirdparty_station_relation t3 on t3.station_id = t1.id
AND t1.del_flag = '0'
and t1.public_flag = '1'
<if test="dto.address != null and dto.address != ''">
and t1.address like concat('%', #{dto.address}, '%')
</if>
<if test="dto.stationIds != null and dto.stationIds.size() != 0">
and t1.id in
<foreach collection="dto.stationIds" item="stationId" open="(" separator="," close=")">
#{stationId,jdbcType=VARCHAR}
</foreach>
</if>
<if test="dto.thirdPlatformType != null and dto.thirdPlatformType != ''">
and t3.third_party_type = #{dto.thirdPlatformType,jdbcType=VARCHAR}
</if>
</select>
<select id="queryByStationDeptIds" resultType="java.lang.String">
select id
from pile_station_info
where del_flag = '0'
and dept_id in
<foreach collection="stationDeptIds" item="item" open="(" separator="," close=")">
#{item,jdbcType=VARCHAR}
</foreach>
</select>
<update id="updateAmapFlag">
update
pile_station_info
set
amap_flag = #{amapFlag,jdbcType=VARCHAR}
where
id = #{stationId,jdbcType=VARCHAR}
</update>
<select id="getIdsByDeptId" resultType="java.lang.String">
select
id
from
pile_station_info
where
dept_id = #{deptId,jdbcType=VARCHAR}
</select>
<update id="updateParkingPlatform">
update
pile_station_info
set
parking_id = #{parkingId,jdbcType=VARCHAR}
where
id = #{stationId,jdbcType=VARCHAR}
</update>
<select id="getStationSelectList" resultType="com.jsowell.pile.vo.web.PileStationVO">
select
t1.id,
t1.station_name as stationName
from pile_station_info t1
left join pile_merchant_info t2 on t2.id = t1.merchant_id and t2.del_flag = '0'
where t1.del_flag = '0'
<!-- 数据范围过滤 -->
<if test="dto.merchantDeptIds != null and dto.merchantDeptIds.size() != 0">
and t2.dept_id in
<foreach collection="dto.merchantDeptIds" item="merchantDeptId" open="(" separator="," close=")">
#{merchantDeptId}
</foreach>
</if>
<if test="dto.stationDeptIds != null and dto.stationDeptIds.size() != 0">
and t1.dept_id in
<foreach collection="dto.stationDeptIds" item="stationDeptId" open="(" separator="," close=")">
#{stationDeptId}
</foreach>
</if>
</select>
<select id="getStationInfoForAmap" resultMap="PileStationInfoResult">
<include refid="selectPileStationInfoVo"/>
where
del_flag = '0'
and public_flag = '1'
and amap_flag = '1'
<if test="dto.idList != null and dto.idList.size() != 0">
and id in
<foreach collection="dto.idList" item="id" open="(" separator="," close=")">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
</select>
<select id="NXJTQueryStationsInfo" resultType="com.jsowell.pile.vo.ningxiajiaotou.NXJTStationInfoVO">
SELECT
id AS stationId,
station_name AS stationName,
address,
station_lng AS stationLng,
station_lat AS stationLat,
support_order AS supportOrder
FROM
pile_station_info
where del_flag = '0'
and open_flag = '1'
and public_flag = '1'
<if test="dto.stationId != null and dto.stationId != ''">
and id = #{dto.stationId,jdbcType=VARCHAR}
</if>
</select>
<select id="queryInfoByDeptId" resultMap="PileStationInfoResult">
select
<include refid="Base_Column_List"/>
from pile_station_info
where del_flag = '0'
and dept_id = #{deptId,jdbcType=VARCHAR}
</select>
<select id="getStationInfosByMerchantIds" resultMap="PileStationInfoResult">
<include refid="selectPileStationInfoVo"/>
<if test="list != null and list.size() != 0">
where merchant_id in
<foreach collection="list" item="merchantId" open="(" separator="," close=")">
#{merchantId,jdbcType=VARCHAR}
</foreach>
</if>
</select>
<select id="queryUserFrequentedStation" resultType="com.jsowell.pile.domain.UserFrequentedStationInfo">
SELECT
t1.station_id AS stationId,
t2.station_name AS stationName,
COUNT(t1.id) AS chargeNum
FROM
order_basic_info t1
JOIN
pile_station_info t2 ON t1.station_id = t2.id
WHERE
t1.member_id = #{memberId}
AND t1.create_time BETWEEN #{startTime} AND #{endTime}
GROUP BY
t1.station_id, t2.station_name
ORDER BY
chargeNum DESC;
</select>
</mapper>