FakeOfflineFenceSnMapper.xml 3.09 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.stdinterface.modules.mapper.FakeOfflineFenceSnMapper">
    <resultMap id="BaseMap" type="cn.com.glsx.stdinterface.modules.entity.FakeOfflineFenceSn">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="sn" property="sn" jdbcType="VARCHAR"/>
        <result column="status" property="status" jdbcType="TINYINT"/>
        <result column="merchant_type" property="merchantType" jdbcType="TINYINT"/>
        <result column="entry_time" property="entryTime" jdbcType="TIMESTAMP"/>
        <result column="out_time" property="outTime" jdbcType="TIMESTAMP"/>
        <result column="trigger_time" property="triggerTime" jdbcType="TIMESTAMP"/>
        <result column="addr" property="addr" jdbcType="VARCHAR"/>
        <result column="unique_flag" property="uniqueFlag" 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>

    <resultMap id="BaseDtoMap" type="cn.com.glsx.stdinterface.dto.FakeOfflineFenceSnDto">
        <result column="sn" property="sn" jdbcType="VARCHAR"/>
        <result column="status" property="status" jdbcType="TINYINT"/>
        <result column="merchant_type" property="merchantType" jdbcType="TINYINT"/>
        <result column="entry_time" property="entryTime" jdbcType="TIMESTAMP"/>
        <result column="out_time" property="outTime" jdbcType="TIMESTAMP"/>
        <result column="trigger_time" property="triggerTime" jdbcType="TIMESTAMP"/>
        <result column="addr" property="addr" jdbcType="VARCHAR"/>
        <result column="unique_flag" property="uniqueFlag" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="BaseColumns">
	  id, sn, status, merchant_type, entry_time, out_time, trigger_time, addr, unique_flag, del_flag, created_date,
	  created_by, updated_date, updated_by
	</sql>

    <select id="getFakeOfficeDataByUniqueFlag" resultMap="BaseDtoMap">
        select
        sn, status, merchant_type, entry_time, out_time, trigger_time, addr, unique_flag
        from t_fake_offline_fence_sn
        where unique_flag = #{uniqueFlag}
    </select>

    <select id="selectBySnAndMerchantType" resultMap="BaseMap">
        select
        <include refid="BaseColumns"/>
        from t_fake_offline_fence_sn
        where del_flag = 0
        <if test="sn !=null and sn != ''">
            and sn = #{sn}
        </if>
        <if test="merchantType !=null and merchantType != ''">
            and merchant_type = #{merchantType}
        </if>
        order by created_date desc
        limit 1
    </select>

    <delete id="logicDeleteById">
        update t_fake_offline_fence_sn set del_flag = 1 where id = #{id}
    </delete>
</mapper>