<?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.ghy.worker.mapper.WorkerBankMapper">

    <resultMap id="WorkerTeamResult" type="com.ghy.worker.domain.WorkerBank">
        <result property="workerBankId" column="worker_bank_id"/>
        <result property="workerId"         column="worker_id"/>
        <result property="name"         column="name"/>
        <result property="certId"         column="cert_id"/>
        <result property="bankName"         column="bank_name"/>
        <result property="bankNum"         column="bank_num"/>
        <result property="phone"         column="phone"/>
        <result property="deptId"         column="dept_id"/>
        <result property="adapayMemberId"         column="adapay_member_id"/>
        <result property="settleAccount"         column="settle_account"/>
        <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"/>
    </resultMap>

    <insert id="insertWorkerBank" parameterType="com.ghy.worker.domain.WorkerBank" useGeneratedKeys="true"
            keyProperty="workerBankId">
        INSERT INTO worker_bank(
        <if test="workerId != null and workerId != 0">worker_id,</if>
        <if test="name != null and name != ''">name,</if>
        <if test="certId != null and certId != ''">cert_id,</if>
        <if test="bankName != null and bankName != ''">bank_name,</if>
        <if test="bankNum != null and bankNum != ''">bank_num,</if>
        <if test="phone != null and phone != ''">phone,</if>
        <if test="deptId != null and deptId != 0">dept_id,</if>
        <if test="adapayMemberId != null and adapayMemberId != ''">adapay_member_id,</if>
        <if test="settleAccount != null">settle_account,</if>
        <if test="createBy != null and createBy != ''">create_by,</if>
        <if test="remark != null and remark != ''">remark,</if>
        create_time
        )VALUES(
        <if test="workerId != null and workerId != 0">#{workerId},</if>
        <if test="name != null and name != ''">#{name},</if>
        <if test="certId != null and certId != ''">#{certId},</if>
        <if test="bankName != null and bankName != ''">#{bankName},</if>
        <if test="bankNum != null and bankNum != ''">#{bankNum},</if>
        <if test="phone != null and phone != ''">#{phone},</if>
        <if test="deptId != null and deptId != 0">#{deptId},</if>
        <if test="adapayMemberId != null and adapayMemberId != ''">#{adapayMemberId},</if>
        <if test="settleAccount != null">#{settleAccount},</if>
        <if test="createBy != null and createBy != ''">#{createBy},</if>
        <if test="remark != null and remark != ''">#{remark},</if>
        sysdate()
        )
    </insert>

    <select id="getByWorkerId" parameterType="Long" resultMap="WorkerTeamResult">
        SELECT *
        FROM worker_bank
        <where>
            <if test="workerId != null and workerId != 0">
                and worker_id = #{workerId}
            </if>
        </where>
    </select>

<!--    <select id="getWorkerTeamList" resultMap="WorkerTeamResult">-->
<!--        <include refid="selectWorkerTeam"/>-->
<!--        <where>-->
<!--            <if test="leaderId != null and leaderId != ''">-->
<!--                AND leader_id = #{leaderId}-->
<!--            </if>-->
<!--        </where>-->
<!--    </select>-->

<!--    <delete id="deleteWorkerTeamByIds" parameterType="Long">-->
<!--        DELETE FROM worker_team WHERE worker_team_id IN-->
<!--        <foreach collection="array" item="workerTeamId" open="(" separator="," close=")">-->
<!--            #{workerTeamId}-->
<!--        </foreach>-->
<!--    </delete>-->

</mapper>
