<?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.ruoyi.system.mapper.DksqMapper">
    
    <resultMap type="Dksq" id="DksqResult">
        <result property="id"    column="id"    />
        <result property="sqMoney"    column="sq_money"    />
        <result property="dbType"    column="db_type"    />
        <result property="dbGrade"    column="db_grade"    />
        <result property="sqName"    column="sq_name"    />
        <result property="sqIdCard"    column="sq_id_card"    />
        <result property="sqPhone"    column="sq_phone"    />
        <result property="whcd"    column="whcd"    />
        <result property="rylb"    column="rylb"    />
        <result property="xydj"    column="xydj"    />
        <result property="hyzk"    column="hyzk"    />
        <result property="poName"    column="po_name"    />
        <result property="poIdCard"    column="po_id_card"    />
        <result property="poGzdw"    column="po_gzdw"    />
        <result property="dbrName"    column="dbr_name"    />
        <result property="dbrIdCard"    column="dbr_id_card"    />
        <result property="dbrTwoName"    column="dbr_two_name"    />
        <result property="dbrTwoIdCard"    column="dbr_two_id_card"    />
        <result property="type"    column="type"    />
        <result property="result"    column="result"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="fdBank"    column="fd_bank"    />
        <result property="fdBankId"    column="fd_bank_id"    />
        <result property="fdMoney"    column="fd_money"    />
        <result property="fdTime"    column="fd_time"    />
    </resultMap>

    <sql id="selectDksqVo">
        select id, sq_money, db_type, db_grade, sq_name, sq_id_card, sq_phone, whcd, rylb, xydj, hyzk,result, po_name, po_id_card, po_gzdw, dbr_name, dbr_id_card, dbr_two_name, dbr_two_id_card, type, create_by, create_time, update_by, update_time, remark, fd_bank, fd_bank_id, fd_money, fd_time from dksq
    </sql>

    <select id="selectDksqList" parameterType="Dksq" resultMap="DksqResult">
        <include refid="selectDksqVo"/>
        <where>  
            <if test="sqMoney != null  and sqMoney != ''"> and sq_money = #{sqMoney}</if>
            <if test="dbType != null  and dbType != ''"> and db_type = #{dbType}</if>
            <if test="dbGrade != null  and dbGrade != ''"> and db_grade = #{dbGrade}</if>
            <if test="sqName != null  and sqName != ''"> and sq_name like concat('%', #{sqName}, '%')</if>
            <if test="sqIdCard != null  and sqIdCard != ''"> and sq_id_card = #{sqIdCard}</if>
            <if test="sqPhone != null  and sqPhone != ''"> and sq_phone = #{sqPhone}</if>
            <if test="whcd != null  and whcd != ''"> and whcd = #{whcd}</if>
            <if test="rylb != null  and rylb != ''"> and rylb = #{rylb}</if>
            <if test="xydj != null  and xydj != ''"> and xydj = #{xydj}</if>
            <if test="hyzk != null  and hyzk != ''"> and hyzk = #{hyzk}</if>
            <if test="poName != null  and poName != ''"> and po_name like concat('%', #{poName}, '%')</if>
            <if test="poIdCard != null  and poIdCard != ''"> and po_id_card = #{poIdCard}</if>
            <if test="poGzdw != null  and poGzdw != ''"> and po_gzdw = #{poGzdw}</if>
            <if test="dbrName != null  and dbrName != ''"> and dbr_name like concat('%', #{dbrName}, '%')</if>
            <if test="dbrIdCard != null  and dbrIdCard != ''"> and dbr_id_card = #{dbrIdCard}</if>
            <if test="dbrTwoName != null  and dbrTwoName != ''"> and dbr_two_name like concat('%', #{dbrTwoName}, '%')</if>
            <if test="dbrTwoIdCard != null  and dbrTwoIdCard != ''"> and dbr_two_id_card = #{dbrTwoIdCard}</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="result != null  and result != ''"> and result = #{result}</if>
            <if test="fdBank != null  and fdBank != ''"> and fd_bank = #{fdBank}</if>
            <if test="fdBankId != null "> and fd_bank_id = #{fdBankId}</if>
            <if test="fdMoney != null  and fdMoney != ''"> and fd_money = #{fdMoney}</if>
            <if test="fdTime != null "> and fd_time = #{fdTime}</if>
        </where>
    </select>
    
    <select id="selectDksqById" parameterType="Long" resultMap="DksqResult">
        <include refid="selectDksqVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertDksq" parameterType="Dksq" useGeneratedKeys="true" keyProperty="id">
        insert into dksq
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="sqMoney != null">sq_money,</if>
            <if test="dbType != null">db_type,</if>
            <if test="dbGrade != null">db_grade,</if>
            <if test="sqName != null">sq_name,</if>
            <if test="sqIdCard != null">sq_id_card,</if>
            <if test="sqPhone != null">sq_phone,</if>
            <if test="whcd != null">whcd,</if>
            <if test="rylb != null">rylb,</if>
            <if test="xydj != null">xydj,</if>
            <if test="hyzk != null">hyzk,</if>
            <if test="poName != null">po_name,</if>
            <if test="poIdCard != null">po_id_card,</if>
            <if test="poGzdw != null">po_gzdw,</if>
            <if test="dbrName != null">dbr_name,</if>
            <if test="dbrIdCard != null">dbr_id_card,</if>
            <if test="dbrTwoName != null">dbr_two_name,</if>
            <if test="dbrTwoIdCard != null">dbr_two_id_card,</if>
            <if test="type != null">type,</if>
            <if test="result != null">result,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="fdBank != null">fd_bank,</if>
            <if test="fdBankId != null">fd_bank_id,</if>
            <if test="fdMoney != null">fd_money,</if>
            <if test="fdTime != null">fd_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="sqMoney != null">#{sqMoney},</if>
            <if test="dbType != null">#{dbType},</if>
            <if test="dbGrade != null">#{dbGrade},</if>
            <if test="sqName != null">#{sqName},</if>
            <if test="sqIdCard != null">#{sqIdCard},</if>
            <if test="sqPhone != null">#{sqPhone},</if>
            <if test="whcd != null">#{whcd},</if>
            <if test="rylb != null">#{rylb},</if>
            <if test="xydj != null">#{xydj},</if>
            <if test="hyzk != null">#{hyzk},</if>
            <if test="poName != null">#{poName},</if>
            <if test="poIdCard != null">#{poIdCard},</if>
            <if test="poGzdw != null">#{poGzdw},</if>
            <if test="dbrName != null">#{dbrName},</if>
            <if test="dbrIdCard != null">#{dbrIdCard},</if>
            <if test="dbrTwoName != null">#{dbrTwoName},</if>
            <if test="dbrTwoIdCard != null">#{dbrTwoIdCard},</if>
            <if test="type != null">#{type},</if>
            <if test="result != null">#{result},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="fdBank != null">#{fdBank},</if>
            <if test="fdBankId != null">#{fdBankId},</if>
            <if test="fdMoney != null">#{fdMoney},</if>
            <if test="fdTime != null">#{fdTime},</if>
         </trim>
    </insert>

    <update id="updateDksq" parameterType="Dksq">
        update dksq
        <trim prefix="SET" suffixOverrides=",">
            <if test="sqMoney != null">sq_money = #{sqMoney},</if>
            <if test="dbType != null">db_type = #{dbType},</if>
            <if test="dbGrade != null">db_grade = #{dbGrade},</if>
            <if test="sqName != null">sq_name = #{sqName},</if>
            <if test="sqIdCard != null">sq_id_card = #{sqIdCard},</if>
            <if test="sqPhone != null">sq_phone = #{sqPhone},</if>
            <if test="whcd != null">whcd = #{whcd},</if>
            <if test="rylb != null">rylb = #{rylb},</if>
            <if test="xydj != null">xydj = #{xydj},</if>
            <if test="hyzk != null">hyzk = #{hyzk},</if>
            <if test="poName != null">po_name = #{poName},</if>
            <if test="poIdCard != null">po_id_card = #{poIdCard},</if>
            <if test="poGzdw != null">po_gzdw = #{poGzdw},</if>
            <if test="dbrName != null">dbr_name = #{dbrName},</if>
            <if test="dbrIdCard != null">dbr_id_card = #{dbrIdCard},</if>
            <if test="dbrTwoName != null">dbr_two_name = #{dbrTwoName},</if>
            <if test="dbrTwoIdCard != null">dbr_two_id_card = #{dbrTwoIdCard},</if>
            <if test="type != null">type = #{type},</if>
            <if test="result != null">result = #{result},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="fdBank != null">fd_bank = #{fdBank},</if>
            <if test="fdBankId != null">fd_bank_id = #{fdBankId},</if>
            <if test="fdMoney != null">fd_money = #{fdMoney},</if>
            <if test="fdTime != null">fd_time = #{fdTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteDksqById" parameterType="Long">
        delete from dksq where id = #{id}
    </delete>

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