quota-past-mapper.xml 1.64 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 kongmingke -->
<mapper namespace="com.cjs.cms.dao.quota.QuotaPastDao">

	<sql id="quota_config_field">
		id, otc_code, otc_name, user_id, otc_account, enable_amount, trade_end_date, status, update_at, update_by
	</sql>
	
	<sql id="searchCondition">
		<if test="otcCode != null and otcCode != ''">
			and otc_code = #{otcCode} 
		</if>
		
		<if test="userId != null and userId != ''">
			and user_id = #{userId} 
		</if>
		
		<if test="status != null and status != ''">
		    and status = #{status}
		</if> 
		
		<if test="endTime != null and endTime != ''">
			and date(trade_end_date) = #{endTime} 
		</if>
	</sql>
	
	<insert id="addQuotaPast" parameterType="QuotaPastInfo">
		insert into quota_past(otc_code, otc_name, user_id, otc_account, enable_amount, trade_end_date)
		values(#{otcCode}, #{otcName}, #{userId}, #{otcAccount}, #{enableAmount}, #{tradeEndDate})
	</insert>
	
	
	<!-- 查询过期持仓 -->
	<select id="search"  parameterType="map" resultType="map">
	    select <include refid="quota_config_field" />
	    from quota_past
	    where 1 = 1
	    <include refid="searchCondition" />
		<include refid="common.pageLimit" />
	</select>
	
	 <select id="searchTotal" parameterType="map"
		resultType="int">
		select count(1) from quota_past where 1 = 1
		<include refid="searchCondition" />
	</select>
	
	<update id="updateStatus" parameterType="map">
	   update quota_past set status = 1 , update_at = now(), update_by = #{updateBy}
	   where status = 0
	</update>
	

</mapper>