CollisionSnInfoMapper.xml 7.97 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.entmicro.mapper.CollisionSnInfoMapper" >
  <resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.collision.CollisionSnInfo" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="sn" property="sn" jdbcType="VARCHAR" />
    <result column="batch_id" property="batchId" jdbcType="INTEGER" />
    <result column="merchant_id" property="merchantId" jdbcType="INTEGER" />
    <result column="merchant_name" property="merchantName" jdbcType="VARCHAR" />
    <result column="sn_type" property="snType" jdbcType="INTEGER" />
    <result column="iccid" property="iccid" jdbcType="VARCHAR" />
    <result column="customer_name" property="customerName" jdbcType="VARCHAR" />
    <result column="customer_phone" property="customerPhone" jdbcType="VARCHAR" />
    <result column="customer_sex" property="customerSex" jdbcType="INTEGER" />
    <result column="license_plate" property="licensePlate" jdbcType="VARCHAR" />
    <result column="stand_no" property="standNo" jdbcType="VARCHAR" />
    <result column="initial_mileage" property="initialMileage" jdbcType="BIGINT" />
    <result column="last_mileage" property="lastMileage" jdbcType="BIGINT" />
    <result column="last_time" property="lastTime" jdbcType="TIMESTAMP" />
    <result column="lower_mileage" property="lowerMileage" jdbcType="BIGINT" />
    <result column="lower_time" property="lowerTime" jdbcType="TIMESTAMP" />
    <result column="replace_flag" property="replaceFlag" jdbcType="INTEGER" />
    <result column="vehicle_brand_id" property="vehicleBrandId" jdbcType="INTEGER" />
    <result column="vehicle_brand_name" property="vehicleBrandName" jdbcType="VARCHAR" />
    <result column="vehicle_sub_brand_id" property="vehicleSubBrandId" jdbcType="INTEGER" />
    <result column="vehicle_sub_brand_name" property="vehicleSubBrandName" jdbcType="VARCHAR" />
    <result column="vehicle_series_id" property="vehicleSeriesId" jdbcType="INTEGER" />
    <result column="vehicle_series_name" property="vehicleSeriesName" jdbcType="VARCHAR" />
    <result column="vehicle_shape_id" property="vehicleShapeId" jdbcType="INTEGER" />
    <result column="vehicle_shape_name" property="vehicleShapeName" jdbcType="VARCHAR" />
    <result column="del_flag" property="delFlag" jdbcType="INTEGER" />
    <result column="created_by" property="createdBy" jdbcType="VARCHAR" />
    <result column="created_time" property="createdTime" jdbcType="TIMESTAMP" />
    <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
    <result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP" />
  </resultMap>

  <resultMap id="BaseResultMap1" type="cn.com.glsx.entmicro.dto.collision.CollisionSnInfoDTO" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="sn" property="sn" jdbcType="VARCHAR" />
    <result column="batch_id" property="batchId" jdbcType="INTEGER" />
    <result column="merchant_id" property="merchantId" jdbcType="INTEGER" />
    <result column="merchant_name" property="merchantName" jdbcType="VARCHAR" />
    <result column="sn_type" property="snType" jdbcType="INTEGER" />
    <result column="iccid" property="iccid" jdbcType="VARCHAR" />
    <result column="customer_name" property="customerName" jdbcType="VARCHAR" />
    <result column="customer_phone" property="customerPhone" jdbcType="VARCHAR" />
    <result column="customer_sex" property="customerSex" jdbcType="INTEGER" />
    <result column="license_plate" property="licensePlate" jdbcType="VARCHAR" />
    <result column="stand_no" property="standNo" jdbcType="VARCHAR" />
    <result column="initial_mileage" property="initialMileage" jdbcType="BIGINT" />
    <result column="last_mileage" property="lastMileage" jdbcType="BIGINT" />
    <result column="last_time" property="lastTime" jdbcType="TIMESTAMP" />
    <result column="lower_mileage" property="lowerMileage" jdbcType="BIGINT" />
    <result column="lower_time" property="lowerTime" jdbcType="TIMESTAMP" />
    <result column="replace_flag" property="replaceFlag" jdbcType="INTEGER" />
    <result column="vehicle_brand_id" property="vehicleBrandId" jdbcType="INTEGER" />
    <result column="vehicle_brand_name" property="vehicleBrandName" jdbcType="VARCHAR" />
    <result column="vehicle_sub_brand_id" property="vehicleSubBrandId" jdbcType="INTEGER" />
    <result column="vehicle_sub_brand_name" property="vehicleSubBrandName" jdbcType="VARCHAR" />
    <result column="vehicle_series_id" property="vehicleSeriesId" jdbcType="INTEGER" />
    <result column="vehicle_series_name" property="vehicleSeriesName" jdbcType="VARCHAR" />
    <result column="vehicle_shape_id" property="vehicleShapeId" jdbcType="INTEGER" />
    <result column="vehicle_shape_name" property="vehicleShapeName" jdbcType="VARCHAR" />
    <result column="del_flag" property="delFlag" jdbcType="INTEGER" />
    <result column="created_by" property="createdBy" jdbcType="VARCHAR" />
    <result column="created_time" property="createdTime" jdbcType="TIMESTAMP" />
    <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
    <result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, sn, batch_id, merchant_id, merchant_name, sn_type, iccid, customer_name, customer_phone,
    customer_sex, license_plate, stand_no, initial_mileage, last_mileage, last_time, 
    lower_mileage, lower_time, replace_flag, vehicle_brand_id, vehicle_brand_name, vehicle_sub_brand_id, 
    vehicle_sub_brand_name, vehicle_series_id, vehicle_series_name, vehicle_shape_id, 
    vehicle_shape_name, del_flag, created_by, created_time, updated_by, updated_time
  </sql>
  <select id="selectSnAndBindingInfo" resultType="java.lang.String">
    SELECT t.`sn` FROM `scrm_collision_sn_info` t WHERE t.`sn` IN
    <foreach collection="snList" open="(" close=")" item="snId" separator=",">
      #{snId}
    </foreach>
    AND t.`del_flag`=0
    AND t.`merchant_id` != #{merchantId}
  </select>
  <select id="selectSnBindingForMerchantId" resultType="java.lang.String">
    SELECT t.`sn` FROM `scrm_collision_sn_info` t WHERE t.`sn` IN
    <foreach collection="snList" open="(" close=")" item="snId" separator=",">
      #{snId}
    </foreach>
    AND t.`del_flag`=0
    AND t.`merchant_id` = #{merchantId}
  </select>
  <select id="getCustomerDeviceList" resultMap="BaseResultMap1">
      SELECT
      <include refid="Base_Column_List"/>
      FROM `scrm_collision_sn_info` t
      WHERE t.`del_flag`=0
      <if test="sn!=null and sn!='' ">
          AND t.`sn` LIKE CONCAT('%',#{sn},'%')
      </if>
      <if test="merchantNo!=null and operate==true">
          AND t.`merchant_id` LIKE CONCAT('%',#{merchantNo},'%')
      </if>
      <if test="merchantId!=null and operate==false">
          AND t.`merchant_id` LIKE CONCAT('%',#{merchantId},'%')
      </if>
      <if test="merchantName!=null and merchantName!='' ">
          AND t.`merchant_name` LIKE CONCAT('%',#{merchantName},'%')
      </if>
      <if test="sn!=account and account!='' ">
          AND t.`created_by` LIKE CONCAT('%',#{account},'%')
      </if>
      <if test="snType!=null ">
          AND t.`sn_type` = #{snType}
      </if>
      <if test="customerPhone!=null and customerPhone!='' ">
          AND t.`customer_phone` LIKE CONCAT('%',#{customerPhone},'%')
      </if>
      <if test="customerName!=null and customerName!='' ">
          AND t.`customer_name` LIKE CONCAT('%',#{customerName},'%')
      </if>
      <if test="licensePlate!=null and licensePlate!='' ">
          AND t.`license_plate` LIKE CONCAT('%',#{licensePlate},'%')
      </if>
      <if test="standNo!=null and standNo!='' ">
          AND t.`stand_no` LIKE CONCAT('%',#{standNo},'%')
      </if>
      <if test="beginTime != null">
          AND t.`created_time`  <![CDATA[>=]]> #{beginTime}
      </if>
      <if test="endTime != null">
          AND t.`created_time`  <![CDATA[<=]]> #{endTime}
      </if>
  </select>

</mapper>