Files
jsowell-charger-web/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml
2023-08-23 10:59:22 +08:00

419 lines
24 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="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="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="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="selectPileStationInfoVo">
select id,merchant_id, station_name, dept_id, qrcode_prefix, alone_apply, account_number, capacity, public_parking, parking_number,
country_code, area_code, address, station_tel, service_tel, station_type, station_status, station_admin_name, park_nums,
station_lng, station_lat, site_guide, 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
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="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="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="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="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="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="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="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="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="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="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="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="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>
<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="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.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,
t2.merchant_id as merchantId,
t3.merchant_name as merchantName,
t3.manager_name as merchantAdminName,
t1.station_tel as stationTel,
t1.match_cars as matchCars,
t1.station_lng as stationLng,
t1.station_lat as stationLat,
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'
where
t1.del_flag = '0'
<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.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>
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
</select>
<select id="selectStationListByMerchantId" resultMap="PileStationInfoResult">
<include refid="selectPileStationInfoVo"/>
where merchant_id = #{merchantId}
and del_flag = '0'
</select>
<select id="getStationInfoForLianLian" resultMap="PileStationInfoResult">
<include refid="selectPileStationInfoVo"/>
where del_flag = '0'
and public_flag = '1'
and amap_flag = '1'
</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>
</mapper>