<?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.LexmiscivInvoicedetailDaoImpl">
	<resultMap id="get-LexmiscivInvoicedetailEntity-result" type="com.hzya.frame.plugin.cinvoice.lexmis.entity.LexmiscivInvoicedetailEntity">
		<!--无备注 -->
		<result property="ID_ID" column="ID_ID" />
		<!--无备注 -->
		<result property="ID_MAINID" column="ID_MAINID" />
		<!--无备注 -->
		<result property="ID_ROWID" column="ID_ROWID" />
		<!--无备注 -->
		<result property="ID_ACCOUNTNAME" column="ID_ACCOUNTNAME" />
		<!--无备注 -->
		<result property="ID_SERVICENM" column="ID_SERVICENM" />
		<!--无备注 -->
		<result property="ID_SERVICETYPE" column="ID_SERVICETYPE" />
		<!--无备注 -->
		<result property="ID_PRICE" column="ID_PRICE" />
		<!--无备注 -->
		<result property="ID_UNIT" column="ID_UNIT" />
		<!--无备注 -->
		<result property="ID_NUM" column="ID_NUM" />
		<!--无备注 -->
		<result property="ID_NOTAXAMOUNT" column="ID_NOTAXAMOUNT" />
		<!--无备注 -->
		<result property="ID_TAX" column="ID_TAX" />
		<!--无备注 -->
		<result property="ID_TAXAMOUNT" column="ID_TAXAMOUNT" />
	</resultMap>

	<sql id="LexmiscivInvoicedetailEntity_Base_Column_List">
		ID_ID,
		ID_MAINID,
		ID_ROWID,
		ID_ACCOUNTNAME,
		ID_SERVICENM,
		ID_SERVICETYPE,
		ID_PRICE,
		ID_UNIT,
		ID_NUM,
		ID_NOTAXAMOUNT,
		ID_TAX,
		ID_TAXAMOUNT
	</sql>

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

	<!-- 查询 采用==查询 -->
	<select id="entity_list_base" resultMap="get-LexmiscivInvoicedetailEntity-result" parameterType="com.hzya.frame.plugin.cinvoice.lexmis.entity.LexmiscivInvoicedetailEntity">
		select
		<include refid="LexmiscivInvoicedetailEntity_Base_Column_List" />
		from LEXMISCIV_INVOICEDETAIL
		<trim prefix="where" prefixOverrides="and">
			<if test="ID_ID != null ">ID_ID=#{ID_ID}</if>
			<if test="ID_MAINID != null "> and ID_MAINID = #{ID_MAINID}</if>
			<if test="ID_ROWID != null "> and ID_ROWID = #{ID_ROWID}</if>
			<if test="ID_ACCOUNTNAME != null and ID_ACCOUNTNAME !='' "> and ID_ACCOUNTNAME = #{ID_ACCOUNTNAME}</if>
			<if test="ID_SERVICENM != null and ID_SERVICENM !='' "> and ID_SERVICENM = #{ID_SERVICENM}</if>
			<if test="ID_SERVICETYPE != null and ID_SERVICETYPE !='' "> and ID_SERVICETYPE = #{ID_SERVICETYPE}</if>
			<if test="ID_PRICE != null and ID_PRICE !='' "> and ID_PRICE = #{ID_PRICE}</if>
			<if test="ID_UNIT != null and ID_UNIT !='' "> and ID_UNIT = #{ID_UNIT}</if>
			<if test="ID_NUM != null and ID_NUM !='' "> and ID_NUM = #{ID_NUM}</if>
			<if test="ID_NOTAXAMOUNT != null and ID_NOTAXAMOUNT !='' "> and ID_NOTAXAMOUNT = #{ID_NOTAXAMOUNT}</if>
			<if test="ID_TAX != null and ID_TAX !='' "> and ID_TAX = #{ID_TAX}</if>
			<if test="ID_TAXAMOUNT != null and ID_TAXAMOUNT !='' "> and ID_TAXAMOUNT = #{ID_TAXAMOUNT}</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="LexmiscivInvoicedetailEntity_count" resultType="Integer" parameterType="com.hzya.frame.plugin.cinvoice.lexmis.entity.LexmiscivInvoicedetailEntity">
		select count(1) from LEXMISCIV_INVOICEDETAIL
		<trim prefix="where" prefixOverrides="and">
			<if test="ID_ID != null ">ID_ID = #{ID_ID}</if>
			<if test="ID_MAINID != null "> and ID_MAINID = #{ID_MAINID}  </if>
			<if test="ID_ROWID != null "> and ID_ROWID = #{ID_ROWID}  </if>
			<if test="ID_ACCOUNTNAME != null and ID_ACCOUNTNAME !='' "> and ID_ACCOUNTNAME = #{ID_ACCOUNTNAME} </if>
			<if test="ID_SERVICENM != null and ID_SERVICENM !='' "> and ID_SERVICENM = #{ID_SERVICENM} </if>
			<if test="ID_SERVICETYPE != null and ID_SERVICETYPE !='' "> and ID_SERVICETYPE = #{ID_SERVICETYPE} </if>
			<if test="ID_PRICE != null and ID_PRICE !='' "> and ID_PRICE = #{ID_PRICE} </if>
			<if test="ID_UNIT != null and ID_UNIT !='' "> and ID_UNIT = #{ID_UNIT} </if>
			<if test="ID_NUM != null and ID_NUM !='' "> and ID_NUM = #{ID_NUM} </if>
			<if test="ID_NOTAXAMOUNT != null and ID_NOTAXAMOUNT !='' "> and ID_NOTAXAMOUNT = #{ID_NOTAXAMOUNT} </if>
			<if test="ID_TAX != null and ID_TAX !='' "> and ID_TAX = #{ID_TAX} </if>
			<if test="ID_TAXAMOUNT != null and ID_TAXAMOUNT !='' "> and ID_TAXAMOUNT = #{ID_TAXAMOUNT} </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="LexmiscivInvoicedetailEntity_list_like" resultMap="get-LexmiscivInvoicedetailEntity-result" parameterType="com.hzya.frame.plugin.cinvoice.lexmis.entity.LexmiscivInvoicedetailEntity">
		select
		<include refid="LexmiscivInvoicedetailEntity_Base_Column_List" />
		from LEXMISCIV_INVOICEDETAIL
		<trim prefix="where" prefixOverrides="and">
			<if test="ID_ID != null ">ID_ID = #{ID_ID}</if>
			<if test="ID_MAINID != null "> and ID_MAINID = #{ID_MAINID}</if>
			<if test="ID_ROWID != null "> and ID_ROWID = #{ID_ROWID}</if>
			<if test="ID_ACCOUNTNAME != null and ID_ACCOUNTNAME !='' "> and ID_ACCOUNTNAME like concat('%',#{ID_ACCOUNTNAME},'%') </if>
			<if test="ID_SERVICENM != null and ID_SERVICENM !='' "> and ID_SERVICENM like concat('%',#{ID_SERVICENM},'%') </if>
			<if test="ID_SERVICETYPE != null and ID_SERVICETYPE !='' "> and ID_SERVICETYPE like concat('%',#{ID_SERVICETYPE},'%') </if>
			<if test="ID_PRICE != null and ID_PRICE !='' "> and ID_PRICE like concat('%',#{ID_PRICE},'%') </if>
			<if test="ID_UNIT != null and ID_UNIT !='' "> and ID_UNIT like concat('%',#{ID_UNIT},'%') </if>
			<if test="ID_NUM != null and ID_NUM !='' "> and ID_NUM like concat('%',#{ID_NUM},'%') </if>
			<if test="ID_NOTAXAMOUNT != null and ID_NOTAXAMOUNT !='' "> and ID_NOTAXAMOUNT like concat('%',#{ID_NOTAXAMOUNT},'%') </if>
			<if test="ID_TAX != null and ID_TAX !='' "> and ID_TAX like concat('%',#{ID_TAX},'%') </if>
			<if test="ID_TAXAMOUNT != null and ID_TAXAMOUNT !='' "> and ID_TAXAMOUNT like concat('%',#{ID_TAXAMOUNT},'%') </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="LexmiscivInvoicedetailEntity_list_or" resultMap="get-LexmiscivInvoicedetailEntity-result" parameterType="com.hzya.frame.plugin.cinvoice.lexmis.entity.LexmiscivInvoicedetailEntity">
		select
		<include refid="LexmiscivInvoicedetailEntity_Base_Column_List" />
		from LEXMISCIV_INVOICEDETAIL
		<trim prefix="where" prefixOverrides="or">
			<if test="ID_ID != null ">ID_ID = #{ID_ID}</if>
			<if test="ID_MAINID != null "> or ID_MAINID = #{ID_MAINID}</if>
			<if test="ID_ROWID != null "> or ID_ROWID = #{ID_ROWID}</if>
			<if test="ID_ACCOUNTNAME != null and ID_ACCOUNTNAME !='' "> or ID_ACCOUNTNAME = #{ID_ACCOUNTNAME} </if>
			<if test="ID_SERVICENM != null and ID_SERVICENM !='' "> or ID_SERVICENM = #{ID_SERVICENM} </if>
			<if test="ID_SERVICETYPE != null and ID_SERVICETYPE !='' "> or ID_SERVICETYPE = #{ID_SERVICETYPE} </if>
			<if test="ID_PRICE != null and ID_PRICE !='' "> or ID_PRICE = #{ID_PRICE} </if>
			<if test="ID_UNIT != null and ID_UNIT !='' "> or ID_UNIT = #{ID_UNIT} </if>
			<if test="ID_NUM != null and ID_NUM !='' "> or ID_NUM = #{ID_NUM} </if>
			<if test="ID_NOTAXAMOUNT != null and ID_NOTAXAMOUNT !='' "> or ID_NOTAXAMOUNT = #{ID_NOTAXAMOUNT} </if>
			<if test="ID_TAX != null and ID_TAX !='' "> or ID_TAX = #{ID_TAX} </if>
			<if test="ID_TAXAMOUNT != null and ID_TAXAMOUNT !='' "> or ID_TAXAMOUNT = #{ID_TAXAMOUNT} </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>
