TdPParkingShareSMapper.xml 14 KB
<?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.zteits.park.mapper.smapper.TdPParkingShareSMapper">


    <resultMap id="ParkingShareOrderTempResultMap" type="com.zteits.clouds.api.dto.pay.sharesettlement.dto.ParkingShareOrderTempDTO">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="order_id" property="orderId" jdbcType="VARCHAR"/>
        <result column="ps_pre_in_time" property="psPreInTime" jdbcType="TIMESTAMP"/>
        <result column="ps_pre_out_time" property="psPreOutTime" jdbcType="TIMESTAMP"/>
        <result column="ps_in_time" property="psInTime" jdbcType="TIMESTAMP"/>
        <result column="ps_out_time" property="psOutTime" jdbcType="TIMESTAMP"/>
        <result column="ps_service_cust_id" property="psServiceCustId" jdbcType="VARCHAR"/>
        <result column="ps_service_tel" property="psServiceTel" jdbcType="VARCHAR"/>
        <result column="ps_service_name" property="psServiceName" jdbcType="VARCHAR"/>
        <result column="pay_status" property="payStatus" jdbcType="CHAR"/>
        <result column="account_type" property="accountType" jdbcType="INTEGER"/>
        <result column="pl_name" property="plName" jdbcType="VARCHAR"/>
        <result column="pl_no" property="plNo" jdbcType="VARCHAR"/>
        <result column="ps_berth_no" property="psBerthNo" jdbcType="VARCHAR"/>
        <result column="act_payed_fee" property="actPayedFee" jdbcType="DECIMAL"/>
        <result column="payed_fee" property="payedFee" jdbcType="DECIMAL"/>
        <result column="not_pay_fee" property="notPayFee" jdbcType="DECIMAL"/>
        <result column="total_fee" property="totalFee" jdbcType="DECIMAL"/>
        <result column="refunded_fee" property="refundedFee" jdbcType="DECIMAL"/>
        <result column="create_emp_id" property="createEmpId" jdbcType="VARCHAR"/>
        <result column="create_emp_name" property="createEmpName" jdbcType="VARCHAR"/>
        <result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
        <result column="modfiy_empid" property="modfiyEmpid" jdbcType="VARCHAR"/>
        <result column="modfiy_empid_name" property="modfiyEmpidName" jdbcType="VARCHAR"/>
        <result column="modfiy_date" property="modfiyDate" jdbcType="TIMESTAMP"/>
        <result column="remark" property="remark" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="ParkingShareOrderTemp_Column_List">
        id, order_id, ps_pre_in_time, ps_pre_out_time, ps_in_time, ps_out_time, ps_service_cust_id,
        ps_service_tel, ps_service_name, pay_status, account_type, pl_name, pl_no, ps_berth_no,
        act_payed_fee, payed_fee, not_pay_fee, total_fee, refunded_fee, create_emp_id, create_emp_name,
        create_date, modfiy_empid, modfiy_empid_name, modfiy_date, remark
    </sql>

    <resultMap id="BaseResultMap" type="com.zteits.park.domain.TdPParkingShare">
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="pl_name" jdbcType="VARCHAR" property="plName" />
        <result column="pl_no" jdbcType="VARCHAR" property="plNo" />
        <result column="pl_province_id" jdbcType="BIGINT" property="plProvinceId" />
        <result column="pl_province_name" jdbcType="VARCHAR" property="plProvinceName" />
        <result column="pl_city_id" jdbcType="BIGINT" property="plCityId" />
        <result column="pl_city_name" jdbcType="VARCHAR" property="plCityName" />
        <result column="pl_country_id" jdbcType="BIGINT" property="plCountryId" />
        <result column="pl_country_name" jdbcType="VARCHAR" property="plCountryName" />
        <result column="source_type" jdbcType="INTEGER" property="sourceType" />
        <result column="ps_lock_bind_no" jdbcType="VARCHAR" property="psLockBindNo" />
        <result column="ps_lock_state" jdbcType="CHAR" property="psLockState" />
        <result column="ps_lock_no" jdbcType="VARCHAR" property="psLockNo" />
        <result column="ps_rate" jdbcType="VARCHAR" property="psRate" />
        <result column="ps_service_cust_id" jdbcType="VARCHAR" property="psServiceCustId" />
        <result column="ps_service_tel" jdbcType="VARCHAR" property="psServiceTel" />
        <result column="ps_service_name" jdbcType="VARCHAR" property="psServiceName" />
        <result column="ps_picture_path" jdbcType="VARCHAR" property="psPicturePath" />
        <result column="ps_address" jdbcType="VARCHAR" property="psAddress" />
        <result column="ps_pay_type" jdbcType="INTEGER" property="psPayType" />
        <result column="ps_busi_time_start" jdbcType="TIMESTAMP" property="psBusiTimeStart" />
        <result column="ps_busi_time_end" jdbcType="TIMESTAMP" property="psBusiTimeEnd" />
        <result column="frequency_type" jdbcType="INTEGER" property="frequencyType" />
        <result column="valid_start_time" jdbcType="TIME" property="validStartTime" />
        <result column="valid_end_time" jdbcType="TIME" property="validEndTime" />
        <result column="custom_frequency" jdbcType="VARCHAR" property="customFrequency" />
        <result column="ps_order_id" jdbcType="VARCHAR" property="psOrderId" />
        <result column="ps_pre_create_time" jdbcType="TIMESTAMP" property="psPreCreateTime" />
        <result column="ps_pre_in_time" jdbcType="TIMESTAMP" property="psPreInTime" />
        <result column="ps_pre_out_time" jdbcType="TIMESTAMP" property="psPreOutTime" />
        <result column="ps_in_time" jdbcType="TIMESTAMP" property="psInTime" />
        <result column="ps_rent_car_number" jdbcType="VARCHAR" property="psRentCarNumber" />
        <result column="ps_rent_cust_id" jdbcType="VARCHAR" property="psRentCustId" />
        <result column="ps_pre_act_fee" jdbcType="BIGINT" property="psPreActFee" />
        <result column="ps_rent_duration" jdbcType="BIGINT" property="psRentDuration" />
        <result column="ps_is_occupy" jdbcType="CHAR" property="psIsOccupy" />
        <result column="ps_is_rent" jdbcType="CHAR" property="psIsRent" />
        <result column="ps_source_type" jdbcType="INTEGER" property="psSourceType" />
        <result column="ps_berth_no" jdbcType="VARCHAR" property="psBerthNo" />
        <result column="ps_road_position" jdbcType="CHAR" property="psRoadPosition" />
        <result column="ps_direction" jdbcType="CHAR" property="psDirection" />
        <result column="ps_park_type" jdbcType="CHAR" property="psParkType" />
        <result column="ps_lon_id" jdbcType="DECIMAL" property="psLonId" />
        <result column="ps_lat_id" jdbcType="DECIMAL" property="psLatId" />
        <result column="ps_berth_address" jdbcType="VARCHAR" property="psBerthAddress" />
        <result column="ps_examine_state" jdbcType="CHAR" property="psExamineState" />
        <result column="ps_remark" jdbcType="VARCHAR" property="psRemark" />
        <result column="data_status" jdbcType="INTEGER" property="dataStatus" />
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
        <result column="create_op" jdbcType="VARCHAR" property="createOp" />
        <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
        <result column="modify_op" jdbcType="VARCHAR" property="modifyOp" />
        <result column="org_id" jdbcType="BIGINT" property="orgId" />
        <result column="org_name" jdbcType="VARCHAR" property="orgName" />
    </resultMap>
    <sql id="Base_Column_List">
        id, pl_name, pl_no, pl_province_id, pl_province_name, pl_city_id, pl_city_name, pl_country_id,
        pl_country_name, source_type, ps_lock_bind_no, ps_lock_state, ps_lock_no, ps_rate,
        ps_service_cust_id, ps_service_tel, ps_service_name, ps_picture_path, ps_address,
        ps_pay_type, ps_busi_time_start, ps_busi_time_end, frequency_type, valid_start_time,
        valid_end_time, custom_frequency, ps_order_id, ps_pre_create_time, ps_pre_in_time,
        ps_pre_out_time, ps_in_time, ps_rent_car_number, ps_rent_cust_id, ps_pre_act_fee,
        ps_rent_duration, ps_is_occupy, ps_is_rent, ps_source_type, ps_berth_no, ps_road_position,
        ps_direction, ps_park_type, ps_lon_id, ps_lat_id, ps_berth_address, ps_examine_state,
        ps_remark, data_status, create_time, create_op, modify_time, modify_op, org_id, org_name
    </sql>
    <select id="queryShareBerthUsedList" parameterType="com.zteits.clouds.api.dto.park.param.TdPParkingShareRequest"
            resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from td_p_parking_share 	
        where 1=1 and ps_examine_state = 2 and ps_is_rent = 1
        and case when frequency_type = 5 and FIND_IN_SET(DAYOFWEEK(#{queryDate}),custom_frequency) > 0 
		then CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_start_time) &lt; DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
		and CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_end_time) > DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
		when frequency_type = 4 then CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_start_time) &lt; DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
		and CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_end_time) > DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
		when frequency_type = 3 and 1 = #{isHoliday} 
		then CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_start_time) &lt; DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
		and CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_end_time) > DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
		when frequency_type = 2 and  FIND_IN_SET(DAYOFWEEK(#{queryDate}),'2,3,4,5,6')  > 0 
		then CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_start_time) &lt; DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
		and CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_end_time) > DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
		when frequency_type = 1 then DATE_FORMAT(ps_busi_time_start,'%Y-%m-%d %H:%i:%s') &lt; DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
		and DATE_FORMAT(ps_busi_time_end,'%Y-%m-%d %H:%i:%s') > DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')  end 
        <if test="plNo != null">
            and pl_no = #{plNo,jdbcType=VARCHAR}
        </if>
        <if test="psBerthNo != null">
            and ps_berth_no = #{psBerthNo}
        </if>
        <if test="orgId != null">
            and org_id = #{orgId}
        </if>
        <if test="psRentCarNumber != null">
            and ps_rent_car_number = #{psRentCarNumber,jdbcType=VARCHAR}
        </if>
        <if test="nameOrAddress !=null and nameOrAddress !=''">
            AND (pl_name like concat('%',#{nameOrAddress},'%') OR ps_address like concat('%',#{nameOrAddress},'%')
            OR ps_berth_address like concat('%',#{nameOrAddress},'%'))
        </if>
    </select>

    <!-- 查询共享车位list -->
    <select id="queryShareBerthList" parameterType="com.zteits.clouds.api.dto.park.param.TdPParkingShareRequest"
            resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from td_p_parking_share
        where  data_status = 1
        <if test="plName != null">
            and pl_name = #{plName,jdbcType=VARCHAR}
        </if>
        <if test="plNo != null">
            and pl_no = #{plNo,jdbcType=VARCHAR}
        </if>
        <if test="plProvinceId != null">
            and pl_province_id = #{plProvinceId,jdbcType=BIGINT}
        </if>
        <if test="plCityId != null">
            and pl_city_id = #{plCityId,jdbcType=BIGINT}
        </if>
        <if test="plCountryId != null">
            and pl_country_id = #{plCountryId,jdbcType=BIGINT}
        </if>
        <if test="sourceType != null">
            and  source_type = #{sourceType,jdbcType=INTEGER}
        </if>
        <if test="psServiceCustId != null">
            and ps_service_cust_id = #{psServiceCustId,jdbcType=VARCHAR}
        </if>
        <if test="psServiceTel != null">
            and ps_service_tel = #{psServiceTel,jdbcType=VARCHAR}
        </if>
        <if test="psOrderId != null">
            and ps_order_id = #{psOrderId,jdbcType=VARCHAR}
        </if>
        <if test="psRentCarNumber != null">
            and ps_rent_car_number = #{psRentCarNumber,jdbcType=VARCHAR}
        </if>
        <if test="psRentCustId != null">
            and ps_rent_cust_id = #{psRentCustId,jdbcType=VARCHAR}
        </if>
        <if test="psIsOccupy != null">
            and ps_is_occupy = #{psIsOccupy,jdbcType=CHAR}
        </if>
        <if test="psIsRent != null">
            and ps_is_rent = #{psIsRent,jdbcType=CHAR}
        </if>
        <if test="psSourceType != null">
            and ps_source_type = #{psSourceType,jdbcType=INTEGER}
        </if>
        <if test="psBerthNo != null">
            and ps_berth_no = #{psBerthNo,jdbcType=VARCHAR}
        </if>
        <if test="psExamineState != null">
            and ps_examine_state = #{psExamineState,jdbcType=CHAR}
        </if>
        <if test="orgId != null">
            and org_id = #{orgId}
        </if>
        order by pl_no,ps_berth_no
    </select>

    <select id="queryParkShareOrderTempInfo" resultMap="ParkingShareOrderTempResultMap"
            parameterType="com.zteits.clouds.api.dto.pay.sharesettlement.param.ParkShareOrderTempInfoQueryRequest">
        SELECT
        m.ps_order_id order_id,
        m.ps_pre_in_time,
        m.ps_pre_out_time,
        m.ps_in_time,
        m.ps_out_time,
        n.ps_service_cust_id,
        n.ps_service_tel,
        n.ps_service_name,
        m.pay_status,
        1 account_type,
        n.pl_name,
        n.pl_no,
        m.ps_berth_no,
        ifnull(m.act_payed_fee, 0) act_payed_fee,
        ifnull(m.payed_fee, 0) payed_fee,
        ifnull(m.not_pay_fee, 0) not_pay_fee,
        ifnull(m.total_fee, 0) total_fee,
        ifnull(m.refunded_fee, 0) refunded_fee,
        -1 create_emp_id,
        '系统' create_emp_name,
        now() create_date,
        -1 modfiy_empid,
        '系统' modfiy_empid_name,
        now() modfiy_date,
        NULL remark
        FROM td_p_parking_share_log m LEFT JOIN td_p_parking_share n
        ON m.ps_berth_no = n.ps_berth_no and m.pl_no = n.pl_no
        WHERE m.data_status = 1
        AND n.data_status = 1
        AND m.ps_out_time &gt;= #{startDate}
        AND m.ps_out_time &lt;= #{endDate}
    </select>
</mapper>