MemberUnitMapper.xml 8.02 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.memberUnit.mapper.MemberUnitMapper">
    
    <resultMap type="MemberUnit" id="MemberUnitResult">
        <result property="id"    column="id"    />
        <result property="oid"    column="oid"    />
        <result property="name"    column="name"    />
        <result property="creditNo"    column="credit_no"    />
        <result property="orgType"    column="org_type"    />
        <result property="status"    column="status"    />
        <result property="operName"    column="oper_name"    />
        <result property="regAddress"    column="reg_address"    />
        <result property="startDate"    column="start_date"    />
        <result property="scope"    column="scope"    />
        <result property="registCapi"    column="regist_capi"    />
        <result property="scopeType"    column="scope_type"    />
        <result property="department"    column="department"    />
        <result property="creditLevel"    column="credit_level"    />
        <result property="creditScore"    column="credit_score"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="delStatus"    column="del_status"    />
    </resultMap>
	
	<sql id="selectMemberUnitVo">
        select id, oid, name, credit_no, org_type, status, oper_name, reg_address, start_date, scope, regist_capi, scope_type, department, credit_level, credit_score, create_time, update_time, del_status from member_unit
    </sql>
	
    <select id="selectMemberUnitList" parameterType="MemberUnit" resultMap="MemberUnitResult">
        <include refid="selectMemberUnitVo"/>
        <where>  
            <if test="id != null "> and id = #{id}</if>
            <if test="oid != null "> and oid = #{oid}</if>
            <if test="name != null  and name != '' "> and name = #{name}</if>
            <if test="creditNo != null  and creditNo != '' "> and credit_no = #{creditNo}</if>
            <if test="orgType != null  and orgType != '' "> and org_type = #{orgType}</if>
            <if test="status != null  and status != '' "> and status = #{status}</if>
            <if test="operName != null  and operName != '' "> and oper_name = #{operName}</if>
            <if test="regAddress != null  and regAddress != '' "> and reg_address = #{regAddress}</if>
            <if test="startDate != null  and startDate != '' "> and start_date = #{startDate}</if>
            <if test="scope != null  and scope != '' "> and scope = #{scope}</if>
            <if test="registCapi != null "> and regist_capi = #{registCapi}</if>
            <if test="scopeType != null  and scopeType != '' "> and scope_type = #{scopeType}</if>
            <if test="department != null  and department != '' "> and department = #{department}</if>
            <if test="creditLevel != null  and creditLevel != '' "> and credit_level = #{creditLevel}</if>
            <if test="creditScore != null "> and credit_score = #{creditScore}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
            <if test="delStatus != null  and delStatus != '' "> and del_status = #{delStatus}</if>
        </where>
    </select>
    
    <select id="selectMemberUnitById" parameterType="Long" resultMap="MemberUnitResult">
        <include refid="selectMemberUnitVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertMemberUnit" parameterType="MemberUnit" useGeneratedKeys="true" keyProperty="id">
        insert into member_unit
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="oid != null  ">oid,</if>
			<if test="name != null  and name != ''  ">name,</if>
			<if test="creditNo != null  and creditNo != ''  ">credit_no,</if>
			<if test="orgType != null  and orgType != ''  ">org_type,</if>
			<if test="status != null  and status != ''  ">status,</if>
			<if test="operName != null  and operName != ''  ">oper_name,</if>
			<if test="regAddress != null  and regAddress != ''  ">reg_address,</if>
			<if test="startDate != null  and startDate != ''  ">start_date,</if>
			<if test="scope != null  and scope != ''  ">scope,</if>
			<if test="registCapi != null  ">regist_capi,</if>
			<if test="scopeType != null  and scopeType != ''  ">scope_type,</if>
			<if test="department != null  and department != ''  ">department,</if>
			<if test="creditLevel != null  and creditLevel != ''  ">credit_level,</if>
			<if test="creditScore != null  ">credit_score,</if>
			<if test="createTime != null  ">create_time,</if>
			<if test="updateTime != null  ">update_time,</if>
			<if test="delStatus != null  and delStatus != ''  ">del_status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="oid != null  ">#{oid},</if>
			<if test="name != null  and name != ''  ">#{name},</if>
			<if test="creditNo != null  and creditNo != ''  ">#{creditNo},</if>
			<if test="orgType != null  and orgType != ''  ">#{orgType},</if>
			<if test="status != null  and status != ''  ">#{status},</if>
			<if test="operName != null  and operName != ''  ">#{operName},</if>
			<if test="regAddress != null  and regAddress != ''  ">#{regAddress},</if>
			<if test="startDate != null  and startDate != ''  ">#{startDate},</if>
			<if test="scope != null  and scope != ''  ">#{scope},</if>
			<if test="registCapi != null  ">#{registCapi},</if>
			<if test="scopeType != null  and scopeType != ''  ">#{scopeType},</if>
			<if test="department != null  and department != ''  ">#{department},</if>
			<if test="creditLevel != null  and creditLevel != ''  ">#{creditLevel},</if>
			<if test="creditScore != null  ">#{creditScore},</if>
			<if test="createTime != null  ">#{createTime},</if>
			<if test="updateTime != null  ">#{updateTime},</if>
			<if test="delStatus != null  and delStatus != ''  ">#{delStatus},</if>
         </trim>
    </insert>
	 
    <update id="updateMemberUnit" parameterType="MemberUnit">
        update member_unit
        <trim prefix="SET" suffixOverrides=",">
            <if test="oid != null  ">oid = #{oid},</if>
            <if test="name != null  and name != ''  ">name = #{name},</if>
            <if test="creditNo != null  and creditNo != ''  ">credit_no = #{creditNo},</if>
            <if test="orgType != null  and orgType != ''  ">org_type = #{orgType},</if>
            <if test="status != null  and status != ''  ">status = #{status},</if>
            <if test="operName != null  and operName != ''  ">oper_name = #{operName},</if>
            <if test="regAddress != null  and regAddress != ''  ">reg_address = #{regAddress},</if>
            <if test="startDate != null  and startDate != ''  ">start_date = #{startDate},</if>
            <if test="scope != null  and scope != ''  ">scope = #{scope},</if>
            <if test="registCapi != null  ">regist_capi = #{registCapi},</if>
            <if test="scopeType != null  and scopeType != ''  ">scope_type = #{scopeType},</if>
            <if test="department != null  and department != ''  ">department = #{department},</if>
            <if test="creditLevel != null  and creditLevel != ''  ">credit_level = #{creditLevel},</if>
            <if test="creditScore != null  ">credit_score = #{creditScore},</if>
            <if test="createTime != null  ">create_time = #{createTime},</if>
            <if test="updateTime != null  ">update_time = #{updateTime},</if>
            <if test="delStatus != null  and delStatus != ''  ">del_status = #{delStatus},</if>
        </trim>
        where id = #{id}
    </update>

	<delete id="deleteMemberUnitById" parameterType="Long">
        delete from member_unit where id = #{id}
    </delete>
	
    <delete id="deleteMemberUnitByIds" parameterType="String">
        delete from member_unit where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>