<?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.railway.business.catenary.mapper.BusJcbBlqMapper">

  <resultMap id="BaseResultMap" type="com.railway.business.catenary.domain.BusJcbBlq">
    <result column="id" property="id"/>
    <result column="blq_id" property="blqId"/>
    <result column="dept_id" property="deptId"/>
    <result column="dept_name" property="deptName"/>
    <result column="station_id" property="stationId"/>
    <result column="station_name" property="stationName"/>
    <result column="dept_station_id" property="deptStationId"/>
    <result column="pillar_code" property="pillarCode"/>
    <result column="temperature" property="temperature"/>
    <result column="check_date" property="checkDate"/>
    <result column="pic_url" property="picUrl"/>
    <result column="tjwz_blqtjazsp" property="tjwzBlqtjazsp"/>
    <result column="tjwz_blqtjazsp_desc" property="tjwzBlqtjazspDesc"/>
    <result column="tjwz_wxs" property="tjwzWxs"/>
    <result column="tjwz_wxs_desc" property="tjwzWxsDesc"/>
    <result column="tjwz_gblsljjg" property="tjwzGblsljjg"/>
    <result column="tjwz_gblsljjg_desc" property="tjwzGblsljjgDesc"/>
    <result column="blqjyz_blqjzcjyzcszzt" property="blqjyzBlqjzcjyzcszzt"/>
    <result column="blqjyz_blqjzcjyzcszzt_desc" property="blqjyzBlqjzcjyzcszztDesc"/>
    <result column="blqjyz_bmqjazlg" property="blqjyzBmqjazlg"/>
    <result column="blqjyz_bmqjazlg_desc" property="blqjyzBmqjazlgDesc"/>
    <result column="blqyx_blqyxwssdg" property="blqyxBlqyxwssdg"/>
    <result column="blqyx_blqyxwssdg_desc" property="blqyxBlqyxwssdgDesc"/>
    <result column="blqyx_gycyxdjdtdtzxjl" property="blqyxGycyxdjdtdtzxjl"/>
    <result column="tlq_ztlhwpslh" property="tlqZtlhwpslh"/>
    <result column="tlq_ztlhwpslh_desc" property="tlqZtlhwpslhDesc"/>
    <result column="jsq_dzjs" property="jsqDzjs"/>
    <result column="blqjdzt_jddz" property="blqjdztJddz"/>
    <result column="sbzt" property="sbzt"/>
    <result column="sbzt_desc" property="sbztDesc"/>
    <result column="check_user" property="checkUser"/>
    <result column="confirm_user" property="confirmUser"/>
    <result column="confirm_user_real_name" property="confirmUserRealName"/>
    <result column="czwt" property="czwt"/>
    <result column="create_by" property="createBy"/>
    <result column="create_time" property="createTime"/>
    <result column="update_by" property="updateBy"/>
    <result column="update_time" property="updateTime"/>
    <result column="submit_state" property="submitState"/>
    <result column="del_flag" property="delFlag"/>
    <result column="sccj" property="sccj"/>
  </resultMap>

  <sql id="Base_Column_List">
    t.id,
    t.blq_id,
    v.dept_id,
    v.dept_name,
    v.station_name,
    v.station_id,
    t.dept_station_id,
    t.pillar_code,
    t.temperature,
    t.check_date,
    t.pic_url,
    t.tjwz_blqtjazsp,
    t.tjwz_blqtjazsp_desc,
    t.tjwz_wxs,
    t.tjwz_wxs_desc,
    t.tjwz_gblsljjg,
    t.tjwz_gblsljjg_desc,
    t.blqjyz_blqjzcjyzcszzt,
    t.blqjyz_blqjzcjyzcszzt_desc,
    t.blqjyz_bmqjazlg,
    t.blqjyz_bmqjazlg_desc,
    t.blqyx_blqyxwssdg,
    t.blqyx_blqyxwssdg_desc,
    t.blqyx_gycyxdjdtdtzxjl,
    t.tlq_ztlhwpslh,
    t.tlq_ztlhwpslh_desc,
    t.jsq_dzjs,
    t.blqjdzt_jddz,
    t.sbzt,
    t.sbzt_desc,
    t.check_user,
    t.confirm_user,
    t.czwt,
    t.create_by,
    t.create_time,
    t.update_by,
    t.update_time,
    t.submit_state,
    t.del_flag
  </sql>

  <insert id="insert" parameterType="com.railway.business.catenary.domain.BusJcbBlq">
    <selectKey keyProperty="id" order="AFTER" resultType="Long">
      select @@IDENTITY as id
    </selectKey>
    INSERT INTO bus_jcb_blq
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test='null != blqId'>
        blq_id,
      </if>
      <if test='null != deptStationId'>
        dept_station_id,
      </if>
      <if test='null != pillarCode'>
        pillar_code,
      </if>
      <if test='null != temperature'>
        temperature,
      </if>
      <if test='null != checkDate'>
        check_date,
      </if>
      <if test='null != picUrl'>
        pic_url,
      </if>
      <if test='null != tjwzBlqtjazsp'>
        tjwz_blqtjazsp,
      </if>
      <if test='null != tjwzBlqtjazspDesc'>
        tjwz_blqtjazsp_desc,
      </if>
      <if test='null != tjwzWxs'>
        tjwz_wxs,
      </if>
      <if test='null != tjwzWxsDesc'>
        tjwz_wxs_desc,
      </if>
      <if test='null != tjwzGblsljjg'>
        tjwz_gblsljjg,
      </if>
      <if test='null != tjwzGblsljjgDesc'>
        tjwz_gblsljjg_desc,
      </if>
      <if test='null != blqjyzBlqjzcjyzcszzt'>
        blqjyz_blqjzcjyzcszzt,
      </if>
      <if test='null != blqjyzBlqjzcjyzcszztDesc'>
        blqjyz_blqjzcjyzcszzt_desc,
      </if>
      <if test='null != blqjyzBmqjazlg'>
        blqjyz_bmqjazlg,
      </if>
      <if test='null != blqjyzBmqjazlgDesc'>
        blqjyz_bmqjazlg_desc,
      </if>
      <if test='null != blqyxBlqyxwssdg'>
        blqyx_blqyxwssdg,
      </if>
      <if test='null != blqyxBlqyxwssdgDesc'>
        blqyx_blqyxwssdg_desc,
      </if>
      <if test='null != blqyxGycyxdjdtdtzxjl'>
        blqyx_gycyxdjdtdtzxjl,
      </if>
      <if test='null != tlqZtlhwpslh'>
        tlq_ztlhwpslh,
      </if>
      <if test='null != tlqZtlhwpslhDesc'>
        tlq_ztlhwpslh_desc,
      </if>
      <if test='null != jsqDzjs'>
        jsq_dzjs,
      </if>
      <if test='null != blqjdztJddz'>
        blqjdzt_jddz,
      </if>
      <if test='null != sbzt'>
        sbzt,
      </if>
      <if test='null != sbztDesc'>
        sbzt_desc,
      </if>
      <if test='null != checkUser'>
        check_user,
      </if>
      <if test='null != confirmUser'>
        confirm_user,
      </if>
      <if test='null != czwt'>
        czwt,
      </if>
      <if test='null != createBy'>
        create_by,
      </if>
      <if test='null != createTime'>
        create_time,
      </if>
      <if test='null != updateBy'>
        update_by,
      </if>
      <if test='null != updateTime'>
        update_time,
      </if>
      <if test='null != submitState'>
        submit_state,
      </if>
      <if test='null != delFlag'>
        del_flag
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test='null != blqId'>
        #{blqId},
      </if>
      <if test='null != deptStationId'>
        #{deptStationId},
      </if>
      <if test='null != pillarCode'>
        #{pillarCode},
      </if>
      <if test='null != temperature'>
        #{temperature},
      </if>
      <if test='null != checkDate'>
        #{checkDate},
      </if>
      <if test='null != picUrl'>
        #{picUrl},
      </if>
      <if test='null != tjwzBlqtjazsp'>
        #{tjwzBlqtjazsp},
      </if>
      <if test='null != tjwzBlqtjazspDesc'>
        #{tjwzBlqtjazspDesc},
      </if>
      <if test='null != tjwzWxs'>
        #{tjwzWxs},
      </if>
      <if test='null != tjwzWxsDesc'>
        #{tjwzWxsDesc},
      </if>
      <if test='null != tjwzGblsljjg'>
        #{tjwzGblsljjg},
      </if>
      <if test='null != tjwzGblsljjgDesc'>
        #{tjwzGblsljjgDesc},
      </if>
      <if test='null != blqjyzBlqjzcjyzcszzt'>
        #{blqjyzBlqjzcjyzcszzt},
      </if>
      <if test='null != blqjyzBlqjzcjyzcszztDesc'>
        #{blqjyzBlqjzcjyzcszztDesc},
      </if>
      <if test='null != blqjyzBmqjazlg'>
        #{blqjyzBmqjazlg},
      </if>
      <if test='null != blqjyzBmqjazlgDesc'>
        #{blqjyzBmqjazlgDesc},
      </if>
      <if test='null != blqyxBlqyxwssdg'>
        #{blqyxBlqyxwssdg},
      </if>
      <if test='null != blqyxBlqyxwssdgDesc'>
        #{blqyxBlqyxwssdgDesc},
      </if>
      <if test='null != blqyxGycyxdjdtdtzxjl'>
        #{blqyxGycyxdjdtdtzxjl},
      </if>
      <if test='null != tlqZtlhwpslh'>
        #{tlqZtlhwpslh},
      </if>
      <if test='null != tlqZtlhwpslhDesc'>
        #{tlqZtlhwpslhDesc},
      </if>
      <if test='null != jsqDzjs'>
        #{jsqDzjs},
      </if>
      <if test='null != blqjdztJddz'>
        #{blqjdztJddz},
      </if>
      <if test='null != sbzt'>
        #{sbzt},
      </if>
      <if test='null != sbztDesc'>
        #{sbztDesc},
      </if>
      <if test='null != checkUser'>
        #{checkUser},
      </if>
      <if test='null != confirmUser'>
        #{confirmUser},
      </if>
      <if test='null != czwt'>
        #{czwt},
      </if>
      <if test='null != createBy'>
        #{createBy},
      </if>
      <if test='null != createTime'>
        #{createTime},
      </if>
      <if test='null != updateBy'>
        #{updateBy},
      </if>
      <if test='null != updateTime'>
        #{updateTime},
      </if>
      <if test='null != submitState'>
        #{submitState},
      </if>
      <if test='null != delFlag'>
        #{delFlag}
      </if>
    </trim>
  </insert>

  <delete id="delete">
    UPDATE bus_jcb_blq
    set del_flag='1'
    WHERE id = #{id}
  </delete>

  <update id="update" parameterType="com.railway.business.catenary.domain.BusJcbBlq">
    UPDATE bus_jcb_blq
    <set>
      <if test='null != blqId'>blq_id = #{blqId},</if>
      <if test='null != deptStationId'>dept_station_id = #{deptStationId},</if>
      <if test='null != pillarCode'>pillar_code = #{pillarCode},</if>
      <if test='null != temperature'>temperature = #{temperature},</if>
      <if test='null != checkDate'>check_date = #{checkDate},</if>
      <if test='null != picUrl'>pic_url = #{picUrl},</if>
      <if test='null != tjwzBlqtjazsp'>tjwz_blqtjazsp = #{tjwzBlqtjazsp},</if>
      <if test='null != tjwzBlqtjazspDesc'>tjwz_blqtjazsp_desc = #{tjwzBlqtjazspDesc},</if>
      <if test='null != tjwzWxs'>tjwz_wxs = #{tjwzWxs},</if>
      <if test='null != tjwzWxsDesc'>tjwz_wxs_desc = #{tjwzWxsDesc},</if>
      <if test='null != tjwzGblsljjg'>tjwz_gblsljjg = #{tjwzGblsljjg},</if>
      <if test='null != tjwzGblsljjgDesc'>tjwz_gblsljjg_desc = #{tjwzGblsljjgDesc},</if>
      <if test='null != blqjyzBlqjzcjyzcszzt'>blqjyz_blqjzcjyzcszzt = #{blqjyzBlqjzcjyzcszzt},</if>
      <if test='null != blqjyzBlqjzcjyzcszztDesc'>blqjyz_blqjzcjyzcszzt_desc = #{blqjyzBlqjzcjyzcszztDesc},</if>
      <if test='null != blqjyzBmqjazlg'>blqjyz_bmqjazlg = #{blqjyzBmqjazlg},</if>
      <if test='null != blqjyzBmqjazlgDesc'>blqjyz_bmqjazlg_desc = #{blqjyzBmqjazlgDesc},</if>
      <if test='null != blqyxBlqyxwssdg'>blqyx_blqyxwssdg = #{blqyxBlqyxwssdg},</if>
      <if test='null != blqyxBlqyxwssdgDesc'>blqyx_blqyxwssdg_desc = #{blqyxBlqyxwssdgDesc},</if>
      <if test='null != blqyxGycyxdjdtdtzxjl'>blqyx_gycyxdjdtdtzxjl = #{blqyxGycyxdjdtdtzxjl},</if>
      <if test='null != tlqZtlhwpslh'>tlq_ztlhwpslh = #{tlqZtlhwpslh},</if>
      <if test='null != tlqZtlhwpslhDesc'>tlq_ztlhwpslh_desc = #{tlqZtlhwpslhDesc},</if>
      <if test='null != jsqDzjs'>jsq_dzjs = #{jsqDzjs},</if>
      <if test='null != blqjdztJddz'>blqjdzt_jddz = #{blqjdztJddz},</if>
      <if test='null != sbzt'>sbzt = #{sbzt},</if>
      <if test='null != sbztDesc'>sbzt_desc = #{sbztDesc},</if>
      <if test='null != checkUser'>check_user = #{checkUser},</if>
      <if test='null != confirmUser'>confirm_user = #{confirmUser},</if>
      <if test='null != czwt'>czwt = #{czwt},</if>
      <if test='null != updateBy'>update_by = #{updateBy},</if>
      <if test='null != updateTime'>update_time = #{updateTime},</if>
      <if test='null != submitState'>submit_state = #{submitState},</if>
      <if test='null != delFlag'>del_flag = #{delFlag}</if>
    </set>
    WHERE id = #{id}
  </update>


  <select id="getInfo" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>,u.real_name confirm_user_real_name
    FROM bus_jcb_blq t
    LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
    LEFT JOIN sys_user u on t.confirm_user = u.user_name
    WHERE t.del_flag='0' and t.id = #{id}

  </select>

  <select id="getList" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>
    FROM bus_jcb_blq t
    LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
    <where>
      t.del_flag='0'
      <if test="blqId!=null and blqId!=''">
        and t.blq_id=#{blqId}
      </if>
      <if test="deptId!=null and deptId!=''">
        and v.dept_id=#{deptId}
      </if>
      <if test="stationId!=null and stationId!=''">
        and v.station_id=#{stationId}
      </if>
      <if test="stationIds!=null and stationIds.length > 0">
        and v.station_id in
        <foreach collection="stationIds" item="stationId" index="i" open="(" separator="," close=")">
          #{stationId}
        </foreach>
      </if>
      <if test="pillarCode!=null and pillarCode!=''">
        and t.pillar_code=#{pillarCode}
      </if>
      <if test="temperature!=null and temperature!=''">
        and t.temperature=#{temperature}
      </if>
      <if test="checkDate!=null">
        and t.check_date=#{checkDate}
      </if>
      <if test="picUrl!=null and picUrl!=''">
        and t.pic_url=#{picUrl}
      </if>
      <if test="tjwzBlqtjazsp!=null and tjwzBlqtjazsp!=''">
        and t.tjwz_blqtjazsp=#{tjwzBlqtjazsp}
      </if>
      <if test="tjwzBlqtjazspDesc!=null and tjwzBlqtjazspDesc!=''">
        and t.tjwz_blqtjazsp_desc=#{tjwzBlqtjazspDesc}
      </if>
      <if test="tjwzWxs!=null and tjwzWxs!=''">
        and t.tjwz_wxs=#{tjwzWxs}
      </if>
      <if test="tjwzWxsDesc!=null and tjwzWxsDesc!=''">
        and t.tjwz_wxs_desc=#{tjwzWxsDesc}
      </if>
      <if test="tjwzGblsljjg!=null and tjwzGblsljjg!=''">
        and t.tjwz_gblsljjg=#{tjwzGblsljjg}
      </if>
      <if test="tjwzGblsljjgDesc!=null and tjwzGblsljjgDesc!=''">
        and t.tjwz_gblsljjg_desc=#{tjwzGblsljjgDesc}
      </if>
      <if test="blqjyzBlqjzcjyzcszzt!=null and blqjyzBlqjzcjyzcszzt!=''">
        and t.blqjyz_blqjzcjyzcszzt=#{blqjyzBlqjzcjyzcszzt}
      </if>
      <if test="blqjyzBlqjzcjyzcszztDesc!=null and blqjyzBlqjzcjyzcszztDesc!=''">
        and t.blqjyz_blqjzcjyzcszzt_desc=#{blqjyzBlqjzcjyzcszztDesc}
      </if>
      <if test="blqjyzBmqjazlg!=null and blqjyzBmqjazlg!=''">
        and t.blqjyz_bmqjazlg=#{blqjyzBmqjazlg}
      </if>
      <if test="blqjyzBmqjazlgDesc!=null and blqjyzBmqjazlgDesc!=''">
        and t.blqjyz_bmqjazlg_desc=#{blqjyzBmqjazlgDesc}
      </if>
      <if test="blqyxBlqyxwssdg!=null and blqyxBlqyxwssdg!=''">
        and t.blqyx_blqyxwssdg=#{blqyxBlqyxwssdg}
      </if>
      <if test="blqyxBlqyxwssdgDesc!=null and blqyxBlqyxwssdgDesc!=''">
        and t.blqyx_blqyxwssdg_desc=#{blqyxBlqyxwssdgDesc}
      </if>
      <if test="blqyxGycyxdjdtdtzxjl!=null and blqyxGycyxdjdtdtzxjl!=''">
        and t.blqyx_gycyxdjdtdtzxjl=#{blqyxGycyxdjdtdtzxjl}
      </if>
      <if test="tlqZtlhwpslh!=null and tlqZtlhwpslh!=''">
        and t.tlq_ztlhwpslh=#{tlqZtlhwpslh}
      </if>
      <if test="tlqZtlhwpslhDesc!=null and tlqZtlhwpslhDesc!=''">
        and t.tlq_ztlhwpslh_desc=#{tlqZtlhwpslhDesc}
      </if>
      <if test="jsqDzjs!=null and jsqDzjs!=''">
        and t.jsq_dzjs=#{jsqDzjs}
      </if>
      <if test="blqjdztJddz!=null and blqjdztJddz!=''">
        and t.blqjdzt_jddz=#{blqjdztJddz}
      </if>
      <if test="sbzt!=null and sbzt!=''">
        and t.sbzt=#{sbzt}
      </if>
      <if test="sbztDesc!=null and sbztDesc!=''">
        and t.sbzt_desc=#{sbztDesc}
      </if>
      <if test="checkUser!=null and checkUser!=''">
        and t.check_user like concat('%', #{checkUser}, '%')
      </if>
      <if test="confirmUser!=null and confirmUser!=''">
        and t.confirm_user=#{confirmUser}
      </if>
      <if test="czwt!=null and czwt!=''">
        and t.czwt=#{czwt}
      </if>
      <if test="createBy!=null and createBy!=''">
        and t.create_by=#{createBy}
      </if>
      <if test="createTime!=null">
        and DATE_FORMAT(t.create_time, '%Y-%m-%d') = #{createTime}
      </if>
      <if test="updateBy!=null and updateBy!=''">
        and t.update_by=#{updateBy}
      </if>
      <if test="updateTime!=null">
        and DATE_FORMAT(t.update_time, '%Y-%m-%d') = #{updateTime}
      </if>
      <if test="submitState!=null and submitState!=''">
        and t.submit_state <![CDATA[ >= ]]> #{submitState}
      </if>
    </where>
    <if test="orderBy!=null and orderBy!=''">
      order by t.${orderBy}
    </if>
    <if test="isAsc!=null and isAsc!=''">
      <if test="isAsc == '1'.toString()">
        asc
      </if>
      <if test="isAsc == '0'.toString()">
        desc
      </if>
    </if>
  </select>


  <select id="getLastOne" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>
    FROM
    bus_jcb_blq t
    LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
    WHERE
    t.submit_state = '1'and t.del_flag = '0'
    <if test="stationId!=null and stationId!=''">
      and v.station_id=#{stationId}
    </if>
    <if test="deptId!=null and deptId!=''">
      and v.dept_id=#{deptId}
    </if>
    <if test="pillarCode!=null and pillarCode!=''">
      and t.pillar_code=#{pillarCode}
    </if>
    <if test="blqId!=null and blqId!=''">
      and t.blq_id=#{blqId}
    </if>
    ORDER BY
    update_time DESC
    LIMIT 1
  </select>

  <select id="getJcebList" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>,base.sccj
    FROM bus_jcb_blq t
    LEFT JOIN base_blq base on t.pillar_code = base.pillar_code
    LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
    <where>
      t.del_flag='0'
      <if test="submitState!=null and submitState!=''">
        and t.submit_state <![CDATA[ >= ]]> #{submitState}
      </if>
      <if test="deptId!=null and deptId!=''">
        and v.dept_id=#{deptId}
      </if>
      <if test="stationId!=null and stationId!=''">
        and v.station_id=#{stationId}
      </if>
      <if test="stationIds!=null and stationIds.length > 0">
        and v.station_id in
        <foreach collection="stationIds" item="stationId" index="i" open="(" separator="," close=")">
          #{stationId}
        </foreach>
      </if>
      <if test="pillarCode!=null and pillarCode!=''">
        and t.pillar_code=#{pillarCode}
      </if>
      <if test="operator!=null and operator!=''">
        and t.check_user like concat('%', #{operator}, '%')
      </if>
      <if test="createBy!=null and createBy!=''">
        and t.create_by=#{createBy}
      </if>
      <if test="operationDate!=null">
        and t.check_date=#{operationDate}
      </if>
    </where>
  </select>

  <resultMap id="JcabResultMap" type="com.railway.business.catenary.domain.vo.JcebRecordVo">
    <result column="id" property="id"/>
    <result column="dept_name" property="deptName"/>
    <result column="station_name" property="stationName"/>
    <result column="check_date" property="operationDate"/>
    <result column="check_user" property="operator"/>
    <result column="jcebType" property="jcebType"/>
  </resultMap>

  <select id="getListByType" resultMap="JcabResultMap">
    SELECT t.id, v.dept_name, v.station_name, t.check_date, t.check_user, #{jcebType} as jcebType
    FROM bus_jcb_blq t
    LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
    <where>
      t.del_flag='0'
      <if test="submitState!=null and submitState!=''">
        and t.submit_state <![CDATA[ >= ]]> #{submitState}
      </if>
      <if test="deptId!=null and deptId!=''">
        and v.dept_id=#{deptId}
      </if>
      <if test="stationId!=null and stationId!=''">
        and v.station_id=#{stationId}
      </if>
      <if test="stationIds!=null and stationIds.length > 0">
        and v.station_id in
        <foreach collection="stationIds" item="stationId" index="i" open="(" separator="," close=")">
          #{stationId}
        </foreach>
      </if>
      <if test="pillarCode!=null and pillarCode!=''">
        and t.pillar_code=#{pillarCode}
      </if>
      <if test="operator!=null and operator!=''">
        and t.check_user like concat('%', #{operator}, '%')
      </if>
      <if test="createBy!=null and createBy!=''">
        and t.create_by=#{createBy}
      </if>
      <if test="operationDate!=null">
        and t.check_date=#{operationDate}
      </if>
    </where>
  </select>

  <resultMap id="JcabCountResultMap" type="com.railway.business.catenary.domain.vo.JcebCountVo">
    <result column="c" property="count"/>
    <result column="check_date" property="operationDate"/>
  </resultMap>

  <select id="getCountByType" resultMap="JcabCountResultMap">
    SELECT count(*) c, max(t.check_date) as check_date
    FROM bus_jcb_blq t
    LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
    <where>
      t.del_flag='0'
      <if test="submitState!=null and submitState!=''">
        and t.submit_state <![CDATA[ >= ]]> #{submitState}
      </if>
      <if test="deptId!=null and deptId!=''">
        and v.dept_id=#{deptId}
      </if>
      <if test="stationId!=null and stationId!=''">
        and v.station_id=#{stationId}
      </if>
      <if test="pillarCode!=null and pillarCode!=''">
        and t.pillar_code=#{pillarCode}
      </if>
      <if test="operator!=null and operator!=''">
        and t.check_user like concat('%', #{operator}, '%')
      </if>
      <if test="createBy!=null and createBy!=''">
        and t.create_by=#{createBy}
      </if>
      <if test="operationDate!=null">
        and t.check_date=#{operationDate}
      </if>
    </where>
  </select>

</mapper>