MonitorUserMapper.xml 6.16 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">
<mapper namespace="com.lhcredit.project.business.monitorUser.mapper.MonitorUserMapper">
    
    <resultMap type="com.lhcredit.project.business.monitorUser.domain.MonitorUser" id="MonitorUserResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="userId"    />
        <result property="userName"    column="userName"    />
        <result property="signingTime"    column="signingTime"    />
        <result property="endTime"    column="endTime"    />
        <result property="contractMoney"    column="contractMoney"    />
        <result property="upNum"    column="upNum"    />
        <result property="nowNum"    column="nowNum"    />
        <result property="email"    column="email"    />
        <result property="status"    column="status"    />
        <result property="creditTime"    column="creditTime"    />
        <result property="updateTime"    column="updateTime"    />
        <result property="remark"    column="remark"    />
    </resultMap>
	
	<sql id="selectMonitorUserVo">
        select id, userId, userName, signingTime, endTime, contractMoney, upNum, nowNum, email, status, creditTime, updateTime, remark from monitor_user
    </sql>
	
    <select id="selectMonitorUserList" parameterType="com.lhcredit.project.business.monitorUser.domain.MonitorUser" resultMap="MonitorUserResult">
        <include refid="selectMonitorUserVo"/>
        <where>  
            <if test="id != null "> and id = #{id}</if>
            <if test="userId != null  and userId != '' "> and userId = #{userId}</if>
            <if test="userName != null  and userName != '' "> and userName = #{userName}</if>
            <if test="signingTime != null "> and signingTime = #{signingTime}</if>
            <if test="endTime != null "> and endTime = #{endTime}</if>
            <if test="contractMoney != null "> and contractMoney = #{contractMoney}</if>
            <if test="upNum != null "> and upNum = #{upNum}</if>
            <if test="nowNum != null "> and nowNum = #{nowNum}</if>
            <if test="email != null  and email != '' "> and email = #{email}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="creditTime != null "> and creditTime = #{creditTime}</if>
            <if test="updateTime != null "> and updateTime = #{updateTime}</if>
            <if test="remark != null  and remark != '' "> and remark = #{remark}</if>
        </where>
    </select>
    
    <select id="selectMonitorUserById" parameterType="Integer" resultMap="MonitorUserResult">
        <include refid="selectMonitorUserVo"/>
        where id = #{id}
    </select>
    <select id="findMonitorUserList" parameterType="string" resultMap="MonitorUserResult">
        select id, userId, userName, signingTime, endTime, contractMoney, upNum, nowNum, email, status, creditTime, updateTime, remark from monitor_user where status = #{status}
    </select>


    <insert id="insertMonitorUser" parameterType="com.lhcredit.project.business.monitorUser.domain.MonitorUser" useGeneratedKeys="true" keyProperty="id">
        insert into monitor_user
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="userId != null  and userId != ''  ">userId,</if>
			<if test="userName != null  and userName != ''  ">userName,</if>
			<if test="signingTime != null  ">signingTime,</if>
			<if test="endTime != null  ">endTime,</if>
			<if test="contractMoney != null  ">contractMoney,</if>
			<if test="upNum != null  ">upNum,</if>
			<if test="nowNum != null  ">nowNum,</if>
			<if test="email != null  and email != ''  ">email,</if>
			<if test="status != null  ">status,</if>
			<if test="creditTime != null  ">creditTime,</if>
			<if test="updateTime != null  ">updateTime,</if>
			<if test="remark != null  and remark != ''  ">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="userId != null  and userId != ''  ">#{userId},</if>
			<if test="userName != null  and userName != ''  ">#{userName},</if>
			<if test="signingTime != null  ">#{signingTime},</if>
			<if test="endTime != null  ">#{endTime},</if>
			<if test="contractMoney != null  ">#{contractMoney},</if>
			<if test="upNum != null  ">#{upNum},</if>
			<if test="nowNum != null  ">#{nowNum},</if>
			<if test="email != null  and email != ''  ">#{email},</if>
			<if test="status != null  ">#{status},</if>
			<if test="creditTime != null  ">#{creditTime},</if>
			<if test="updateTime != null  ">#{updateTime},</if>
			<if test="remark != null  and remark != ''  ">#{remark},</if>
         </trim>
    </insert>
	 
    <update id="updateMonitorUser" parameterType="com.lhcredit.project.business.monitorUser.domain.MonitorUser">
        update monitor_user
        <trim prefix="SET" suffixOverrides=",">
            <if test="userId != null  and userId != ''  ">userId = #{userId},</if>
            <if test="userName != null  and userName != ''  ">userName = #{userName},</if>
            <if test="signingTime != null  ">signingTime = #{signingTime},</if>
            <if test="endTime != null  ">endTime = #{endTime},</if>
            <if test="contractMoney != null  ">contractMoney = #{contractMoney},</if>
            <if test="upNum != null  ">upNum = #{upNum},</if>
            <if test="nowNum != null  ">nowNum = #{nowNum},</if>
            <if test="email != null  and email != ''  ">email = #{email},</if>
            <if test="status != null  ">status = #{status},</if>
            <if test="creditTime != null  ">creditTime = #{creditTime},</if>
            <if test="updateTime != null  ">updateTime = #{updateTime},</if>
            <if test="remark != null  and remark != ''  ">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

	<delete id="deleteMonitorUserById" parameterType="Integer">
        delete from monitor_user where id = #{id}
    </delete>
	
    <delete id="deleteMonitorUserByIds" parameterType="String">
        delete from monitor_user where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>