<?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.devplatform.equipment.modules.listation.dao.LiStationDao">
  <!-- Result Map -->
  <resultMap id="BaseResultMap" type="com.devplatform.equipment.modules.listation.bean.LiStation">
    <result column="id" property="id"/>
    <result column="line_id" property="lineId"/>
    <result column="line_name" property="lineName"/>
    <result column="station_name" property="stationName"/>
    <result column="code" property="code"/>
    <result column="short_name" property="shortName"/>
    <result column="x" property="x"/>
    <result column="y" property="y"/>
    <result column="location" property="location"/>
    <result column="icon" property="icon"/>
    <result column="type" property="type"/>
    <result column="remark" property="remark"/>
    <result column="is_master" property="isMaster"/>
    <result column="order_num" property="orderNum"/>
    <result column="sys_sign" property="sysSign"/>
    <result column="status" property="status"/>
    <result column="deleted" property="deleted"/>
    <result column="create_user_id" property="createUserId"/>
    <result column="create_time" property="createTime"/>
    <result column="update_user_id" property="updateUserId"/>
    <result column="update_time" property="updateTime"/>
    <result column="byx1" property="byx1"/>
    <result column="byx2" property="byx2"/>
    <result column="byx3" property="byx3"/>

    <result column="coordinate_x" property="coordinateX"/>
    <result column="coordinate_y" property="coordinateY"/>
    <result column="text_position" property="textPosition"/>
    <result column="line_color" property="lineColor"/>
    <result column="line_code" property="lineCode"/>
  </resultMap>

  <!-- li_station table all fields -->
  <sql id="Base_Column_List">
		id,line_id,line_name,station_name,code,short_name,x,y,location,icon,type,remark,order_num,sys_sign,status,deleted,create_user_id,create_time,update_user_id,update_time,byx1,byx2,byx3
		,coordinate_x,coordinate_y,text_position,line_color,line_code,is_master
	</sql>

  <!-- 公共查询条件 -->
  <sql id="Example_Where_Clause">
    where deleted=0
    <if test="id!=null and id!=''">and id = #{id}</if>
    <if test="lineId!=null and lineId!=''">and line_id = #{lineId}</if>
    <if test="lineName!=null and lineName!=''">and line_name = #{lineName}</if>
    <if test="stationName!=null and stationName!=''">and station_name = #{stationName}</if>
    <if test="code!=null and code!=''">and code = #{code}</if>
    <if test="shortName!=null and shortName!=''">and short_name = #{shortName}</if>
    <if test="x!=null and x!=''">and x = #{x}</if>
    <if test="y!=null and y!=''">and y = #{y}</if>
    <if test="location!=null and location!=''">and location = #{location}</if>
    <if test="icon!=null and icon!=''">and icon = #{icon}</if>
    <if test="type!=null and type!=''">and type = #{type}</if>
    <if test="remark!=null and remark!=''">and remark = #{remark}</if>
    <if test="isMaster!=null ">and is_master = #{isMaster}</if>
    <if test="orderNum!=null ">and order_num = #{orderNum}</if>
    <if test="sysSign!=null and sysSign!=''">and sys_sign = #{sysSign}</if>
    <if test="status!=null ">and status = #{status}</if>
    <if test="deleted!=null ">and deleted = #{deleted}</if>
    <if test="createUserId!=null and createUserId!=''">and create_user_id = #{createUserId}</if>
    <if test="createTime!=null ">and create_time = #{createTime}</if>
    <if test="updateUserId!=null and updateUserId!=''">and update_user_id = #{updateUserId}</if>
    <if test="updateTime!=null ">and update_time = #{updateTime}</if>
    <if test="byx1!=null and byx1!=''">and byx1 = #{byx1}</if>
    <if test="byx2!=null and byx2!=''">and byx2 = #{byx2}</if>
    <if test="byx3!=null and byx3!=''">and byx3 = #{byx3}</if>

    <if test="coordinateX!=null">and coordinate_x = #{coordinateX}</if>
    <if test="coordinateY!=null">and coordinate_y = #{coordinateY}</if>
    <if test="textPosition!=null">and text_position = #{textPosition}</if>
    <if test="lineColor!=null and lineColor!=''">and line_color = #{lineColor}</if>
    <if test="lineCode!=null and lineCode!=''">and line_code = #{lineCode}</if>
  </sql>

  <!--查询总数-->
  <select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer">
    select count(1) from li_station
    <include refid="queryPageByListClause"></include>
  </select>

  <select id="queryPageByList" parameterType="Object" resultMap="BaseResultMap">
    select * from li_station
    <include refid="queryPageByListClause"></include>
    <if test="pager.orderCondition != null and pager.orderCondition != ''">
      ${pager.orderCondition}
    </if>
    <if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''">
      ${pager.mysqlQueryCondition}
    </if>
  </select>

  <!-- 公共查询条件 -->
  <sql id="queryPageByListClause">
    where deleted=0
    <if test="id!=null and id!=''">and id = #{id}</if>
    <if test="lineId!=null and lineId!=''">and line_id = #{lineId}</if>
    <if test="lineName!=null and lineName!=''">and line_name = #{lineName}</if>
    <if test="stationName!=null and stationName!=''">and station_name = #{stationName}</if>
    <if test="code!=null and code!=''">and code = #{code}</if>
    <if test="shortName!=null and shortName!=''">and short_name = #{shortName}</if>
    <if test="x!=null and x!=''">and x = #{x}</if>
    <if test="y!=null and y!=''">and y = #{y}</if>
    <if test="location!=null and location!=''">and location = #{location}</if>
    <if test="icon!=null and icon!=''">and icon = #{icon}</if>
    <if test="type!=null and type!=''">and type = #{type}</if>
    <if test="remark!=null and remark!=''">and remark = #{remark}</if>
    <if test="isMaster!=null ">and is_master = #{isMaster}</if>
    <if test="orderNum!=null ">and order_num = #{orderNum}</if>
    <if test="sysSign!=null and sysSign!=''">and sys_sign = #{sysSign}</if>
    <if test="status!=null ">and status = #{status}</if>
    <if test="deleted!=null ">and deleted = #{deleted}</if>
    <if test="createUserId!=null and createUserId!=''">and create_user_id = #{createUserId}</if>
    <if test="createTime!=null ">and create_time = #{createTime}</if>
    <if test="updateUserId!=null and updateUserId!=''">and update_user_id = #{updateUserId}</if>
    <if test="updateTime!=null ">and update_time = #{updateTime}</if>
    <if test="byx1!=null and byx1!=''">and byx1 = #{byx1}</if>
    <if test="byx2!=null and byx2!=''">and byx2 = #{byx2}</if>
    <if test="byx3!=null and byx3!=''">and byx3 = #{byx3}</if>

    <if test="coordinateX!=null">and coordinate_x = #{coordinateX}</if>
    <if test="coordinateY!=null">and coordinate_y = #{coordinateY}</if>
    <if test="textPosition!=null">and text_position = #{textPosition}</if>
    <if test="lineColor!=null and lineColor!=''">and line_color = #{lineColor}</if>
    <if test="lineCode!=null and lineCode!=''">and line_code = #{lineCode}</if>
  </sql>

  <select id="getTreeList" parameterType="Object" resultMap="BaseResultMap">
    select id,station_name,code,line_id,line_name from li_station
    <include refid="queryPageByListClause"></include>
    order by order_num
  </select>
</mapper>


