CollisionInfoMapper.xml 7.84 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.CollisionInfoMapper" >
  <resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.collision.CollisionInfo" >
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="sn" property="sn" jdbcType="VARCHAR" />
    <result column="collision_time" property="collisionTime" jdbcType="TIMESTAMP" />
    <result column="collision_type" property="collisionType" jdbcType="VARCHAR" />
    <result column="address" property="address" jdbcType="VARCHAR" />
    <result column="longitude" property="longitude" jdbcType="VARCHAR" />
    <result column="latitude" property="latitude" jdbcType="VARCHAR" />
    <result column="follow_status" property="followStatus" jdbcType="INTEGER" />
    <result column="follow_result" property="followResult" jdbcType="INTEGER" />
    <result column="follow_time" property="followTime" jdbcType="TIMESTAMP" />
    <result column="follow_remark" property="followRemark" jdbcType="VARCHAR" />
    <result column="task_id" property="taskId" 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="CollisionInfoMap" type="cn.com.glsx.entmicro.model.response.collision.CollisionInfoRpcResponse">
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="sn" property="sn" jdbcType="VARCHAR" />
    <result column="collision_time" property="collisionTime" jdbcType="TIMESTAMP" />
    <result column="address" property="address" jdbcType="VARCHAR" />
    <result column="follow_status" property="followStatus" jdbcType="INTEGER" />
    <result column="follow_result" property="followResult" jdbcType="INTEGER" />
    <result column="follow_time" property="followTime" jdbcType="TIMESTAMP" />
    <result column="follow_remark" property="followRemark" jdbcType="VARCHAR" />
    <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
    <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="customer_name" property="customerName" jdbcType="VARCHAR" />
    <result column="customer_phone" property="customerPhone" jdbcType="VARCHAR" />
    <result column="license_plate" property="licensePlate" jdbcType="VARCHAR" />
    <result column="stand_no" property="standNo" jdbcType="VARCHAR" />
  </resultMap>

  <resultMap id="CollisionDetailInfoMap" type="cn.com.glsx.entmicro.model.response.collision.CollisionDetailInfoRpcResponse">
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="sn" property="sn" jdbcType="VARCHAR" />
    <result column="collision_time" property="collisionTime" jdbcType="TIMESTAMP" />
    <result column="address" property="address" jdbcType="VARCHAR" />
    <result column="follow_status" property="followStatus" jdbcType="INTEGER" />
    <result column="follow_result" property="followResult" jdbcType="INTEGER" />
    <result column="follow_time" property="followTime" jdbcType="TIMESTAMP" />
    <result column="follow_remark" property="followRemark" jdbcType="VARCHAR" />
    <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
    <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="customer_name" property="customerName" jdbcType="VARCHAR" />
    <result column="customer_phone" property="customerPhone" jdbcType="VARCHAR" />
    <result column="license_plate" property="licensePlate" jdbcType="VARCHAR" />
    <result column="stand_no" property="standNo" jdbcType="VARCHAR" />
    <result column="vehicle_sub_brand_name" property="vehicleSubBrandName" jdbcType="VARCHAR" />
    <result column="vehicle_series_name" property="vehicleSeriesName" jdbcType="VARCHAR" />
    <result column="task_id" property="taskId" jdbcType="VARCHAR" />
    <collection property="mediaDetailList" ofType="cn.com.glsx.entmicro.model.response.collision.CollisionMediaDetail">
      <result column="media_type" property="mediaType" jdbcType="VARCHAR" />
      <result column="file_url" property="fileUrl" jdbcType="VARCHAR" />
    </collection>
  </resultMap>

  
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbg.generated
    -->
    id, sn, collision_time, collision_type, address, longitude, latitude, follow_status, 
    follow_result, follow_time, follow_remark, task_id, del_flag, created_by, created_time, 
    updated_by, updated_time
  </sql>

  <select id="listCollisionInfo" parameterType="cn.com.glsx.entmicro.model.request.collision.CollisionInfoSearchRpcRequest" resultMap="CollisionInfoMap">
    select sci.id ,sci.sn,sci.collision_time ,sci.address ,sci.follow_status ,sci.follow_result ,sci.follow_time ,sci.follow_remark, sci.updated_by,
    scsi.merchant_id ,scsi.merchant_name ,scsi.customer_name ,scsi.customer_phone ,scsi.sn_type ,scsi.license_plate ,scsi.stand_no
    from scrm_collision_info sci
    left join scrm_collision_sn_info scsi on sci.sn = scsi.sn and scsi.del_flag = 0
    <where>
      sci.del_flag = 0
      <if test="sn != null and sn != ''">
        and sci.sn like '%${sn}%'
      </if>
      <if test="merchantName != null and merchantName != ''">
        and scsi.merchant_name like '%${merchantName}%'
      </if>
      <if test="merchantNo != null and operate==true">
        and scsi.merchant_id = #{merchantNo}
      </if>
      <if test="merchantId!=null and operate==false">
        AND scsi.merchant_id = #{merchantId}
      </if>
      <if test="snType != null">
        and scsi.sn_type =#{snType}
      </if>
      <if test="customerPhone != null and customerPhone != ''">
        and scsi.customer_phone like '%${customerPhone}%'
      </if>
      <if test="customerName != null and customerName != ''">
        and scsi.customer_name like '%${customerName}%'
      </if>
      <if test="licensePlate != null and licensePlate != ''">
        and scsi.license_plate like '%${licensePlate}%'
      </if>
      <if test="standNo != null and standNo != ''">
        and scsi.stand_no like '%${standNo}%'
      </if>
      <if test="followStatus != null">
        and sci.follow_status = #{followStatus}
      </if>
      <if test="followResult != null">
        and sci.follow_result = #{followResult}
      </if>
      <if test="beginFollowTime != null">
        and sci.follow_time &gt;= #{beginFollowTime}
      </if>
      <if test="endFollowTime != null">
        and sci.follow_time &lt;= #{endFollowTime}
      </if>
    </where>
    order by sci.follow_time desc
  </select>

  <select id="getDetailById" resultMap="CollisionDetailInfoMap">
    select sci.id ,sci.sn,sci.collision_time ,sci.address ,sci.follow_status ,sci.follow_result ,sci.follow_time ,sci.follow_remark, sci.updated_by,sci.task_id,
    scsi.merchant_id ,scsi.merchant_name ,scsi.customer_name ,scsi.customer_phone ,scsi.sn_type ,scsi.license_plate ,scsi.stand_no,scsi.vehicle_sub_brand_name,
    scsi.vehicle_series_name,scmi.file_url,scmi.media_type
    from scrm_collision_info sci
    left join scrm_collision_sn_info scsi on sci.sn = scsi.sn and scsi.del_flag = 0
    left join scrm_collision_media_info scmi on sci.task_id = scmi.task_id and scmi.del_flag = 0
    <where>
      sci.del_flag = 0 and sci.id = #{id}
    </where>
  </select>


</mapper>