<?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.invest.mapper.TProjectReviewMapper">
    
    <resultMap type="TProjectReview" id="TProjectReviewResult">
        <result property="id"    column="id"    />
        <result property="projectPoolId"    column="project_pool_id"    />
        <result property="context"    column="context"    />
        <result property="reviewPerson"    column="review_person"    />
        <result property="reviewPersonId"    column="review_person_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectTProjectReviewVo">
        select id, project_pool_id, context, review_person, review_person_id, create_by, create_time, update_by, update_time from t_project_review
    </sql>

    <select id="selectTProjectReviewList" parameterType="TProjectReview" resultMap="TProjectReviewResult">
        <include refid="selectTProjectReviewVo"/>
        <where>  
            <if test="projectPoolId != null  and projectPoolId != ''"> and project_pool_id = #{projectPoolId}</if>
            <if test="context != null  and context != ''"> and context = #{context}</if>
            <if test="reviewPerson != null  and reviewPerson != ''"> and review_person = #{reviewPerson}</if>
            <if test="reviewPersonId != null  and reviewPersonId != ''"> and review_person_id = #{reviewPersonId}</if>
        </where>
    </select>
    
    <select id="selectTProjectReviewById" parameterType="String" resultMap="TProjectReviewResult">
        <include refid="selectTProjectReviewVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTProjectReview" parameterType="TProjectReview">
        insert into t_project_review
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="projectPoolId != null">project_pool_id,</if>
            <if test="context != null">context,</if>
            <if test="reviewPerson != null">review_person,</if>
            <if test="reviewPersonId != null">review_person_id,</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>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="projectPoolId != null">#{projectPoolId},</if>
            <if test="context != null">#{context},</if>
            <if test="reviewPerson != null">#{reviewPerson},</if>
            <if test="reviewPersonId != null">#{reviewPersonId},</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>
         </trim>
    </insert>

    <update id="updateTProjectReview" parameterType="TProjectReview">
        update t_project_review
        <trim prefix="SET" suffixOverrides=",">
            <if test="projectPoolId != null">project_pool_id = #{projectPoolId},</if>
            <if test="context != null">context = #{context},</if>
            <if test="reviewPerson != null">review_person = #{reviewPerson},</if>
            <if test="reviewPersonId != null">review_person_id = #{reviewPersonId},</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>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTProjectReviewById" parameterType="String">
        delete from t_project_review where id = #{id}
    </delete>

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