<?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.toesbieya.my.mapper.BizDocumentHistoryMapper">
    <select id="getByPid" resultType="com.toesbieya.my.model.entity.BizDocumentHistory">
        select *
        from biz_document_history
        where pid = #{pid}
        order by id desc
    </select>
    <select id="search" resultType="com.toesbieya.my.model.entity.BizDocumentHistory"
            parameterType="com.toesbieya.my.model.vo.search.DocumentHistorySearch">
        select *
        from biz_document_history
        where 1
        <if test="pid!=null and pid!=''">and pid=#{pid}</if>
        <if test="uid!=null and uid!=''">and uid in (${uid})</if>
        <if test="uname!=null and uname!=''">and uname like "%"#{uname}"%"</if>
        <if test="type!=null and type!=''">and type in (${type}})</if>
        order by id desc
    </select>

    <insert id="add" parameterType="com.toesbieya.my.model.entity.BizDocumentHistory">
        insert into biz_document_history (pid, type, uid, uname, status_before, status_after, time, info)
        VALUES (#{pid}, #{type}, #{uid}, #{uname}, #{status_before}, #{status_after}, #{time}, #{info})
    </insert>
</mapper>