<?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.baseinfo.mapper.BusFdfxjyqMapper">

  <resultMap id="BaseResultMap" type="com.railway.business.baseinfo.domain.BusFdfxjyq">
    <result column="id" property="id"/>
    <result column="dept_id" property="deptId"/>
    <result column="dept_name" property="deptName"/>
    <result column="line_id" property="lineId"/>
    <result column="line_name" property="lineName"/>
    <result column="station_id" property="stationId"/>
    <result column="station_name" property="stationName"/>
    <result column="dept_station_id" property="deptStationId"/>
    <result column="xingbie" property="xingbie"/>
    <result column="xingbie_text" property="xingbieText"/>
    <result column="pillar_area" property="pillarArea"/>
    <result column="station_track" property="stationTrack"/>
    <result column="gxms" property="gxms"/>
    <result column="marker" property="marker"/>
    <result column="dch" property="dch"/>
    <result column="lx" property="lx"/>
    <result column="remark" property="remark"/>
    <result column="jyqbh" property="jyqbh"/>
    <result column="jyqxh" property="jyqxh"/>
    <result column="sccj" property="sccj"/>
    <result column="ccrq" property="ccrq"/>
    <result column="tyrq" property="tyrq"/>
    <result column="sysm" property="sysm"/>
    <result column="clsjyzlx" property="clsjyzlx"/>
    <result column="clsjyzzt" property="clsjyzzt"/>
    <result column="fdzjyzt" property="fdzjyzt"/>
    <result column="jyhdzt" property="jyhdzt"/>
    <result column="jshdmszt" property="jshdmszt"/>
    <result column="kqjx_scz" property="kqjxScz"/>
    <result column="kqjx_bzz" property="kqjxBzz"/>
    <result column="xgbzt" property="xgbzt"/>
    <result column="xdzzzt" property="xdzzzt"/>
    <result column="yxlzxxpy_scz" property="yxlzxxpyScz"/>
    <result column="yxlzxxpy_bzz" property="yxlzxxpyBzz"/>
    <result column="ygmlxsfpx" property="ygmlxsfpx"/>
    <result column="fcd_scz" property="fcdScz"/>
    <result column="fcd_bzz" property="fcdBzz"/>
    <result column="jtjgljbwzt" property="jtjgljbwzt"/>
    <result column="jcxjcdxmhqk" property="jcxjcdxmhqk"/>
    <result column="jcxjtxjlslm" property="jcxjtxjlslm"/>
    <result column="gdsfph" property="gdsfph"/>
    <result column="qt" property="qt"/>
    <result column="fj" property="fj"/>
    <result column="sl" property="sl"/>
    <result column="dw" property="dw"/>
    <result column="fdazwz" property="fdazwz"/>
    <result column="sjbh" property="sjbh"/>
    <result column="del_flag" property="delFlag"/>
    <result column="create_by" property="createBy"/>
    <result column="create_time" property="createTime"/>
    <result column="update_by" property="updateBy"/>
    <result column="update_time" property="updateTime"/>
  </resultMap>

  <sql id="Base_Column_List">
    t.id,
    v.dept_id,
    v.dept_name,
    v.line_id,
    v.line_name,
    v.station_name as station_name,
    v.station_id,
    t.dept_station_id,
    t.xingbie,
    t.pillar_area,
    t.marker,
    t.station_track,
    t.gxms,
    t.dch,
    t.lx,
    t.remark,
    t.jyqbh,
    t.jyqxh,
    t.sccj,
    t.ccrq,
    t.tyrq,
    t.sysm,
    t.clsjyzlx,
    t.clsjyzzt,
    t.fdzjyzt,
    t.jyhdzt,
    t.jshdmszt,
    t.kqjx_scz,
    t.kqjx_bzz,
    t.xgbzt,
    t.xdzzzt,
    t.yxlzxxpy_scz,
    t.yxlzxxpy_bzz,
    t.ygmlxsfpx,
    t.fcd_scz,
    t.fcd_bzz,
    t.jtjgljbwzt,
    t.jcxjcdxmhqk,
    t.jcxjtxjlslm,
    t.gdsfph,
    t.qt,
    t.fj,
    t.sl,
    t.dw,
    t.fdazwz,
    t.sjbh,
    t.del_flag,
    t.create_by,
    t.create_time,
    t.update_by,
    t.update_time
  </sql>

  <insert id="insert" parameterType="com.railway.business.baseinfo.domain.BusFdfxjyq">
    <selectKey keyProperty="id" order="AFTER" resultType="Long">
      select @@IDENTITY as id
    </selectKey>
    INSERT INTO base_fdfxjyq
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test='null != deptStationId'>
        dept_station_id,
      </if>
      <if test='null != xingbie'>
        xingbie,
      </if>
      <if test='null != pillarArea'>
        pillarArea,
      </if>
      <if test='null != stationTrack'>
        station_track,
      </if>
      <if test='null != gxms'>
        gxms,
      </if>
      <if test='null != marker'>
        marker,
      </if>
      <if test='null != dch'>
        dch,
      </if>
      <if test='null != lx'>
        lx,
      </if>
      <if test='null != remark'>
        remark,
      </if>
      <if test='null != jyqbh'>
        jyqbh,
      </if>
      <if test='null != jyqxh'>
        jyqxh,
      </if>
      <if test='null != sccj'>
        sccj,
      </if>
      <if test='null != ccrq'>
        ccrq,
      </if>
      <if test='null != tyrq'>
        tyrq,
      </if>
      <if test='null != sysm'>
        sysm,
      </if>
      <if test='null != clsjyzlx'>
        clsjyzlx,
      </if>
      <if test='null != clsjyzzt'>
        clsjyzzt,
      </if>
      <if test='null != fdzjyzt'>
        fdzjyzt,
      </if>
      <if test='null != jyhdzt'>
        jyhdzt,
      </if>
      <if test='null != jshdmszt'>
        jshdmszt,
      </if>
      <if test='null != kqjxScz'>
        kqjx_scz,
      </if>
      <if test='null != kqjxBzz'>
        kqjx_bzz,
      </if>
      <if test='null != xgbzt'>
        xgbzt,
      </if>
      <if test='null != xdzzzt'>
        xdzzzt,
      </if>
      <if test='null != yxlzxxpyScz'>
        yxlzxxpy_scz,
      </if>
      <if test='null != yxlzxxpyBzz'>
        yxlzxxpy_bzz,
      </if>
      <if test='null != ygmlxsfpx'>
        ygmlxsfpx,
      </if>
      <if test='null != fcdScz'>
        fcd_scz,
      </if>
      <if test='null != fcdBzz'>
        fcd_bzz,
      </if>
      <if test='null != jtjgljbwzt'>
        jtjgljbwzt,
      </if>
      <if test='null != jcxjcdxmhqk'>
        jcxjcdxmhqk,
      </if>
      <if test='null != jcxjtxjlslm'>
        jcxjtxjlslm,
      </if>
      <if test='null != gdsfph'>
        gdsfph,
      </if>
      <if test='null != qt'>
        qt,
      </if>
      <if test='null != fj'>
        fj,
      </if>
      <if test='null != sl'>
        sl,
      </if>
      <if test='null != dw'>
        dw,
      </if>
      <if test='null != fdazwz'>
        fdazwz,
      </if>
      <if test='null != sjbh'>
        sjbh,
      </if>
      <if test='null != delFlag'>
        del_flag,
      </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>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test='null != deptStationId'>
        #{deptStationId},
      </if>
      <if test='null != xingbie'>
        #{xingbie},
      </if>
      <if test='null != pillarArea'>
        #{pillarArea},
      </if>
      <if test='null != stationTrack'>
        #{stationTrack},
      </if>
      <if test='null != gxms'>
        #{gxms},
      </if>
      <if test='null != marker'>
        #{marker},
      </if>
      <if test='null != dch'>
        #{dch},
      </if>
      <if test='null != lx'>
        #{lx},
      </if>
      <if test='null != remark'>
        #{remark},
      </if>
      <if test='null != jyqbh'>
        #{jyqbh},
      </if>
      <if test='null != jyqxh'>
        #{jyqxh},
      </if>
      <if test='null != sccj'>
        #{sccj},
      </if>
      <if test='null != ccrq'>
        #{ccrq},
      </if>
      <if test='null != tyrq'>
        #{tyrq},
      </if>
      <if test='null != sysm'>
        #{sysm},
      </if>
      <if test='null != clsjyzlx'>
        #{clsjyzlx},
      </if>
      <if test='null != clsjyzzt'>
        #{clsjyzzt},
      </if>
      <if test='null != fdzjyzt'>
        #{fdzjyzt},
      </if>
      <if test='null != jyhdzt'>
        #{jyhdzt},
      </if>
      <if test='null != jshdmszt'>
        #{jshdmszt},
      </if>
      <if test='null != kqjxScz'>
        #{kqjxScz},
      </if>
      <if test='null != kqjxBzz'>
        #{kqjxBzz},
      </if>
      <if test='null != xgbzt'>
        #{xgbzt},
      </if>
      <if test='null != xdzzzt'>
        #{xdzzzt},
      </if>
      <if test='null != yxlzxxpyScz'>
        #{yxlzxxpyScz},
      </if>
      <if test='null != yxlzxxpyBzz'>
        #{yxlzxxpyBzz},
      </if>
      <if test='null != ygmlxsfpx'>
        #{ygmlxsfpx},
      </if>
      <if test='null != fcdScz'>
        #{fcdScz},
      </if>
      <if test='null != fcdBzz'>
        #{fcdBzz},
      </if>
      <if test='null != jtjgljbwzt'>
        #{jtjgljbwzt},
      </if>
      <if test='null != jcxjcdxmhqk'>
        #{jcxjcdxmhqk},
      </if>
      <if test='null != jcxjtxjlslm'>
        #{jcxjtxjlslm},
      </if>
      <if test='null != gdsfph'>
        #{gdsfph},
      </if>
      <if test='null != qt'>
        #{qt},
      </if>
      <if test='null != fj'>
        #{fj},
      </if>
      <if test='null != sl'>
        #{sl},
      </if>
      <if test='null != dw'>
        #{dw},
      </if>
      <if test='null != fdazwz'>
        #{fdazwz},
      </if>
      <if test='null != sjbh'>
        #{sjbh},
      </if>
      <if test='null != delFlag'>
        #{delFlag},
      </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>
    </trim>
  </insert>

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

  <update id="update" parameterType="com.railway.business.baseinfo.domain.BusFdfxjyq">
    UPDATE base_fdfxjyq
    <set>
      <if test='null != deptStationId'>dept_station_id = #{deptStationId},</if>
      <if test='null != xingbie'>xingbie = #{xingbie},</if>
      <if test='null != pillarArea'>pillar_area = #{pillarArea},</if>
      <if test='null != marker'>marker = #{marker},</if>
      <if test='null != stationTrack'>station_track = #{stationTrack},</if>
      <if test='null != gxms'>gxms = #{gxms},</if>
      <if test='null != dch'>dch = #{dch},</if>
      <if test='null != lx'>lx = #{lx},</if>
      <if test='null != remark'>remark = #{remark},</if>
      <if test='null != jyqbh'>jyqbh = #{jyqbh},</if>
      <if test='null != jyqxh'>jyqxh = #{jyqxh},</if>
      <if test='null != sccj'>sccj = #{sccj},</if>
      <if test='null != ccrq'>ccrq = #{ccrq},</if>
      <if test='null != tyrq'>tyrq = #{tyrq},</if>
      <if test='null != sysm'>sysm = #{sysm},</if>
      <if test='null != clsjyzlx'>clsjyzlx = #{clsjyzlx},</if>
      <if test='null != clsjyzzt'>clsjyzzt = #{clsjyzzt},</if>
      <if test='null != fdzjyzt'>fdzjyzt = #{fdzjyzt},</if>
      <if test='null != jyhdzt'>jyhdzt = #{jyhdzt},</if>
      <if test='null != jshdmszt'>jshdmszt = #{jshdmszt},</if>
      <if test='null != kqjxScz'>kqjx_scz = #{kqjxScz},</if>
      <if test='null != kqjxBzz'>kqjx_bzz = #{kqjxBzz},</if>
      <if test='null != xgbzt'>xgbzt = #{xgbzt},</if>
      <if test='null != xdzzzt'>xdzzzt = #{xdzzzt},</if>
      <if test='null != yxlzxxpyScz'>yxlzxxpy_scz = #{yxlzxxpyScz},</if>
      <if test='null != yxlzxxpyBzz'>yxlzxxpy_bzz = #{yxlzxxpyBzz},</if>
      <if test='null != ygmlxsfpx'>ygmlxsfpx = #{ygmlxsfpx},</if>
      <if test='null != fcdScz'>fcd_scz = #{fcdScz},</if>
      <if test='null != fcdBzz'>fcd_bzz = #{fcdBzz},</if>
      <if test='null != jtjgljbwzt'>jtjgljbwzt = #{jtjgljbwzt},</if>
      <if test='null != jcxjcdxmhqk'>jcxjcdxmhqk = #{jcxjcdxmhqk},</if>
      <if test='null != jcxjtxjlslm'>jcxjtxjlslm = #{jcxjtxjlslm},</if>
      <if test='null != gdsfph'>gdsfph = #{gdsfph},</if>
      <if test='null != qt'>qt = #{qt},</if>
      <if test='null != fj'>fj = #{fj},</if>
      <if test='null != sl'>sl = #{sl},</if>
      <if test='null != dw'>dw = #{dw},</if>
      <if test='null != fdazwz'>fdazwz = #{fdazwz},</if>
      <if test='null != sjbh'>sjbh = #{sjbh},</if>
      <if test='null != delFlag'>del_flag = #{delFlag},</if>
      <if test='null != updateBy'>update_by = #{updateBy},</if>
      <if test='null != updateTime'>update_time = #{updateTime}</if>
    </set>
    WHERE id = #{id}
  </update>


  <select id="getInfo" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>, dict.dict_label as xingbie_text
    FROM base_fdfxjyq t
    LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
    LEFT JOIN sys_dict_data dict ON (t.xingbie = dict.dict_value AND dict.dict_type = 'xingbie')
    WHERE t.del_flag='0' and t.id = #{id}

  </select>

  <select id="getList" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>, dict.dict_label as xingbie_text
    FROM base_fdfxjyq t
    LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
    LEFT JOIN sys_dict_data dict ON (t.xingbie = dict.dict_value AND dict.dict_type = 'xingbie')
    <where>
      t.del_flag='0'
      <if test="deptId!=null and deptId!=''">
        and v.dept_id=#{deptId}
      </if>
      <if test="lineId!=null and lineId!=''">
        and v.line_id=#{lineId}
      </if>
      <if test="stationId!=null and stationId!=''">
        and v.station_id=#{stationId}
      </if>
      <if test="xingbie!=null and xingbie!=''">
        and t.xingbie=#{xingbie}
      </if>
      <if test="pillarArea!=null and pillarArea!=''">
        and t.pillar_area=#{pillarArea}
      </if>
      <if test="marker!=null and marker!=''">
        and t.marker=#{marker}
      </if>
      <if test="stationTrack!=null and stationTrack!=''">
        and t.station_track=#{stationTrack}
      </if>
      <if test="gxms!=null and gxms!=''">
        and gxms=#{gxms}
      </if>
      <if test="dch!=null and dch!=''">
        and dch=#{dch}
      </if>
      <if test="lx!=null and lx!=''">
        and lx=#{lx}
      </if>
      <if test="remark!=null and remark!=''">
        and remark=#{remark}
      </if>
      <if test="jyqbh!=null and jyqbh!=''">
        and jyqbh=#{jyqbh}
      </if>
      <if test="jyqxh!=null and jyqxh!=''">
        and jyqxh=#{jyqxh}
      </if>
      <if test="sccj!=null and sccj!=''">
        and sccj=#{sccj}
      </if>
      <if test="ccrq!=null and ccrq!=''">
        and ccrq=#{ccrq}
      </if>
      <if test="tyrq!=null and tyrq!=''">
        and tyrq=#{tyrq}
      </if>
      <if test="sysm!=null and sysm!=''">
        and sysm=#{sysm}
      </if>
      <if test="clsjyzlx!=null and clsjyzlx!=''">
        and clsjyzlx=#{clsjyzlx}
      </if>
      <if test="clsjyzzt!=null and clsjyzzt!=''">
        and clsjyzzt=#{clsjyzzt}
      </if>
      <if test="fdzjyzt!=null and fdzjyzt!=''">
        and fdzjyzt=#{fdzjyzt}
      </if>
      <if test="jyhdzt!=null and jyhdzt!=''">
        and jyhdzt=#{jyhdzt}
      </if>
      <if test="jshdmszt!=null and jshdmszt!=''">
        and jshdmszt=#{jshdmszt}
      </if>
      <if test="kqjxScz!=null and kqjxScz!=''">
        and kqjx_scz=#{kqjxScz}
      </if>
      <if test="kqjxBzz!=null and kqjxBzz!=''">
        and kqjx_bzz=#{kqjxBzz}
      </if>
      <if test="xgbzt!=null and xgbzt!=''">
        and xgbzt=#{xgbzt}
      </if>
      <if test="xdzzzt!=null and xdzzzt!=''">
        and xdzzzt=#{xdzzzt}
      </if>
      <if test="yxlzxxpyScz!=null and yxlzxxpyScz!=''">
        and yxlzxxpy_scz=#{yxlzxxpyScz}
      </if>
      <if test="yxlzxxpyBzz!=null and yxlzxxpyBzz!=''">
        and yxlzxxpy_bzz=#{yxlzxxpyBzz}
      </if>
      <if test="ygmlxsfpx!=null and ygmlxsfpx!=''">
        and ygmlxsfpx=#{ygmlxsfpx}
      </if>
      <if test="fcdScz!=null and fcdScz!=''">
        and fcd_scz=#{fcdScz}
      </if>
      <if test="fcdBzz!=null and fcdBzz!=''">
        and fcd_bzz=#{fcdBzz}
      </if>
      <if test="jtjgljbwzt!=null and jtjgljbwzt!=''">
        and jtjgljbwzt=#{jtjgljbwzt}
      </if>
      <if test="jcxjcdxmhqk!=null and jcxjcdxmhqk!=''">
        and jcxjcdxmhqk=#{jcxjcdxmhqk}
      </if>
      <if test="jcxjtxjlslm!=null and jcxjtxjlslm!=''">
        and jcxjtxjlslm=#{jcxjtxjlslm}
      </if>
      <if test="gdsfph!=null and gdsfph!=''">
        and gdsfph=#{gdsfph}
      </if>
      <if test="qt!=null and qt!=''">
        and qt=#{qt}
      </if>
      <if test="fj!=null and fj!=''">
        and fj=#{fj}
      </if>
      <if test="sl!=null and sl!=''">
        and sl=#{sl}
      </if>
      <if test="dw!=null and dw!=''">
        and dw=#{dw}
      </if>
      <if test="fdazwz!=null and fdazwz!=''">
        and fdazwz=#{fdazwz}
      </if>
      <if test="sjbh!=null and sjbh!=''">
        and sjbh=#{sjbh}
      </if>
      <if test="delFlag!=null and delFlag!=''">
        and del_flag=#{delFlag}
      </if>
      <if test="createBy!=null and createBy!=''">
        and create_by=#{createBy}
      </if>
      <if test="createTime!=null">
        and create_time=#{createTime}
      </if>
      <if test="updateBy!=null and updateBy!=''">
        and update_by=#{updateBy}
      </if>
      <if test="updateTime!=null">
        and update_time=#{updateTime}
      </if>
    </where>
  </select>

</mapper>