rebateclear-mapper.xml 1.21 KB
<?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">

<!-- 返佣查询 @author tongxiaochuan -->
<mapper namespace="com.cjs.cms.dao.report.RebateClearDao">

	<sql id="rebateclear_field">
		INIT_DATE,DEVELOPER,BUSINESS_BALANCE,FARE0,ROUND(REBATE,2) AS REBATE,REBATE_BALANCE
	</sql>
	
	<select id="search" parameterType="map" resultType="map">
		<include refid="common.pageStart" />
		SELECT <include refid="rebateclear_field" /> FROM HS_ASSET.REBATECLEAR_VIEW 
		WHERE 1=1 
		<include refid="searchCondition" /> 
		ORDER BY INIT_DATE DESC,DEVELOPER ASC,REBATE_BALANCE DESC 
		<include refid="common.pageEnd" />
	</select>
	
	<sql id="searchCondition">
		<if test="developer != null and developer != ''">
			AND DEVELOPER = #{developer} 
		</if>
		<if test="startDate != null and startDate != ''">
			<![CDATA[AND INIT_DATE >= #{startDate}]]>
		</if>
		<if test="endDate != null and endDate != ''">
			<![CDATA[AND INIT_DATE <= #{endDate}]]>
		</if>
	</sql>
	
	<select id="searchTotal" parameterType="map" resultType="int">
		SELECT COUNT(1) FROM HS_ASSET.REBATECLEAR_VIEW 
		WHERE 1=1 
		<include refid="searchCondition" /> 
	</select>

</mapper>