BlackListSMapper.xml 3.35 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.BlackListSMapper">

    <insert id="insertBatch">
        insert into t_black_list (car_number, car_number_color, rule_no, rule_type, car_status, org_id,
        remarks, create_empid, create_time)values
        <foreach collection="records" index="index" item="entity" separator="," open="" close="">
            ( #{entity.carNumber},  #{entity.carNumberColor}, #{entity.ruleNo},
            #{entity.ruleType},  #{entity.carStatus}, #{entity.orgId},
            #{entity.remarks},#{entity.createEmpid}, #{entity.createTime})
        </foreach>
    </insert>

    <!-- 查询获取某个停车场内,某车的黑名单限行配置记录 -->
    <select id="queryBlackCarLimitDTO" resultType="com.zteits.clouds.api.dto.bill.dto.BlackCarLimitDTO">

        select
        c.id as cid,
        c.car_number as carNumber,
        c.car_number_color as carNumberColor,
        c.rule_type as ruleType,
        r.start_time as startTime,
        r.end_time as endTime,
        r.remarks as remarks,
        p.pl_no as plNo

        from t_black_list c

        left join t_black_list_rule r on r.rule_no = c.rule_no
        left join t_black_list_park_rel p on p.rule_no = c.rule_no

        where

        c.car_number = #{carNumber}
        and c.car_status = 2

        <if test="limitType != null">
           and c.rule_type = #{limitType}
        </if>

        and
        c.car_number_color = #{carNumberColor}
        and
        r.rule_state = 2
        and
        r.start_time &lt; NOW()
        and
        r.end_time &gt; NOW()
        <if test="plNo != null and plNo !=''">
            and
            p.pl_no = #{plNo}
        </if>

    </select>

    <!-- 获取黑名单车辆信息列表 -->
    <select id="queryBlackListCarList" resultType="com.zteits.clouds.api.dto.bill.dto.BlackListCarDTO">
        SELECT
            c.id AS id,
            c.car_number AS carNumber,
            c.car_number_color AS carNumberColor,
            c.rule_type AS ruleType,
            r.rule_no as ruleNo,
            c.car_status as carStatus,
            r.rule_name as ruleName,
            DATE_FORMAT(c.create_time, '%Y-%m-%d %H:%i:%S')  as createTime,
            DATE_FORMAT(r.start_time, '%Y-%m-%d %H:%i:%S')  AS startTime,
            DATE_FORMAT(r.end_time, '%Y-%m-%d %H:%i:%S') AS endTime,
            c.remarks AS remarks
        FROM
            t_black_list c
            LEFT JOIN t_black_list_rule r ON r.rule_no = c.rule_no
        WHERE
            c.org_id = #{orgId}
            <if test="carNumber != null and carNumber !=''">
                and c.car_number = #{carNumber}
            </if>
            <if test="carNumberColor != null and carNumberColor !=''">
                and c.car_number_color = #{carNumberColor, jdbcType=INTEGER}
            </if>
            <if test="ruleType != null and ruleType !=''">
                and c.rule_type = #{ruleType, jdbcType=INTEGER}
            </if>
            <if test="carStatus != null and carStatus !=''">
                and c.car_status = #{carStatus, jdbcType=INTEGER}
            </if>
            <if test="ruleNo != null and ruleNo !=''">
                and c.rule_no = #{ruleNo}
            </if>
        order by c.id desc

    </select>
</mapper>