TdClParkRuleCollectRelSMapper.xml 4.7 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.bill.mapper.smapper.TdClParkRuleCollectRelSMapper">

        <resultMap id="BaseResultMap" type="com.zteits.bill.domain.TdClParkRuleCollectRel">
            <id column="id" jdbcType="BIGINT" property="id" />
            <result column="city_id" jdbcType="BIGINT" property="cityId" />
            <result column="pl_no" jdbcType="VARCHAR" property="plNo" />
            <result column="area_id" jdbcType="BIGINT" property="areaId" />
            <result column="rule_collect_id" jdbcType="VARCHAR" property="ruleCollectId" />
            <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
            <result column="pro_id" jdbcType="BIGINT" property="proId" />
            <result column="country_id" jdbcType="BIGINT" property="countryId" />
            <result column="city_name" jdbcType="VARCHAR" property="cityName" />
            <result column="country_name" jdbcType="VARCHAR" property="countryName" />
            <result column="pro_name" jdbcType="VARCHAR" property="proName" />
        </resultMap>

    <select id="queryParkingBindingChargingAreas" parameterType="com.zteits.clouds.api.dto.bill.closecarpark.param.QueryParkingBindingByPlNoRequest"
            resultType="com.zteits.clouds.api.dto.bill.closecarpark.dto.ParkBindChargingAreasDTO">
       SELECT
	    r.pl_no plNo,
        c.rule_collect_name ruleCollectName,
        r.area_id areaId
        FROM
	    td_cl_park_rule_collect_rel r
	    LEFT JOIN td_cl_rule_collect c on r.rule_collect_id = c.rule_collect_id
	    where 1=1
        <if test="plNo != null and plNo !=''">
            and r.pl_no =#{plNo}
        </if>

    </select>

    <select id="viewParkingBindingChargingAreas" parameterType="com.zteits.clouds.api.dto.bill.closecarpark.param.ViewParkingBindingChargingRequest"
            resultType="com.zteits.clouds.api.dto.bill.closecarpark.dto.ViewParkBindChargingDTO">
        SELECT
        r.pl_no plNo,
        c.rule_collect_name ruleCollectName,
        r.area_id areaId,
        c.rule_desc ruleDesc,
        r.rule_collect_id ruleCollectId
        FROM
        td_cl_park_rule_collect_rel r
        LEFT JOIN td_cl_rule_collect c on r.rule_collect_id = c.rule_collect_id
        where r.area_id = #{areaId}

    </select>

    <!-- 查询停车场绑定计费规则 -->
    <select id="queryParkingBindingChargingRules" parameterType="com.zteits.clouds.api.dto.bill.closecarpark.param.QueryParkingBindingChargingRequest"
            resultType="com.zteits.clouds.api.dto.bill.closecarpark.dto.ParkBindChargingDTO">
        select
        r.pro_id proId,
        r.pro_name proName,
        r.country_id countryId,
        r.country_name countryName,
        r.city_id cityId,
        r.city_name cityName,
        r.pl_no plNo,
        r.id,
        r.area_id areaId,
        GROUP_CONCAT(c.rule_collect_name) ruleCollectName,
        c.fee_type feeType
        FROM
        td_cl_park_rule_collect_rel r
        LEFT JOIN td_cl_rule_collect c on r.rule_collect_id = c.rule_collect_id
        where 1=1
        <if test="orgId != null and orgId != ''">
            and c.org_id = #{orgId}
        </if>
        <if test="plNo != null and plNo != ''">
            and r.pl_no = #{plNo}
        </if>
        <if test="proId != null and proId != ''">
            and r.pro_id = #{proId}
        </if>
        <if test="cityId != null and cityId != ''">
            and r.city_id = #{cityId}
        </if>
        <if test="countryId != null and countryId != ''">
            and r.country_id = #{countryId}
        </if>
        <if test="ruleCollectName != null and ruleCollectName != ''">
            AND c.rule_collect_name like concat('%',#{ruleCollectName,jdbcType=VARCHAR},'%')
        </if>
        group by r.pl_no

    </select>

    <select id="queryBindingAreaRulesList" parameterType="com.zteits.clouds.api.dto.bill.closecarpark.param.QueryParkingBindingAreaRequest"
            resultType="com.zteits.clouds.api.dto.bill.closecarpark.dto.ParkBindAreasListDTO">
        select
        r.pro_id proId,
        r.pro_name proName,
        r.country_id countryId,
        r.country_name countryName,
        r.city_id cityId,
        r.city_name cityName,
        r.pl_no plNo,
        r.id,
        r.area_id areaId,
        r.rule_collect_id ruleCollectId,
        c.rule_collect_name ruleCollectName,
        c.fee_type feeType
        FROM
        td_cl_park_rule_collect_rel r
        LEFT JOIN td_cl_rule_collect c on r.rule_collect_id = c.rule_collect_id
        where 1=1

        <if test="plNo != null and plNo != ''">
            AND r.pl_no = #{plNo}
        </if>

    </select>
</mapper>