<?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.qianhe.zqbf.mapper.ZqczXmzBfpzMapper">
    <!--  返回实体  -->
    <resultMap id="ZqczXmzBfpzResult" type="ZqczXmzBfpz">
        <result property="pzid" column="pzid"/>
        <result property="xqid" column="xqid"/>
        <result property="wjmc" column="wjmc"/>
        <result property="wjlj" column="wjlj"/>
        <result property="gxr" column="gxr"/>
        <result property="gxsj" column="gxsj"/>
    </resultMap>
    <!--  通用查询  -->
    <sql id="selectCommon">
        SELECT pzid, xqid, wjmc, wjlj, gxr, gxsj from zqcz_xmz_bfpz
    </sql>
    <!--  条件查询  -->
    <select id="list" parameterType="ZqczXmzBfpz" resultMap="ZqczXmzBfpzResult">
        <include refid="selectCommon"></include>
        <where>
            <if test="xqid != null ">AND xqid = #{xqid}</if>
        </where>
        ORDER BY gxsj desc
    </select>
    <!--  新增  -->
    <insert id="batchAdd" parameterType="ZqczXmzBfpz">
        INSERT INTO zqcz_xmz_bfpz (xqid, wjmc, wjlj, gxr, gxsj)
        VALUES
        <foreach collection="dataList" item="item" separator=",">
            (#{item.xqid}, #{item.wjmc}, #{item.wjlj}, #{item.gxr}, now())
        </foreach>
    </insert>
    <!--  删除  -->
    <delete id="delete" parameterType="long">
        DELETE FROM zqcz_xmz_bfpz WHERE xqid = #{id}
    </delete>
</mapper>