<?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.BusJcbWjcxcMapper">

  <resultMap id="BaseResultMap" type="com.railway.business.catenary.domain.BusJcbWjcxc">
    <result column="id" property="id"/>
    <result column="xc_id" property="xcId"/>
    <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="xch" property="xch"/>
    <result column="temperature" property="temperature"/>
    <result column="check_date" property="checkDate"/>
    <result column="jcdxzt" property="jcdxzt"/>
    <result column="jcdxzt_gzms" property="jcdxztGzms"/>
    <result column="wxjqzt" property="wxjqzt"/>
    <result column="wxjqzt_gzms" property="wxjqztGzms"/>
    <result column="zxlcz" property="zxlcz"/>
    <result column="zxdg" property="zxdg"/>
    <result column="cxlcz" property="cxlcz"/>
    <result column="cxdg" property="cxdg"/>
    <result column="hdxjzt" property="hdxjzt"/>
    <result column="hdxjzt_gzms" property="hdxjztGzms"/>
    <result column="zxwxjq" property="zxwxjq"/>
    <result column="cxwxjq" property="cxwxjq"/>
    <result column="zxwxjqzt" property="zxwxjqzt"/>
    <result column="cxwxjqzt" property="cxwxjqzt"/>
    <result column="dljzt" property="dljzt"/>
    <result column="dljzt_gzms" property="dljztGzms"/>
    <result column="azzxlcz" property="azzxlcz"/>
    <result column="azzxdg" property="azzxdg"/>
    <result column="azcxlcz" property="azcxlcz"/>
    <result column="azcxdg" property="azcxdg"/>
    <result column="bzzxlcz" property="bzzxlcz"/>
    <result column="bzzxdg" property="bzzxdg"/>
    <result column="bzcxlcz" property="bzcxlcz"/>
    <result column="bzcxdg" property="bzcxdg"/>
    <result column="czzxlcz" property="czzxlcz"/>
    <result column="czzxdg" property="czzxdg"/>
    <result column="czcxlcz" property="czcxlcz"/>
    <result column="czcxdg" property="czcxdg"/>
    <result column="ljcdxjj" property="ljcdxjj"/>
    <result column="sbzt" property="sbzt"/>
    <result column="check_user" property="checkUser"/>
    <result column="confirm_user" property="confirmUser"/>
    <result column="czwt" property="czwt"/>
    <result column="submit_state" property="submitState"/>
    <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="user_id" property="userId"/>
    <result column="del_flag" property="delFlag"/>
  </resultMap>

  <sql id="Base_Column_List">
    t.id,
    t.xc_id,
    v.dept_id,
    v.dept_name,
    v.station_name,
    v.station_id,
    t.dept_station_id,
    t.pillar_code,
    t.xch,
    t.temperature,
    t.check_date,
    t.jcdxzt,
    t.jcdxzt_gzms,
    t.wxjqzt,
    t.wxjqzt_gzms,
    t.zxlcz,
    t.zxdg,
    t.cxlcz,
    t.cxdg,
    t.hdxjzt,
    t.hdxjzt_gzms,
    t.zxwxjq,
    t.cxwxjq,
    t.zxwxjqzt,
    t.cxwxjqzt,
    t.dljzt,
    t.dljzt_gzms,
    t.azzxlcz,
    t.azzxdg,
    t.azcxlcz,
    t.azcxdg,
    t.bzzxlcz,
    t.bzzxdg,
    t.bzcxlcz,
    t.bzcxdg,
    t.czzxlcz,
    t.czzxdg,
    t.czcxlcz,
    t.czcxdg,
    t.ljcdxjj,
    t.sbzt,
    t.check_user,
    t.confirm_user,
    t.czwt,
    t.submit_state,
    t.create_by,
    t.create_time,
    t.update_by,
    t.update_time,
    t.user_id,
    t.del_flag
  </sql>

  <insert id="insert" parameterType="com.railway.business.catenary.domain.BusJcbWjcxc">
    INSERT INTO bus_jcb_wjcxc
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test='null != deptStationId'>
        dept_station_id,
      </if>
      <if test='null != pillarCode'>
        pillar_code,
      </if>
      <if test='null != xcId'>
        xc_id,
      </if>
      <if test='null != xch'>
        xch,
      </if>
      <if test='null != temperature'>
        temperature,
      </if>
      <if test='null != checkDate'>
        check_date,
      </if>
      <if test='null != jcdxzt'>
        jcdxzt,
      </if>
      <if test='null != jcdxztGzms'>
        jcdxzt_gzms,
      </if>
      <if test='null != wxjqzt'>
        wxjqzt,
      </if>
      <if test='null != wxjqztGzms'>
        wxjqzt_gzms,
      </if>
      <if test='null != zxlcz'>
        zxlcz,
      </if>
      <if test='null != zxdg'>
        zxdg,
      </if>
      <if test='null != cxlcz'>
        cxlcz,
      </if>
      <if test='null != cxdg'>
        cxdg,
      </if>
      <if test='null != ljcdxjj'>
        ljcdxjj,
      </if>
      <if test='null != hdxjzt'>
        hdxjzt,
      </if>
      <if test='null != hdxjztGzms'>
        hdxjzt_gzms,
      </if>
      <if test='null != zxwxjq'>
        zxwxjq,
      </if>
      <if test='null != cxwxjq'>
        cxwxjq,
      </if>
      <if test='null != zxwxjqzt'>
        zxwxjqzt,
      </if>
      <if test='null != cxwxjqzt'>
        cxwxjqzt,
      </if>
      <if test='null != dljzt'>
        dljzt,
      </if>
      <if test='null != dljztGzms'>
        dljzt_gzms,
      </if>
      <if test='null != azzxlcz'>
        azzxlcz,
      </if>
      <if test='null != azzxdg'>
        azzxdg,
      </if>
      <if test='null != azcxlcz'>
        azcxlcz,
      </if>
      <if test='null != azcxdg'>
        azcxdg,
      </if>
      <if test='null != bzzxlcz'>
        bzzxlcz,
      </if>
      <if test='null != bzzxdg'>
        bzzxdg,
      </if>
      <if test='null != bzcxlcz'>
        bzcxlcz,
      </if>
      <if test='null != bzcxdg'>
        bzcxdg,
      </if>
      <if test='null != czzxlcz'>
        czzxlcz,
      </if>
      <if test='null != czzxdg'>
        czzxdg,
      </if>
      <if test='null != czcxlcz'>
        czcxlcz,
      </if>
      <if test='null != czcxdg'>
        czcxdg,
      </if>
      <if test='null != sbzt'>
        sbzt,
      </if>
      <if test='null != checkUser'>
        check_user,
      </if>
      <if test='null != czwt'>
        czwt,
      </if>
      <if test='null != submitState'>
        submit_state,
      </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 != userId'>
        user_id,
      </if>
      <if test='null != delFlag'>
        del_flag
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test='null != deptStationId'>
        #{deptStationId},
      </if>
      <if test='null != pillarCode'>
        #{pillarCode},
      </if>
      <if test='null != xcId'>
        #{xcId},
      </if>
      <if test='null != xch'>
        #{xch},
      </if>
      <if test='null != temperature'>
        #{temperature},
      </if>
      <if test='null != checkDate'>
        #{checkDate},
      </if>
      <if test='null != jcdxzt'>
        #{jcdxzt},
      </if>
      <if test='null != jcdxztGzms'>
        #{jcdxztGzms},
      </if>
      <if test='null != wxjqzt'>
        #{wxjqzt},
      </if>
      <if test='null != wxjqztGzms'>
        #{wxjqztGzms},
      </if>
      <if test='null != zxlcz'>
        #{zxlcz},
      </if>
      <if test='null != zxdg'>
        #{zxdg},
      </if>
      <if test='null != cxlcz'>
        #{cxlcz},
      </if>
      <if test='null != cxdg'>
        #{cxdg},
      </if>
      <if test='null != ljcdxjj'>
        #{ljcdxjj},
      </if>
      <if test='null != hdxjzt'>
        #{hdxjzt},
      </if>
      <if test='null != hdxjztGzms'>
        #{hdxjztGzms},
      </if>
      <if test='null != zxwxjq'>
        #{zxwxjq},
      </if>
      <if test='null != cxwxjq'>
        #{cxwxjq},
      </if>
      <if test='null != zxwxjqzt'>
        #{zxwxjqzt},
      </if>
      <if test='null != cxwxjqzt'>
        #{cxwxjqzt},
      </if>
      <if test='null != dljzt'>
        #{dljzt},
      </if>
      <if test='null != dljztGzms'>
        #{dljztGzms},
      </if>
      <if test='null != azzxlcz'>
        #{azzxlcz},
      </if>
      <if test='null != azzxdg'>
        #{azzxdg},
      </if>
      <if test='null != azcxlcz'>
        #{azcxlcz},
      </if>
      <if test='null != azcxdg'>
        #{azcxdg},
      </if>
      <if test='null != bzzxlcz'>
        #{bzzxlcz},
      </if>
      <if test='null != bzzxdg'>
        #{bzzxdg},
      </if>
      <if test='null != bzcxlcz'>
        #{bzcxlcz},
      </if>
      <if test='null != bzcxdg'>
        #{bzcxdg},
      </if>
      <if test='null != czzxlcz'>
        #{czzxlcz},
      </if>
      <if test='null != czzxdg'>
        #{czzxdg},
      </if>
      <if test='null != czcxlcz'>
        #{czcxlcz},
      </if>
      <if test='null != czcxdg'>
        #{czcxdg},
      </if>
      <if test='null != sbzt'>
        #{sbzt},
      </if>
      <if test='null != checkUser'>
        #{checkUser},
      </if>
      <if test='null != czwt'>
        #{czwt},
      </if>
      <if test='null != submitState'>
        #{submitState},
      </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 != userId'>
        #{userId},
      </if>
      <if test='null != delFlag'>
        #{delFlag}
      </if>
    </trim>
  </insert>

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

  <update id="update" parameterType="com.railway.business.catenary.domain.BusJcbWjcxc">
    UPDATE bus_jcb_wjcxc
    <set>
      <if test='null != deptStationId'>dept_station_id = #{deptStationId},</if>
      <if test='null != pillarCode'>pillar_code = #{pillarCode},</if>
      <if test='null != xch'>xc_id = #{xcId},</if>
      <if test='null != xch'>xch = #{xch},</if>
      <if test='null != temperature'>temperature = #{temperature},</if>
      <if test='null != checkDate'>check_date = #{checkDate},</if>
      <if test='null != jcdxzt'>jcdxzt = #{jcdxzt},</if>
      <if test='null != jcdxztGzms'>jcdxzt_gzms = #{jcdxztGzms},</if>
      <if test='null != wxjqzt'>wxjqzt = #{wxjqzt},</if>
      <if test='null != wxjqztGzms'>wxjqzt_gzms = #{wxjqztGzms},</if>
      <if test='null != zxlcz'>zxlcz = #{zxlcz},</if>
      <if test='null != zxdg'>zxdg = #{zxdg},</if>
      <if test='null != cxlcz'>cxlcz = #{cxlcz},</if>
      <if test='null != cxdg'>cxdg = #{cxdg},</if>
      <if test='null != ljcdxjj'>cxdg = #{ljcdxjj},</if>
      <if test='null != hdxjzt'>hdxjzt = #{hdxjzt},</if>
      <if test='null != hdxjztGzms'>hdxjzt_gzms = #{hdxjztGzms},</if>
      <if test='null != zxwxjq'>zxwxjq = #{zxwxjq},</if>
      <if test='null != cxwxjq'>cxwxjq = #{cxwxjq},</if>
      <if test='null != zxwxjqzt'>zxwxjqzt = #{zxwxjqzt},</if>
      <if test='null != cxwxjqzt'>cxwxjqzt = #{cxwxjqzt},</if>
      <if test='null != dljzt'>dljzt = #{dljzt},</if>
      <if test='null != dljztGzms'>dljzt_gzms = #{dljztGzms},</if>
      <if test='null != azzxlcz'>azzxlcz = #{azzxlcz},</if>
      <if test='null != azzxdg'>azzxdg = #{azzxdg},</if>
      <if test='null != azcxlcz'>azcxlcz = #{azcxlcz},</if>
      <if test='null != azcxdg'>azcxdg = #{azcxdg},</if>
      <if test='null != bzzxlcz'>bzzxlcz = #{bzzxlcz},</if>
      <if test='null != bzzxdg'>bzzxdg = #{bzzxdg},</if>
      <if test='null != bzcxlcz'>bzcxlcz = #{bzcxlcz},</if>
      <if test='null != bzcxdg'>bzcxdg = #{bzcxdg},</if>
      <if test='null != czzxlcz'>czzxlcz = #{czzxlcz},</if>
      <if test='null != czzxdg'>czzxdg = #{czzxdg},</if>
      <if test='null != czcxlcz'>czcxlcz = #{czcxlcz},</if>
      <if test='null != czcxdg'>czcxdg = #{czcxdg},</if>
      <if test='null != sbzt'>sbzt = #{sbzt},</if>
      <if test='null != checkUser'>check_user = #{checkUser},</if>
      <if test='null != czwt'>czwt = #{czwt},</if>
      <if test='null != submitState'>submit_state = #{submitState},</if>
      <if test='null != updateBy'>update_by = #{updateBy},</if>
      <if test='null != updateTime'>update_time = #{updateTime},</if>
      <if test='null != userId'>user_id = #{userId},</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"/>
    FROM bus_jcb_wjcxc t
    LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
    WHERE t.del_flag='0' and t.id = #{id}

  </select>

  <select id="getLastRecord" resultMap="BaseResultMap">
    SELECT
    a.zxlcz, a.zxdg, a.cxlcz, a.cxdg, a.zxwxjq, a.cxwxjq, a.azzxlcz, a.azzxdg, a.azcxlcz, a.azcxdg,
    a.bzzxlcz, a.bzzxdg, a.bzcxlcz, a.bzcxdg,a.czzxlcz, a.czzxdg, a.czcxlcz, a.czcxdg
    FROM bus_jcb_wjcxc a,
    (
    select max(update_time) as lastTime
    from bus_jcb_wjcxc
    WHERE user_id = #{user_id}
    and submit_state != '0'
    ) b
    WHERE a.update_time = b.lastTime

  </select>

  <select id="getList" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>
    FROM bus_jcb_wjcxc t
    LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
    <where>
      t.del_flag='0'
      <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="xch!=null and xch!=''">
        and t.xch=#{xch}
      </if>
      <if test="temperature!=null and temperature!=''">
        and t.temperature=#{temperature}
      </if>
      <if test="checkDate!=null">
        and t.check_date=#{checkDate}
      </if>
      <if test="jcdxzt!=null and jcdxzt!=''">
        and t.jcdxzt=#{jcdxzt}
      </if>
      <if test="jcdxztGzms!=null and jcdxztGzms!=''">
        and t.jcdxzt_gzms=#{jcdxztGzms}
      </if>
      <if test="wxjqzt!=null and wxjqzt!=''">
        and t.wxjqzt=#{wxjqzt}
      </if>
      <if test="wxjqztGzms!=null and wxjqztGzms!=''">
        and t.wxjqzt_gzms=#{wxjqztGzms}
      </if>
      <if test="zxlcz!=null and zxlcz!=''">
        and t.zxlcz=#{zxlcz}
      </if>
      <if test="zxdg!=null and zxdg!=''">
        and t.zxdg=#{zxdg}
      </if>
      <if test="cxlcz!=null and cxlcz!=''">
        and t.cxlcz=#{cxlcz}
      </if>
      <if test="cxdg!=null and cxdg!=''">
        and t.cxdg=#{cxdg}
      </if>
      <if test="ljcdxjj!=null and ljcdxjj!=''">
        and t.ljcdxjj=#{ljcdxjj}
      </if>
      <if test="hdxjzt!=null and hdxjzt!=''">
        and t.hdxjzt=#{hdxjzt}
      </if>
      <if test="hdxjztGzms!=null and hdxjztGzms!=''">
        and t.hdxjzt_gzms=#{hdxjztGzms}
      </if>
      <if test="zxwxjq!=null and zxwxjq!=''">
        and t.zxwxjq=#{zxwxjq}
      </if>
      <if test="cxwxjq!=null and cxwxjq!=''">
        and t.cxwxjq=#{cxwxjq}
      </if>
      <if test="zxwxjqzt!=null and zxwxjqzt!=''">
        and t.zxwxjqzt=#{zxwxjqzt}
      </if>
      <if test="cxwxjqzt!=null and cxwxjqzt!=''">
        and t.cxwxjqzt=#{cxwxjqzt}
      </if>
      <if test="dljzt!=null and dljzt!=''">
        and t.dljzt=#{dljzt}
      </if>
      <if test="dljztGzms!=null and dljztGzms!=''">
        and t.dljzt_gzms=#{dljztGzms}
      </if>
      <if test="azzxlcz!=null and azzxlcz!=''">
        and t.azzxlcz=#{azzxlcz}
      </if>
      <if test="azzxdg!=null and azzxdg!=''">
        and t.azzxdg=#{azzxdg}
      </if>
      <if test="azcxlcz!=null and azcxlcz!=''">
        and t.azcxlcz=#{azcxlcz}
      </if>
      <if test="azcxdg!=null and azcxdg!=''">
        and t.azcxdg=#{azcxdg}
      </if>
      <if test="bzzxlcz!=null and bzzxlcz!=''">
        and t.bzzxlcz=#{bzzxlcz}
      </if>
      <if test="bzzxdg!=null and bzzxdg!=''">
        and t.bzzxdg=#{bzzxdg}
      </if>
      <if test="bzcxlcz!=null and bzcxlcz!=''">
        and t.bzcxlcz=#{bzcxlcz}
      </if>
      <if test="bzcxdg!=null and bzcxdg!=''">
        and t.bzcxdg=#{bzcxdg}
      </if>
      <if test="czzxlcz!=null and czzxlcz!=''">
        and t.czzxlcz=#{czzxlcz}
      </if>
      <if test="czzxdg!=null and czzxdg!=''">
        and t.czzxdg=#{czzxdg}
      </if>
      <if test="czcxlcz!=null and czcxlcz!=''">
        and t.czcxlcz=#{czcxlcz}
      </if>
      <if test="czcxdg!=null and czcxdg!=''">
        and t.czcxdg=#{czcxdg}
      </if>
      <if test="sbzt!=null and sbzt!=''">
        and t.sbzt=#{sbzt}
      </if>
      <if test="checkUser!=null and checkUser!=''">
        and t.check_user=#{checkUser}
      </if>
      <if test="czwt!=null and czwt!=''">
        and t.czwt=#{czwt}
      </if>
      <if test="submitState!=null and submitState!=''">
        and t.submit_state <![CDATA[ >= ]]> #{submitState}
      </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="userId!=null and userId!=''">
        and t.user_id=#{userId}
      </if>
      <if test="delFlag!=null and delFlag!=''">
        and t.del_flag=#{delFlag}
      </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="getJcebList" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>
    FROM bus_jcb_wjcxc 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="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_wjcxc 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_wjcxc 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>