<?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.hzya.frame.plugin.cinvoice.lexmis.dao.impl.LexmiscivTrainticketDaoImpl">
	<resultMap id="get-LexmiscivTrainticketEntity-result" type="com.hzya.frame.plugin.cinvoice.lexmis.entity.LexmiscivTrainticketEntity">
		<!--无备注 -->
		<result property="TT_ID" column="TT_ID" />
		<!--无备注 -->
		<result property="TT_CODE" column="TT_CODE" />
		<!--无备注 -->
		<result property="TT_NO" column="TT_NO" />
		<!--无备注 -->
		<result property="TT_FSTATION" column="TT_FSTATION" />
		<!--无备注 -->
		<result property="TT_TSTATION" column="TT_TSTATION" />
		<!--无备注 -->
		<result property="TT_AMOUNT" column="TT_AMOUNT" />
		<!--无备注 -->
		<result property="TT_TAXRATE" column="TT_TAXRATE" />
		<!--无备注 -->
		<result property="TT_TAXRATEAMOUNT" column="TT_TAXRATEAMOUNT" />
		<!--无备注 -->
		<result property="TT_NOTAXAMOUNT" column="TT_NOTAXAMOUNT" />
		<!--无备注 -->
		<result property="TT_DATE" column="TT_DATE" />
		<!--无备注 -->
		<result property="TT_TIME" column="TT_TIME" />
		<!--无备注 -->
		<result property="TT_SERIALNO" column="TT_SERIALNO" />
		<!--无备注 -->
		<result property="TT_IDNO" column="TT_IDNO" />
		<!--无备注 -->
		<result property="TT_CUSTOMER" column="TT_CUSTOMER" />
		<!--无备注 -->
		<result property="TT_SALESTATION" column="TT_SALESTATION" />
		<!--无备注 -->
		<result property="TT_SALETYPE" column="TT_SALETYPE" />
		<!--无备注 -->
		<result property="TT_CARRIAGE" column="TT_CARRIAGE" />
		<!--无备注 -->
		<result property="TT_SEAT" column="TT_SEAT" />
		<!--无备注 -->
		<result property="TT_CLASS" column="TT_CLASS" />
		<!--无备注 -->
		<result property="TT_TICKETCHECKING" column="TT_TICKETCHECKING" />
		<!--无备注 -->
		<result property="TT_KEY" column="TT_KEY" />
		<!--无备注 -->
		<result property="TT_COUNT" column="TT_COUNT" />
		<!--无备注 -->
		<result property="TT_DATETIME" column="TT_DATETIME" />
		<!--无备注 -->
		<result property="TT_EDATETIME" column="TT_EDATETIME" />
		<!--无备注 -->
		<result property="TT_OUTDATE" column="TT_OUTDATE" />
		<!--无备注 -->
		<result property="TT_ELECTRONIC" column="TT_ELECTRONIC" />
		<!--无备注 -->
		<result property="TT_BUSINESSTYPE" column="TT_BUSINESSTYPE" />
		<!--无备注 -->
		<result property="TT_BUYERNAME" column="TT_BUYERNAME" />
		<!--无备注 -->
		<result property="TT_BUYERTAXNO" column="TT_BUYERTAXNO" />
		<!--无备注 -->
		<result property="TT_ORIGINALINVOICE" column="TT_ORIGINALINVOICE" />
	</resultMap>

	<sql id="LexmiscivTrainticketEntity_Base_Column_List">
		TT_ID,
		TT_CODE,
		TT_NO,
		TT_FSTATION,
		TT_TSTATION,
		TT_AMOUNT,
		TT_TAXRATE,
		TT_TAXRATEAMOUNT,
		TT_NOTAXAMOUNT,
		TT_DATE,
		TT_TIME,
		TT_SERIALNO,
		TT_IDNO,
		TT_CUSTOMER,
		TT_SALESTATION,
		TT_SALETYPE,
		TT_CARRIAGE,
		TT_SEAT,
		TT_CLASS,
		TT_TICKETCHECKING,
		TT_KEY,
		TT_COUNT,
		TT_DATETIME,
		TT_EDATETIME,
		TT_OUTDATE,
		TT_ELECTRONIC,
		TT_BUSINESSTYPE,
		TT_BUYERNAME,
		TT_BUYERTAXNO,
		TT_ORIGINALINVOICE
	</sql>

	<!--通过ID获取数据 -->
	<select id="entity_get" resultMap="get-LexmiscivTrainticketEntity-result">
		select
		<include refid="LexmiscivTrainticketEntity_Base_Column_List" />
		from LEXMISCIV_TRAINTICKET where id = #{ id }
	</select>

	<!-- 查询 采用==查询 -->
	<select id="entity_list_base" resultMap="get-LexmiscivTrainticketEntity-result" parameterType="com.hzya.frame.plugin.cinvoice.lexmis.entity.LexmiscivTrainticketEntity">
		select
		<include refid="LexmiscivTrainticketEntity_Base_Column_List" />
		from LEXMISCIV_TRAINTICKET
		<trim prefix="where" prefixOverrides="and">
			<if test="TT_ID != null ">TT_ID=#{TT_ID}</if>
			<if test="TT_CODE != null and TT_CODE !='' "> and TT_CODE = #{TT_CODE}</if>
			<if test="TT_NO != null and TT_NO !='' "> and TT_NO = #{TT_NO}</if>
			<if test="TT_FSTATION != null and TT_FSTATION !='' "> and TT_FSTATION = #{TT_FSTATION}</if>
			<if test="TT_TSTATION != null and TT_TSTATION !='' "> and TT_TSTATION = #{TT_TSTATION}</if>
			<if test="TT_AMOUNT != null "> and TT_AMOUNT = #{TT_AMOUNT}</if>
			<if test="TT_TAXRATE != null and TT_TAXRATE !='' "> and TT_TAXRATE = #{TT_TAXRATE}</if>
			<if test="TT_TAXRATEAMOUNT != null "> and TT_TAXRATEAMOUNT = #{TT_TAXRATEAMOUNT}</if>
			<if test="TT_NOTAXAMOUNT != null "> and TT_NOTAXAMOUNT = #{TT_NOTAXAMOUNT}</if>
			<if test="TT_DATE != null "> and TT_DATE = #{TT_DATE}</if>
			<if test="TT_TIME != null and TT_TIME !='' "> and TT_TIME = #{TT_TIME}</if>
			<if test="TT_SERIALNO != null and TT_SERIALNO !='' "> and TT_SERIALNO = #{TT_SERIALNO}</if>
			<if test="TT_IDNO != null and TT_IDNO !='' "> and TT_IDNO = #{TT_IDNO}</if>
			<if test="TT_CUSTOMER != null and TT_CUSTOMER !='' "> and TT_CUSTOMER = #{TT_CUSTOMER}</if>
			<if test="TT_SALESTATION != null and TT_SALESTATION !='' "> and TT_SALESTATION = #{TT_SALESTATION}</if>
			<if test="TT_SALETYPE != null and TT_SALETYPE !='' "> and TT_SALETYPE = #{TT_SALETYPE}</if>
			<if test="TT_CARRIAGE != null and TT_CARRIAGE !='' "> and TT_CARRIAGE = #{TT_CARRIAGE}</if>
			<if test="TT_SEAT != null and TT_SEAT !='' "> and TT_SEAT = #{TT_SEAT}</if>
			<if test="TT_CLASS != null and TT_CLASS !='' "> and TT_CLASS = #{TT_CLASS}</if>
			<if test="TT_TICKETCHECKING != null and TT_TICKETCHECKING !='' "> and TT_TICKETCHECKING = #{TT_TICKETCHECKING}</if>
			<if test="TT_KEY != null and TT_KEY !='' "> and TT_KEY = #{TT_KEY}</if>
			<if test="TT_COUNT != null "> and TT_COUNT = #{TT_COUNT}</if>
			<if test="TT_DATETIME != null and TT_DATETIME !='' "> and TT_DATETIME = #{TT_DATETIME}</if>
			<if test="TT_EDATETIME != null and TT_EDATETIME !='' "> and TT_EDATETIME = #{TT_EDATETIME}</if>
			<if test="TT_OUTDATE != null "> and TT_OUTDATE = #{TT_OUTDATE}</if>
			<if test="TT_ELECTRONIC != null "> and TT_ELECTRONIC = #{TT_ELECTRONIC}</if>
			<if test="TT_BUSINESSTYPE != null "> and TT_BUSINESSTYPE = #{TT_BUSINESSTYPE}</if>
			<if test="TT_BUYERNAME != null and TT_BUYERNAME !='' "> and TT_BUYERNAME = #{TT_BUYERNAME}</if>
			<if test="TT_BUYERTAXNO != null and TT_BUYERTAXNO !='' "> and TT_BUYERTAXNO = #{TT_BUYERTAXNO}</if>
			<if test="TT_ORIGINALINVOICE != null and TT_ORIGINALINVOICE !='' "> and TT_ORIGINALINVOICE = #{TT_ORIGINALINVOICE}</if>

		</trim>
		<if test=" sort =='' "> order by id desc</if>
		<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
	</select>

	<!-- 查询符合条件的数量 -->
	<select id="LexmiscivTrainticketEntity_count" resultType="Integer" parameterType="com.hzya.frame.plugin.cinvoice.lexmis.entity.LexmiscivTrainticketEntity">
		select count(1) from LEXMISCIV_TRAINTICKET
		<trim prefix="where" prefixOverrides="and">
			<if test="TT_ID != null ">TT_ID = #{TT_ID}</if>
			<if test="TT_CODE != null and TT_CODE !='' "> and TT_CODE = #{TT_CODE} </if>
			<if test="TT_NO != null and TT_NO !='' "> and TT_NO = #{TT_NO} </if>
			<if test="TT_FSTATION != null and TT_FSTATION !='' "> and TT_FSTATION = #{TT_FSTATION} </if>
			<if test="TT_TSTATION != null and TT_TSTATION !='' "> and TT_TSTATION = #{TT_TSTATION} </if>
			<if test="TT_AMOUNT != null "> and TT_AMOUNT = #{TT_AMOUNT}  </if>
			<if test="TT_TAXRATE != null and TT_TAXRATE !='' "> and TT_TAXRATE = #{TT_TAXRATE} </if>
			<if test="TT_TAXRATEAMOUNT != null "> and TT_TAXRATEAMOUNT = #{TT_TAXRATEAMOUNT}  </if>
			<if test="TT_NOTAXAMOUNT != null "> and TT_NOTAXAMOUNT = #{TT_NOTAXAMOUNT}  </if>
			<if test="TT_DATE != null "> and TT_DATE = #{TT_DATE}  </if>
			<if test="TT_TIME != null and TT_TIME !='' "> and TT_TIME = #{TT_TIME} </if>
			<if test="TT_SERIALNO != null and TT_SERIALNO !='' "> and TT_SERIALNO = #{TT_SERIALNO} </if>
			<if test="TT_IDNO != null and TT_IDNO !='' "> and TT_IDNO = #{TT_IDNO} </if>
			<if test="TT_CUSTOMER != null and TT_CUSTOMER !='' "> and TT_CUSTOMER = #{TT_CUSTOMER} </if>
			<if test="TT_SALESTATION != null and TT_SALESTATION !='' "> and TT_SALESTATION = #{TT_SALESTATION} </if>
			<if test="TT_SALETYPE != null and TT_SALETYPE !='' "> and TT_SALETYPE = #{TT_SALETYPE} </if>
			<if test="TT_CARRIAGE != null and TT_CARRIAGE !='' "> and TT_CARRIAGE = #{TT_CARRIAGE} </if>
			<if test="TT_SEAT != null and TT_SEAT !='' "> and TT_SEAT = #{TT_SEAT} </if>
			<if test="TT_CLASS != null and TT_CLASS !='' "> and TT_CLASS = #{TT_CLASS} </if>
			<if test="TT_TICKETCHECKING != null and TT_TICKETCHECKING !='' "> and TT_TICKETCHECKING = #{TT_TICKETCHECKING} </if>
			<if test="TT_KEY != null and TT_KEY !='' "> and TT_KEY = #{TT_KEY} </if>
			<if test="TT_COUNT != null "> and TT_COUNT = #{TT_COUNT}  </if>
			<if test="TT_DATETIME != null and TT_DATETIME !='' "> and TT_DATETIME = #{TT_DATETIME} </if>
			<if test="TT_EDATETIME != null and TT_EDATETIME !='' "> and TT_EDATETIME = #{TT_EDATETIME} </if>
			<if test="TT_OUTDATE != null "> and TT_OUTDATE = #{TT_OUTDATE}  </if>
			<if test="TT_ELECTRONIC != null "> and TT_ELECTRONIC = #{TT_ELECTRONIC}  </if>
			<if test="TT_BUSINESSTYPE != null "> and TT_BUSINESSTYPE = #{TT_BUSINESSTYPE}  </if>
			<if test="TT_BUYERNAME != null and TT_BUYERNAME !='' "> and TT_BUYERNAME = #{TT_BUYERNAME} </if>
			<if test="TT_BUYERTAXNO != null and TT_BUYERTAXNO !='' "> and TT_BUYERTAXNO = #{TT_BUYERTAXNO} </if>
			<if test="TT_ORIGINALINVOICE != null and TT_ORIGINALINVOICE !='' "> and TT_ORIGINALINVOICE = #{TT_ORIGINALINVOICE} </if>

		</trim>
		<if test=" sort =='' "> order by id desc</if>
		<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
	</select>

	<!-- 分页查询列表 采用like格式 -->
	<select id="LexmiscivTrainticketEntity_list_like" resultMap="get-LexmiscivTrainticketEntity-result" parameterType="com.hzya.frame.plugin.cinvoice.lexmis.entity.LexmiscivTrainticketEntity">
		select
		<include refid="LexmiscivTrainticketEntity_Base_Column_List" />
		from LEXMISCIV_TRAINTICKET
		<trim prefix="where" prefixOverrides="and">
			<if test="TT_ID != null ">TT_ID = #{TT_ID}</if>
			<if test="TT_CODE != null and TT_CODE !='' "> and TT_CODE like concat('%',#{TT_CODE},'%') </if>
			<if test="TT_NO != null and TT_NO !='' "> and TT_NO like concat('%',#{TT_NO},'%') </if>
			<if test="TT_FSTATION != null and TT_FSTATION !='' "> and TT_FSTATION like concat('%',#{TT_FSTATION},'%') </if>
			<if test="TT_TSTATION != null and TT_TSTATION !='' "> and TT_TSTATION like concat('%',#{TT_TSTATION},'%') </if>
			<if test="TT_AMOUNT != null "> and TT_AMOUNT = #{TT_AMOUNT}</if>
			<if test="TT_TAXRATE != null and TT_TAXRATE !='' "> and TT_TAXRATE like concat('%',#{TT_TAXRATE},'%') </if>
			<if test="TT_TAXRATEAMOUNT != null "> and TT_TAXRATEAMOUNT = #{TT_TAXRATEAMOUNT}</if>
			<if test="TT_NOTAXAMOUNT != null "> and TT_NOTAXAMOUNT = #{TT_NOTAXAMOUNT}</if>
			<if test="TT_DATE != null and TT_DATE !='' "> and TT_DATE like concat('%',#{TT_DATE},'%') </if>
			<if test="TT_TIME != null and TT_TIME !='' "> and TT_TIME like concat('%',#{TT_TIME},'%') </if>
			<if test="TT_SERIALNO != null and TT_SERIALNO !='' "> and TT_SERIALNO like concat('%',#{TT_SERIALNO},'%') </if>
			<if test="TT_IDNO != null and TT_IDNO !='' "> and TT_IDNO like concat('%',#{TT_IDNO},'%') </if>
			<if test="TT_CUSTOMER != null and TT_CUSTOMER !='' "> and TT_CUSTOMER like concat('%',#{TT_CUSTOMER},'%') </if>
			<if test="TT_SALESTATION != null and TT_SALESTATION !='' "> and TT_SALESTATION like concat('%',#{TT_SALESTATION},'%') </if>
			<if test="TT_SALETYPE != null and TT_SALETYPE !='' "> and TT_SALETYPE like concat('%',#{TT_SALETYPE},'%') </if>
			<if test="TT_CARRIAGE != null and TT_CARRIAGE !='' "> and TT_CARRIAGE like concat('%',#{TT_CARRIAGE},'%') </if>
			<if test="TT_SEAT != null and TT_SEAT !='' "> and TT_SEAT like concat('%',#{TT_SEAT},'%') </if>
			<if test="TT_CLASS != null and TT_CLASS !='' "> and TT_CLASS like concat('%',#{TT_CLASS},'%') </if>
			<if test="TT_TICKETCHECKING != null and TT_TICKETCHECKING !='' "> and TT_TICKETCHECKING like concat('%',#{TT_TICKETCHECKING},'%') </if>
			<if test="TT_KEY != null and TT_KEY !='' "> and TT_KEY like concat('%',#{TT_KEY},'%') </if>
			<if test="TT_COUNT != null "> and TT_COUNT = #{TT_COUNT}</if>
			<if test="TT_DATETIME != null and TT_DATETIME !='' "> and TT_DATETIME like concat('%',#{TT_DATETIME},'%') </if>
			<if test="TT_EDATETIME != null and TT_EDATETIME !='' "> and TT_EDATETIME like concat('%',#{TT_EDATETIME},'%') </if>
			<if test="TT_OUTDATE != null and TT_OUTDATE !='' "> and TT_OUTDATE like concat('%',#{TT_OUTDATE},'%') </if>
			<if test="TT_ELECTRONIC != null "> and TT_ELECTRONIC = #{TT_ELECTRONIC}</if>
			<if test="TT_BUSINESSTYPE != null "> and TT_BUSINESSTYPE = #{TT_BUSINESSTYPE}</if>
			<if test="TT_BUYERNAME != null and TT_BUYERNAME !='' "> and TT_BUYERNAME like concat('%',#{TT_BUYERNAME},'%') </if>
			<if test="TT_BUYERTAXNO != null and TT_BUYERTAXNO !='' "> and TT_BUYERTAXNO like concat('%',#{TT_BUYERTAXNO},'%') </if>
			<if test="TT_ORIGINALINVOICE != null and TT_ORIGINALINVOICE !='' "> and TT_ORIGINALINVOICE like concat('%',#{TT_ORIGINALINVOICE},'%') </if>

		</trim>
		<if test=" sort =='' "> order by id desc</if>
		<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by  ${sort} ${order}</if>
	</select>

	<!-- 查询列表 字段采用or格式 -->
	<select id="LexmiscivTrainticketEntity_list_or" resultMap="get-LexmiscivTrainticketEntity-result" parameterType="com.hzya.frame.plugin.cinvoice.lexmis.entity.LexmiscivTrainticketEntity">
		select
		<include refid="LexmiscivTrainticketEntity_Base_Column_List" />
		from LEXMISCIV_TRAINTICKET
		<trim prefix="where" prefixOverrides="or">
			<if test="TT_ID != null ">TT_ID = #{TT_ID}</if>
			<if test="TT_CODE != null and TT_CODE !='' "> or TT_CODE = #{TT_CODE} </if>
			<if test="TT_NO != null and TT_NO !='' "> or TT_NO = #{TT_NO} </if>
			<if test="TT_FSTATION != null and TT_FSTATION !='' "> or TT_FSTATION = #{TT_FSTATION} </if>
			<if test="TT_TSTATION != null and TT_TSTATION !='' "> or TT_TSTATION = #{TT_TSTATION} </if>
			<if test="TT_AMOUNT != null "> or TT_AMOUNT = #{TT_AMOUNT}</if>
			<if test="TT_TAXRATE != null and TT_TAXRATE !='' "> or TT_TAXRATE = #{TT_TAXRATE} </if>
			<if test="TT_TAXRATEAMOUNT != null "> or TT_TAXRATEAMOUNT = #{TT_TAXRATEAMOUNT}</if>
			<if test="TT_NOTAXAMOUNT != null "> or TT_NOTAXAMOUNT = #{TT_NOTAXAMOUNT}</if>
			<if test="TT_DATE != null and TT_DATE !='' "> or TT_DATE = #{TT_DATE} </if>
			<if test="TT_TIME != null and TT_TIME !='' "> or TT_TIME = #{TT_TIME} </if>
			<if test="TT_SERIALNO != null and TT_SERIALNO !='' "> or TT_SERIALNO = #{TT_SERIALNO} </if>
			<if test="TT_IDNO != null and TT_IDNO !='' "> or TT_IDNO = #{TT_IDNO} </if>
			<if test="TT_CUSTOMER != null and TT_CUSTOMER !='' "> or TT_CUSTOMER = #{TT_CUSTOMER} </if>
			<if test="TT_SALESTATION != null and TT_SALESTATION !='' "> or TT_SALESTATION = #{TT_SALESTATION} </if>
			<if test="TT_SALETYPE != null and TT_SALETYPE !='' "> or TT_SALETYPE = #{TT_SALETYPE} </if>
			<if test="TT_CARRIAGE != null and TT_CARRIAGE !='' "> or TT_CARRIAGE = #{TT_CARRIAGE} </if>
			<if test="TT_SEAT != null and TT_SEAT !='' "> or TT_SEAT = #{TT_SEAT} </if>
			<if test="TT_CLASS != null and TT_CLASS !='' "> or TT_CLASS = #{TT_CLASS} </if>
			<if test="TT_TICKETCHECKING != null and TT_TICKETCHECKING !='' "> or TT_TICKETCHECKING = #{TT_TICKETCHECKING} </if>
			<if test="TT_KEY != null and TT_KEY !='' "> or TT_KEY = #{TT_KEY} </if>
			<if test="TT_COUNT != null "> or TT_COUNT = #{TT_COUNT}</if>
			<if test="TT_DATETIME != null and TT_DATETIME !='' "> or TT_DATETIME = #{TT_DATETIME} </if>
			<if test="TT_EDATETIME != null and TT_EDATETIME !='' "> or TT_EDATETIME = #{TT_EDATETIME} </if>
			<if test="TT_OUTDATE != null and TT_OUTDATE !='' "> or TT_OUTDATE = #{TT_OUTDATE} </if>
			<if test="TT_ELECTRONIC != null "> or TT_ELECTRONIC = #{TT_ELECTRONIC}</if>
			<if test="TT_BUSINESSTYPE != null "> or TT_BUSINESSTYPE = #{TT_BUSINESSTYPE}</if>
			<if test="TT_BUYERNAME != null and TT_BUYERNAME !='' "> or TT_BUYERNAME = #{TT_BUYERNAME} </if>
			<if test="TT_BUYERTAXNO != null and TT_BUYERTAXNO !='' "> or TT_BUYERTAXNO = #{TT_BUYERTAXNO} </if>
			<if test="TT_ORIGINALINVOICE != null and TT_ORIGINALINVOICE !='' "> or TT_ORIGINALINVOICE = #{TT_ORIGINALINVOICE} </if>

		</trim>
		<if test=" sort =='' "> order by id desc</if>
		<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by  ${sort} ${order}</if>
	</select>

</mapper>
