FakeOfflineVinMapper.xml 2.59 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="cn.com.glsx.app.modules.mapper.FakeOfflineVinMapper">
    <resultMap id="BaseMap" type="cn.com.glsx.app.modules.entity.FakeOfflineVin">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="vin" property="vin" jdbcType="VARCHAR"/>
        <result column="merchant_type" property="merchantType" jdbcType="TINYINT"/>
        <result column="home_addr" property="homeAddr" jdbcType="VARCHAR"/>
        <result column="work_addr" property="workAddr" jdbcType="VARCHAR"/>
        <result column="del_flag" property="delFlag" jdbcType="TINYINT"/>
        <result column="created_date" property="createdDate" jdbcType="TIMESTAMP"/>
        <result column="created_by" property="createdBy" jdbcType="INTEGER"/>
        <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP"/>
        <result column="updated_by" property="updatedBy" jdbcType="INTEGER"/>
    </resultMap>

    <sql id="BaseColumns">
        id
        , vin, merchant_type, home_addr, work_addr, del_flag, created_date, created_by, updated_date, updated_by
    </sql>

    <select id="getFakeOfflineSnList" resultType="java.lang.String">
        select tfofs.sn
        from t_fake_offline_fence_sn tfofs
        left join t_vehicle_device tvd on tvd.sn = tfofs.sn
        where tfofs.del_flag = 0
        and tfofs.status = 1
        and tvd.id in
        <foreach collection="allOfflineDevices" item="itemId" index="index" open="(" close=")" separator=",">
            #{itemId}
        </foreach>
        union
        select tfocf.sn
        from t_fake_offline_change_frequently tfocf
        left join t_vehicle_device tvd on tvd.sn = tfocf.sn
        where tfocf.del_flag = 0
        and tfocf.status = 1
        and tvd.id in
        <foreach collection="allOfflineDevices" item="itemId" index="index" open="(" close=")" separator=",">
            #{itemId}
        </foreach>
        union
        select tws.sn
        from t_whitelist_sn tws
        left join t_vehicle_device tvd on tvd.sn = tws.sn
        where tws.del_flag = 0
        and tvd.id in
        <foreach collection="allOfflineDevices" item="itemId" index="index" open="(" close=")" separator=",">
            #{itemId}
        </foreach>
        <if test="deptIds != null and deptIds.size() > 0">
            and tws.department_id IN
            <foreach collection="deptIds" separator="," open="(" close=")" item="item">
                #{item}
            </foreach>
        </if>
    </select>
</mapper>