exbind-card-log-mapper.xml 2.26 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.user.account.ExBindCardLogDao">
	
	<sql id="exbind_card_log_field">
		client_id,client_name,password,client_no,id_no,otc_account,old_fund_card,change_reason,
		open_name,id_front,id_hide,bank_front,bank_hide,new_fund_card,province_code,city_code, province_name, city_name,
		open_bank_code,result,remark, create_at
	</sql>
	
	<sql id="searchCondition">
	    where 1=1
		<if test="clientId != null and clientId != ''"> and client_id like concat('%', #{clientId}, '%') </if>
		<if test="clientName != null and clientName != ''"> and client_name like concat('%', #{clientName}, '%') </if>
		<if test="clientNo != null and clientNo != ''"> and client_no like concat('%', #{clientNo}, '%') </if>
		<if test="oldFundCard != null and oldFundCard != ''"> and old_fund_card = #{oldFundCard} </if>
		<if test="startDate != null and startDate != ''"> <![CDATA[ and create_at >= #{startDate}]]> </if>
		<if test="endDate != null and endDate != ''"> <![CDATA[ and create_at <= DATE_ADD(#{endDate}, INTERVAL 1 day)]]> </if>
		<if test="result != null and result != ''"> and result = #{result} </if>
		<if test="result == '2'"> order by create_at asc</if>
		<if test="result != '2'"> order by exbind_card_log.id desc</if>
	</sql>
	
	<select id="search" parameterType="map" resultType="ExBindCardLogInfo">
		select id, <include refid="exbind_card_log_field" /> 
		from exbind_card_log
		<include refid="searchCondition" />
		<include refid="common.pageLimit" />
	</select>
	
	<select id="searchTotal" parameterType="map" resultType="int">
	    select count(*)
		from exbind_card_log 
		<include refid="searchCondition" />
	</select>
	
	<select id="searchById" parameterType="int" resultType="map">
	    select id, <include refid="exbind_card_log_field" /> 
	    from exbind_card_log where id = #{id}
	</select>
	
	<update id="updateExBindResult" parameterType="java.util.Map">
		update exbind_card_log set result = #{result} where id = #{id}
	</update>
	
	<update id="updateExBindRemark" parameterType="map">
	    update exbind_card_log set remark = #{remark} where id = #{id}
	</update>
	
</mapper>