developer-change-mapper.xml 2.23 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.user.account.DeveloperChangeDao">

	<sql id="developer_change_field">
		id,client_id,user_name,old_developer, new_developer, yz_phone, id_no,bust,create_time,audit_time,audit_status,create_by,remark 
	</sql>
	
	<select id="searchDeveloperChange" parameterType="map" resultType="map">
		
		SELECT <include refid="developer_change_field" /> 
		FROM developer_change   
		
		<include refid="searchCondition" />
		ORDER BY id DESC 
		<include refid="common.pageLimit" />
	</select>
	
	<select id="searchTotal" parameterType="map" resultType="int">
         select count(1) from 	developer_change  
		<include refid="searchCondition" />
	</select>
	
	<update id="updateAuditStatus" parameterType="map" >
		update developer_change set audit_status = #{auditStatus}, audit_time = now(),create_by = #{createBy}, remark = #{remark}
		where id = #{id}
	</update>
	
	<select id="selectDeveloperById" parameterType="int" resultType="DeveloperChangeInfo">
		select <include refid="developer_change_field" /> 
		from developer_change 
		where id = #{id}
	</select>
	
	
		<sql id="searchCondition">
		where 1=1
		<if test="clientId != null and clientId != ''"> and client_id = #{clientId} </if>
		<if test="oldDeveloper != null and oldDeveloper != ''"> and old_developer = #{oldDeveloper} </if>
		<if test="newDeveloper != null and newDeveloper != ''"> and new_developer = #{newDeveloper} </if>
		<if test="phone != null and phone != ''"> and yz_phone like concat('%', #{phone}, '%') </if>
		<if test="cardNumber != null and cardNumber != ''"> and id_no like concat('%', #{cardNumber}, '%') </if>
		<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
		<if test="beginDate != null and endDate == null">
			and create_time > = #{beginDate}
		</if>
		<if test="endDate != null and beginDate == null">
			and DATE_ADD(#{endDate}, INTERVAL +1 day)> =
			create_time
		</if>
		<if test="endDate != null and beginDate != null">
			and create_time between #{beginDate} and
			DATE_ADD(#{endDate}, INTERVAL +1 day)
		</if>
	</sql>

</mapper>