fund-jour-mapper.xml 2.74 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.FundJourDao">

	<sql id="fund_jour_field">
		CURR_DATE, CURR_TIME, FUND_ACCOUNT, OCCUR_BALANCE, POST_BALANCE, BUSINESS_FLAG, REMARK
	</sql>
	
	<sql id="searchCondition">
		where business_flag = #{businessFlag} 
		<if test="bussinessType != null and bussinessType != ''">
			and REMARK like '%'||#{bussinessType}||'%'  
		</if>
		<if test="fundAccount != '' and fundAccount != null">
			and fund_account = #{fundAccount}  
		</if>
		<if test="startDate != '' and startDate != null">
			<![CDATA[and init_date >= #{startDate}]]>
		</if>
		<if test="endDate != '' and endDate != null">
			<![CDATA[and init_date <= #{endDate}]]> 
		</if>
	</sql>
	
	<select id="search" parameterType="Map" resultType="Map">
		<include refid="common.pageStart" />
		SELECT D.*, C.CLIENT_NAME FROM(
			SELECT <include refid="fund_jour_field" />
			FROM HS_ASSET.FUNDJOUR A
			<include refid="searchCondition" />
			UNION ALL
			SELECT <include refid="fund_jour_field" />
			FROM HS_HIS.HIS_FUNDJOUR B
			<include refid="searchCondition" />) D,
		HS_ASSET.CLIENT C
		WHERE C.CLIENT_ID = D.FUND_ACCOUNT
		ORDER BY CURR_DATE DESC, CURR_TIME DESC, FUND_ACCOUNT DESC
		<include refid="common.pageEnd" />
	</select>
	
	<select id="searchTotal" parameterType="Map" resultType="Integer">
		SELECT COUNT(*) FROM(
			SELECT <include refid="fund_jour_field" />
			FROM HS_ASSET.FUNDJOUR A
			<include refid="searchCondition" />
			UNION ALL
			SELECT <include refid="fund_jour_field" />
			FROM HS_HIS.HIS_FUNDJOUR B
			<include refid="searchCondition" />)
	</select>
	
	<sql id="queryAccountSql">
		SELECT T.CURR_DATE,
		T.CURR_TIME,
		T.SERIAL_NO,
		T.BUSINESS_FLAG,
		T.FUND_ACCOUNT,
		T.OCCUR_BALANCE,
		T.POST_BALANCE,
		T.REMARK
		FROM HS_HIS.HIS_FUNDJOUR T
		where 1=1
		<if test="fundAccount != '' and fundAccount != null">
			and fund_account = #{fundAccount}  
		</if>
		<if test="businessFlag != '' and businessFlag != null">
			and business_flag = #{businessFlag}  
		</if>
		<if test="currDate != '' and currDate != null">
			and curr_date = #{currDate}  
		</if>
		ORDER BY
		T.CURR_DATE DESC, T.FUND_ACCOUNT
	</sql>
	
	<select id="queryAccount" resultType="map" parameterType="map">
		<include refid="common.pageStart" /> 
		<include refid="queryAccountSql" /> 
		<include refid="common.pageEnd" />
	</select>
	
	<select id="exportFundJour" resultType="map" parameterType="map">
		<include refid="queryAccountSql" /> 
	</select>
	
	<select id="queryAccountTotal" parameterType="Map" resultType="Integer">
		select count(1)from (<include refid="queryAccountSql" /> )
	</select>
	
</mapper>