<?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="jnpf.memberLog.mapper.LogMemberFieldMapper" >

<!--    批量新增日志字段-->
    <insert id="addField">
        insert into ftb_log_member_field (F_Id, F_Member_Log_Id, F_Field_Id,
                                          F_Field, f_Code, F_Sort, F_Content)
        values
        <foreach collection="logMemberFieldList" item="item" separator=",">
            (#{item.id}, #{id}, #{item.fieldId},
            #{item.field}, #{item.code}, #{item.sort}, #{item.content} )
        </foreach>

    </insert>
<!--    通过日志id删除下面的字段-->
    <delete id="deleteByLogId">
        delete from ftb_log_member_field
        where F_Member_Log_Id = #{id}
    </delete>
    <!--    通过日志id获取字段-->
    <select id="getFieldById" resultType="jnpf.model.memberLog.vo.LogMemberFieldVo">
        SELECT F_Id id, F_Member_Log_Id memberLogId, F_Field_Id fieldId,
               F_Field field, f_Code code, F_Sort sort, F_Content content
        FROM ftb_log_member_field
        WHERE F_Member_Log_Id = #{logId}
        ORDER BY F_Sort ASC
    </select>
</mapper>