<?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.system.mapper.ProposalInfoMapper">

    <resultMap type="ProposalInfo" id="ProposalInfoResult">
        <result property="proposalId" column="proposal_id"/>
        <result property="proposalUserId" column="proposal_user_id"/>
        <result property="proposalNumber" column="proposal_number"/>
        <result property="title" column="title"/>
        <result property="proposalName" column="proposal_name"/>
        <result property="proposalPhone" column="proposal_phone"/>
        <result property="boundary" column="boundary"/>
        <result property="partyAffiliation" column="party_affiliation"/>
        <result property="contactAddress" column="contact_address"/>
        <result property="categoryId" column="category_id"/>
        <result property="categoryName" column="category_name"/>
        <result property="proposalType" column="proposal_type"/>
        <result property="proposalContent" column="proposal_content"/>
        <result property="isJointly" column="is_jointly"/>
        <result property="isPublicity" column="is_publicity"/>
        <result property="contentPublicity" column="content_publicity"/>
        <result property="isSurvey" column="is_survey"/>
        <result property="isFirst" column="is_first"/>
        <result property="isPerson" column="is_person"/>
        <result property="isRecord" column="is_record"/>
        <result property="negotiateType" column="negotiate_type"/>
        <result property="proposedContractor" column="proposed_contractor"/>
        <result property="proposalProgress" column="proposal_progress"/>
        <result property="backReason" column="back_reason"/>
        <result property="rollingProcess" column="rolling_process"/>
        <result property="complexType" column="complex_type"/>
        <result property="isCasesTogether" column="is_cases_together"/>
        <result property="uniteProposalId" column="unite_proposal_id"/>
        <result property="satisfaction" column="satisfaction"/>
        <result property="membersOpinion" column="members_opinion"/>

        <result property="cbdwdfwy" column="cbdwdfwy"/>

        <result property="zxSatisfaction" column="zx_satisfaction"/>
        <result property="zxOpinion" column="zx_opinion"/>

        <result property="isKeyPoint" column="is_key_point"/>
        <result property="keyPointArgument" column="key_point_argument"/>
        <result property="isOutstanding" column="is_outstanding"/>
        <result property="outstandingArgument" column="outstanding_argument"/>

        <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"/>


        <result property="isAgree" column="isAgree"/>
        <result property="deptId" column="deptId"/>
        <result property="dwType" column="dwType"/>
        <result property="isReply" column="isReply"/>
        <collection property="proposalUserList" javaType="java.util.List" resultMap="ProposalUserResult"/>
    </resultMap>

    <resultMap type="ProposalUser" id="ProposalUserResult">
        <result property="isAgree" column="is_agree"/>
    </resultMap>

    <sql id="selectProposalInfoVo">
        select proposal_id,
               proposal_user_id,
               proposal_number,
               title,
               proposal_name,
               proposal_phone,
               boundary,
               party_affiliation,
               contact_address,
               category_id,
               category_name,
               proposal_type,
               proposal_content,
               is_jointly,
               is_publicity,
               content_publicity,
               is_survey,
               is_first,
               is_person,
               is_record,
               negotiate_type,
               proposed_contractor,
               proposal_progress,
               back_reason,
               rolling_process,
               complex_type,
               is_cases_together,
               unite_proposal_id,
               satisfaction,
               members_opinion,
               cbdwdfwy,
               zx_satisfaction,
               zx_opinion,
               is_key_point,
               key_point_argument,
               is_outstanding,
               outstanding_argument,
               create_by,
               create_time,
               update_by,
               update_time,
               remark
        from proposal_info
    </sql>

    <select id="selectProposalInfoList" parameterType="ProposalInfo" resultMap="ProposalInfoResult">
        <include refid="selectProposalInfoVo"/>
        <where>
            <if test="proposalUserId != null ">and proposal_user_id = #{proposalUserId}</if>
            <if test="proposalNumber != null  and proposalNumber != ''">and proposal_number = #{proposalNumber}</if>
            <if test="title != null  and title != ''">and title = #{title}</if>
            <if test="proposalName != null  and proposalName != ''">and proposal_name like concat('%', #{proposalName},
                '%')
            </if>
            <if test="proposalPhone != null  and proposalPhone != ''">and proposal_phone = #{proposalPhone}</if>
            <if test="boundary != null  and boundary != ''">and boundary = #{boundary}</if>
            <if test="partyAffiliation != null  and partyAffiliation != ''">and party_affiliation =
                #{partyAffiliation}
            </if>
            <if test="contactAddress != null  and contactAddress != ''">and contact_address = #{contactAddress}</if>
            <if test="categoryId != null ">and category_id = #{categoryId}</if>
            <if test="categoryName != null  and categoryName != ''">and category_name like concat('%', #{categoryName},
                '%')
            </if>
            <if test="proposalType != null  and proposalType != ''">and proposal_type = #{proposalType}</if>
            <if test="proposalContent != null  and proposalContent != ''">and proposal_content = #{proposalContent}</if>
            <if test="isJointly != null  and isJointly != ''">and is_jointly = #{isJointly}</if>
            <if test="isPublicity != null  and isPublicity != ''">and is_publicity = #{isPublicity}</if>
            <if test="contentPublicity != null  and contentPublicity != ''">and content_publicity =
                #{contentPublicity}
            </if>
            <if test="isSurvey != null  and isSurvey != ''">and is_survey = #{isSurvey}</if>
            <if test="isFirst != null  and isFirst != ''">and is_first = #{isFirst}</if>
            <if test="isPerson != null  and isPerson != ''">and is_person = #{isPerson}</if>
            <if test="isRecord != null  and isRecord != ''">and is_record = #{isRecord}</if>
            <if test="negotiateType != null  and negotiateType != ''">and negotiate_type = #{negotiateType}</if>
            <if test="proposedContractor != null  and proposedContractor != ''">and proposed_contractor =
                #{proposedContractor}
            </if>
            <if test="proposalProgress != null  and proposalProgress != ''">and proposal_progress =
                #{proposalProgress}
            </if>
            <if test="rollingProcess != null  and rollingProcess != ''">and rolling_process = #{rollingProcess}</if>
            <if test="complexType != null  and complexType != ''">and complex_type = #{complexType}</if>
            <if test="isCasesTogether != null  and isCasesTogether != ''">and is_cases_together = #{isCasesTogether}
            </if>
            <if test="uniteProposalId != null ">and unite_proposal_id = #{uniteProposalId}</if>
            <if test="satisfaction != null  and satisfaction != ''">and satisfaction = #{satisfaction}</if>
            <if test="membersOpinion != null  and membersOpinion != ''">and members_opinion = #{membersOpinion}</if>
            <if test="zxSatisfaction != null  and zxSatisfaction != ''">and zx_satisfaction = #{zxSatisfaction}</if>
            <if test="zxOpinion != null  and zxOpinion != ''">and zx_opinion = #{zxOpinion}</if>

            <if test="isKeyPoint != null  and isKeyPoint != ''">and is_key_point = #{isKeyPoint}</if>
            <if test="keyPointArgument != null  and keyPointArgument != ''">and key_point_argument =
                #{keyPointArgument}
            </if>
            <if test="isOutstanding != null  and isOutstanding != ''">and is_outstanding = #{isOutstanding}</if>
            <if test="outstandingArgument != null  and outstandingArgument != ''">and outstanding_argument =
                #{outstandingArgument}
            </if>
            <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
                AND date_format(create_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
            </if>
            <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
                AND date_format(create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
            </if>
        </where>
        order by create_time desc
    </select>

    <select id="selectProposalInfoByProposalId" parameterType="Long" resultMap="ProposalInfoResult">
        <include refid="selectProposalInfoVo"/>
        where proposal_id = #{proposalId}
    </select>
    <select id="selectProposalInfoListByUser" resultMap="ProposalInfoResult">
        select p.proposal_id, p.proposal_user_id, p.proposal_number, p.title, p.proposal_name, p.proposal_phone,
        p.boundary, p.party_affiliation,
        p.contact_address, p.category_id, p.category_name, p.proposal_type, p.proposal_content, p.is_jointly,
        p.is_publicity, p.content_publicity,
        p.is_survey, p.is_first, p.is_person, p.is_record, p.negotiate_type, p.proposed_contractor,
        p.proposal_progress,p.back_reason, p.rolling_process, p.complex_type,
        p.is_cases_together, p.unite_proposal_id, p.satisfaction, p.members_opinion,p.cbdwdfwy,
        p.zx_satisfaction,p.zx_opinion,p.is_key_point,p.key_point_argument,p.is_outstanding,p.outstanding_argument,p.create_by,
        p.create_time,
        p.update_by, p.update_time, p.remark,u.is_agree as isAgree
        from proposal_info p
        left join proposal_user u on p.proposal_id = u.proposal_id
        <where>
            <if test="isAgree != null  and isAgree != ''">and u.is_agree = #{isAgree}</if>
            <if test="type != null  and type != ''">and u.type = #{type}</if>
            <if test="proposalUserId != null  ">and u.user_id = #{proposalUserId}</if>
            <if test="proposalNumber != null  and proposalNumber != ''">and p.proposal_number = #{proposalNumber}</if>
            <if test="title != null  and title != ''">and p.title = #{title}</if>
            <if test="proposalName != null  and proposalName != ''">and p.proposal_name like concat('%',
                #{proposalName}, '%')
            </if>
            <if test="proposalPhone != null  and proposalPhone != ''">and p.proposal_phone = #{proposalPhone}</if>
            <if test="boundary != null  and boundary != ''">and p.boundary = #{boundary}</if>
            <if test="partyAffiliation != null  and partyAffiliation != ''">and p.party_affiliation =
                #{partyAffiliation}
            </if>
            <if test="contactAddress != null  and contactAddress != ''">and p.contact_address = #{contactAddress}</if>
            <if test="categoryId != null ">and p.category_id = #{categoryId}</if>
            <if test="categoryName != null  and categoryName != ''">and p.category_name like concat('%',
                #{categoryName}, '%')
            </if>
            <if test="proposalType != null  and proposalType != ''">and p.proposal_type = #{proposalType}</if>
            <if test="proposalContent != null  and proposalContent != ''">and p.proposal_content = #{proposalContent}
            </if>
            <if test="isJointly != null  and isJointly != ''">and p.is_jointly = #{isJointly}</if>
            <if test="isPublicity != null  and isPublicity != ''">and p.is_publicity = #{isPublicity}</if>
            <if test="contentPublicity != null  and contentPublicity != ''">and p.content_publicity =
                #{contentPublicity}
            </if>
            <if test="isSurvey != null  and isSurvey != ''">and p.is_survey = #{isSurvey}</if>
            <if test="isFirst != null  and isFirst != ''">and p.is_first = #{isFirst}</if>
            <if test="isPerson != null  and isPerson != ''">and p.is_person = #{isPerson}</if>
            <if test="isRecord != null  and isRecord != ''">and p.is_record = #{isRecord}</if>
            <if test="negotiateType != null  and negotiateType != ''">and p.negotiate_type = #{negotiateType}</if>
            <if test="proposedContractor != null  and proposedContractor != ''">and p.proposed_contractor =
                #{proposedContractor}
            </if>
            <if test="proposalProgress != null  and proposalProgress != ''">and p.proposal_progress =
                #{proposalProgress}
            </if>
            <if test="rollingProcess != null  and rollingProcess != ''">and p.rolling_process = #{rollingProcess}</if>
            <if test="complexType != null  and complexType != ''">and p.complex_type = #{complexType}</if>
            <if test="isCasesTogether != null  and isCasesTogether != ''">and p.is_cases_together = #{isCasesTogether}
            </if>
            <if test="uniteProposalId != null ">and p.unite_proposal_id = #{uniteProposalId}</if>
            <if test="satisfaction != null  and satisfaction != ''">and p.satisfaction = #{satisfaction}</if>
            <if test="membersOpinion != null  and membersOpinion != ''">and p.members_opinion = #{membersOpinion}</if>
            <if test="zxSatisfaction != null  and zxSatisfaction != ''">and p.zx_satisfaction = #{zxSatisfaction}</if>
            <if test="zxOpinion != null  and zxOpinion != ''">and p.zx_opinion = #{zxOpinion}</if>
            <if test="isKeyPoint != null  and isKeyPoint != ''">and p.is_key_point = #{isKeyPoint}</if>
            <if test="keyPointArgument != null  and keyPointArgument != ''">and p.key_point_argument =
                #{keyPointArgument}
            </if>
            <if test="isOutstanding != null  and isOutstanding != ''">and p.is_outstanding = #{isOutstanding}</if>
            <if test="outstandingArgument != null  and outstandingArgument != ''">and p.outstanding_argument =
                #{outstandingArgument}
            </if>
            <if test="year != null and year != ''"><!-- 开始时间检索 -->
                AND date_format(p.update_time,'%Y') = #{year}
            </if>
        </where>
        order by p.update_time desc
    </select>

    <select id="selectProposalInfoListByUnit" resultMap="ProposalInfoResult">
        select p.proposal_id, p.proposal_user_id, p.proposal_number, p.title, p.proposal_name, p.proposal_phone,
        p.boundary, p.party_affiliation,
        p.contact_address, p.category_id, p.category_name, p.proposal_type, p.proposal_content, p.is_jointly,
        p.is_publicity, p.content_publicity,
        p.is_survey, p.is_first, p.is_person, p.is_record, p.negotiate_type, p.proposed_contractor,
        p.proposal_progress,p.back_reason, p.rolling_process, p.complex_type,
        p.is_cases_together, p.unite_proposal_id, p.satisfaction, p.members_opinion,p.cbdwdfwy,
        p.zx_satisfaction,p.zx_opinion,p.is_key_point,p.key_point_argument,p.is_outstanding,p.outstanding_argument,p.create_by,
        p.create_time,
        p.update_by, p.update_time, p.remark,u.type as dwType,u.is_reply as isReply
        from proposal_info p
        left join proposal_unit_reply u on p.proposal_id = u.proposal_id
        <where>
            <if test="deptId != null  and deptId != ''">and u.dept_id = #{deptId}</if>
            <if test="dwType != null  and dwType != ''">and u.type = #{dwType}</if>
            <if test="proposalNumber != null  and proposalNumber != ''">and p.proposal_number = #{proposalNumber}</if>
            <if test="title != null  and title != ''">and p.title = #{title}</if>
            <if test="proposalName != null  and proposalName != ''">and p.proposal_name like concat('%',
                #{proposalName}, '%')
            </if>
            <if test="proposalPhone != null  and proposalPhone != ''">and p.proposal_phone = #{proposalPhone}</if>
            <if test="boundary != null  and boundary != ''">and p.boundary = #{boundary}</if>
            <if test="partyAffiliation != null  and partyAffiliation != ''">and p.party_affiliation =
                #{partyAffiliation}
            </if>
            <if test="contactAddress != null  and contactAddress != ''">and p.contact_address = #{contactAddress}</if>
            <if test="categoryId != null ">and p.category_id = #{categoryId}</if>
            <if test="categoryName != null  and categoryName != ''">and p.category_name like concat('%',
                #{categoryName}, '%')
            </if>
            <if test="proposalType != null  and proposalType != ''">and p.proposal_type = #{proposalType}</if>
            <if test="proposalContent != null  and proposalContent != ''">and p.proposal_content = #{proposalContent}
            </if>
            <if test="isJointly != null  and isJointly != ''">and p.is_jointly = #{isJointly}</if>
            <if test="isPublicity != null  and isPublicity != ''">and p.is_publicity = #{isPublicity}</if>
            <if test="contentPublicity != null  and contentPublicity != ''">and p.content_publicity =
                #{contentPublicity}
            </if>
            <if test="isSurvey != null  and isSurvey != ''">and p.is_survey = #{isSurvey}</if>
            <if test="isFirst != null  and isFirst != ''">and p.is_first = #{isFirst}</if>
            <if test="isPerson != null  and isPerson != ''">and p.is_person = #{isPerson}</if>
            <if test="isRecord != null  and isRecord != ''">and p.is_record = #{isRecord}</if>
            <if test="negotiateType != null  and negotiateType != ''">and p.negotiate_type = #{negotiateType}</if>
            <if test="proposedContractor != null  and proposedContractor != ''">and p.proposed_contractor =
                #{proposedContractor}
            </if>
            <if test="proposalProgress != null  and proposalProgress != ''">and p.proposal_progress =
                #{proposalProgress}
            </if>
            <if test="rollingProcess != null  and rollingProcess != ''">and p.rolling_process = #{rollingProcess}</if>
            <if test="complexType != null  and complexType != ''">and p.complex_type = #{complexType}</if>
            <if test="isCasesTogether != null  and isCasesTogether != ''">and p.is_cases_together = #{isCasesTogether}
            </if>
            <if test="uniteProposalId != null ">and p.unite_proposal_id = #{uniteProposalId}</if>
            <if test="satisfaction != null  and satisfaction != ''">and p.satisfaction = #{satisfaction}</if>
            <if test="membersOpinion != null  and membersOpinion != ''">and p.members_opinion = #{membersOpinion}</if>
            <if test="zxSatisfaction != null  and zxSatisfaction != ''">and p.zx_satisfaction = #{zxSatisfaction}</if>
            <if test="zxOpinion != null  and zxOpinion != ''">and p.zx_opinion = #{zxOpinion}</if>
            <if test="isKeyPoint != null  and isKeyPoint != ''">and p.is_key_point = #{isKeyPoint}</if>
            <if test="keyPointArgument != null  and keyPointArgument != ''">and p.key_point_argument =
                #{keyPointArgument}
            </if>
            <if test="isOutstanding != null  and isOutstanding != ''">and p.is_outstanding = #{isOutstanding}</if>
            <if test="outstandingArgument != null  and outstandingArgument != ''">and p.outstanding_argument =
                #{outstandingArgument}
            </if>
        </where>
        order by p.update_time desc
    </select>

    <select id="tacbList" resultMap="ProposalInfoResult">
        <include refid="selectProposalInfoVo"/>
        <where>
            proposal_progress > 3
            <if test="proposalUserId != null ">and proposal_user_id = #{proposalUserId}</if>
            <if test="proposalNumber != null  and proposalNumber != ''">and proposal_number = #{proposalNumber}</if>
            <if test="title != null  and title != ''">and title = #{title}</if>
            <if test="proposalName != null  and proposalName != ''">and proposal_name like concat('%', #{proposalName},
                '%')
            </if>
            <if test="proposalPhone != null  and proposalPhone != ''">and proposal_phone = #{proposalPhone}</if>
            <if test="boundary != null  and boundary != ''">and boundary = #{boundary}</if>
            <if test="partyAffiliation != null  and partyAffiliation != ''">and party_affiliation =
                #{partyAffiliation}
            </if>
            <if test="contactAddress != null  and contactAddress != ''">and contact_address = #{contactAddress}</if>
            <if test="categoryId != null ">and category_id = #{categoryId}</if>
            <if test="categoryName != null  and categoryName != ''">and category_name like concat('%', #{categoryName},
                '%')
            </if>
            <if test="proposalType != null  and proposalType != ''">and proposal_type = #{proposalType}</if>
            <if test="proposalContent != null  and proposalContent != ''">and proposal_content = #{proposalContent}</if>
            <if test="isJointly != null  and isJointly != ''">and is_jointly = #{isJointly}</if>
            <if test="isPublicity != null  and isPublicity != ''">and is_publicity = #{isPublicity}</if>
            <if test="contentPublicity != null  and contentPublicity != ''">and content_publicity =
                #{contentPublicity}
            </if>
            <if test="isSurvey != null  and isSurvey != ''">and is_survey = #{isSurvey}</if>
            <if test="isFirst != null  and isFirst != ''">and is_first = #{isFirst}</if>
            <if test="isPerson != null  and isPerson != ''">and is_person = #{isPerson}</if>
            <if test="isRecord != null  and isRecord != ''">and is_record = #{isRecord}</if>
            <if test="negotiateType != null  and negotiateType != ''">and negotiate_type = #{negotiateType}</if>
            <if test="proposedContractor != null  and proposedContractor != ''">and proposed_contractor =
                #{proposedContractor}
            </if>
            <if test="proposalProgress != null  and proposalProgress != ''">and proposal_progress =
                #{proposalProgress}
            </if>
            <if test="rollingProcess != null  and rollingProcess != ''">and rolling_process = #{rollingProcess}</if>
            <if test="complexType != null  and complexType != ''">and complex_type = #{complexType}</if>
            <if test="isCasesTogether != null  and isCasesTogether != ''">and is_cases_together = #{isCasesTogether}
            </if>
            <if test="uniteProposalId != null ">and unite_proposal_id = #{uniteProposalId}</if>
            <if test="satisfaction != null  and satisfaction != ''">and satisfaction = #{satisfaction}</if>
            <if test="membersOpinion != null  and membersOpinion != ''">and members_opinion = #{membersOpinion}</if>
            <if test="zxSatisfaction != null  and zxSatisfaction != ''">and zx_satisfaction = #{zxSatisfaction}</if>
            <if test="zxOpinion != null  and zxOpinion != ''">and zx_opinion = #{zxOpinion}</if>

            <if test="isKeyPoint != null  and isKeyPoint != ''">and is_key_point = #{isKeyPoint}</if>
            <if test="keyPointArgument != null  and keyPointArgument != ''">and key_point_argument =
                #{keyPointArgument}
            </if>
            <if test="isOutstanding != null  and isOutstanding != ''">and is_outstanding = #{isOutstanding}</if>
            <if test="outstandingArgument != null  and outstandingArgument != ''">and outstanding_argument =
                #{outstandingArgument}
            </if>
            <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
                AND date_format(create_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
            </if>
            <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
                AND date_format(create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
            </if>
        </where>
        order by create_time desc
    </select>

    <insert id="insertProposalInfo" parameterType="ProposalInfo" useGeneratedKeys="true" keyProperty="proposalId">
        insert into proposal_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="proposalUserId != null">proposal_user_id,</if>
            <if test="proposalNumber != null">proposal_number,</if>
            <if test="title != null and title != ''">title,</if>
            <if test="proposalName != null and proposalName != ''">proposal_name,</if>
            <if test="proposalPhone != null and proposalPhone != ''">proposal_phone,</if>
            <if test="boundary != null">boundary,</if>
            <if test="partyAffiliation != null">party_affiliation,</if>
            <if test="contactAddress != null">contact_address,</if>
            <if test="categoryId != null">category_id,</if>
            <if test="categoryName != null">category_name,</if>
            <if test="proposalType != null">proposal_type,</if>
            <if test="proposalContent != null">proposal_content,</if>
            <if test="isJointly != null">is_jointly,</if>
            <if test="isPublicity != null">is_publicity,</if>
            <if test="contentPublicity != null">content_publicity,</if>
            <if test="isSurvey != null">is_survey,</if>
            <if test="isFirst != null">is_first,</if>
            <if test="isPerson != null">is_person,</if>
            <if test="isRecord != null">is_record,</if>
            <if test="negotiateType != null">negotiate_type,</if>
            <if test="proposedContractor != null">proposed_contractor,</if>
            <if test="proposalProgress != null">proposal_progress,</if>
            <if test="backReason != null">back_reason,</if>
            <if test="rollingProcess != null">rolling_process,</if>
            <if test="complexType != null">complex_type,</if>
            <if test="isCasesTogether != null">is_cases_together,</if>
            <if test="uniteProposalId != null">unite_proposal_id,</if>
            <if test="satisfaction != null">satisfaction,</if>
            <if test="membersOpinion != null">members_opinion,</if>
            <if test="cbdwdfwy != null  ">cbdwdfwy,</if>
            <if test="zxSatisfaction != null  ">zx_satisfaction,</if>
            <if test="zxOpinion != null  ">zx_opinion,</if>
            <if test="isKeyPoint != null  ">is_key_point,</if>
            <if test="keyPointArgument != null ">key_point_argument,</if>
            <if test="isOutstanding != null  ">is_outstanding ,</if>
            <if test="outstandingArgument != null  ">outstanding_argument,</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>
            <if test="remark != null">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="proposalUserId != null">#{proposalUserId},</if>
            <if test="proposalNumber != null">#{proposalNumber},</if>
            <if test="title != null and title != ''">#{title},</if>
            <if test="proposalName != null and proposalName != ''">#{proposalName},</if>
            <if test="proposalPhone != null and proposalPhone != ''">#{proposalPhone},</if>
            <if test="boundary != null">#{boundary},</if>
            <if test="partyAffiliation != null">#{partyAffiliation},</if>
            <if test="contactAddress != null">#{contactAddress},</if>
            <if test="categoryId != null">#{categoryId},</if>
            <if test="categoryName != null">#{categoryName},</if>
            <if test="proposalType != null">#{proposalType},</if>
            <if test="proposalContent != null">#{proposalContent},</if>
            <if test="isJointly != null">#{isJointly},</if>
            <if test="isPublicity != null">#{isPublicity},</if>
            <if test="contentPublicity != null">#{contentPublicity},</if>
            <if test="isSurvey != null">#{isSurvey},</if>
            <if test="isFirst != null">#{isFirst},</if>
            <if test="isPerson != null">#{isPerson},</if>
            <if test="isRecord != null">#{isRecord},</if>
            <if test="negotiateType != null">#{negotiateType},</if>
            <if test="proposedContractor != null">#{proposedContractor},</if>
            <if test="proposalProgress != null">#{proposalProgress},</if>
            <if test="backReason != null">#{backReason},</if>
            <if test="rollingProcess != null">#{rollingProcess},</if>
            <if test="complexType != null">#{complexType},</if>
            <if test="isCasesTogether != null">#{isCasesTogether},</if>
            <if test="uniteProposalId != null">#{uniteProposalId},</if>
            <if test="satisfaction != null">#{satisfaction},</if>
            <if test="membersOpinion != null">#{membersOpinion},</if>
            <if test="cbdwdfwy != null  ">#{cbdwdfwy},</if>
            <if test="zxSatisfaction != null ">#{zxSatisfaction},</if>
            <if test="zxOpinion != null  ">#{zxOpinion},</if>
            <if test="isKeyPoint != null  ">#{isKeyPoint},</if>
            <if test="keyPointArgument != null  ">#{keyPointArgument},</if>
            <if test="isOutstanding != null  ">#{isOutstanding},</if>
            <if test="outstandingArgument != null ">#{outstandingArgument},</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>
            <if test="remark != null">#{remark},</if>
        </trim>
    </insert>

    <update id="updateProposalInfo" parameterType="ProposalInfo">
        update proposal_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="proposalUserId != null">proposal_user_id = #{proposalUserId},</if>
            <if test="proposalNumber != null">proposal_number = #{proposalNumber},</if>
            <if test="title != null and title != ''">title = #{title},</if>
            <if test="proposalName != null and proposalName != ''">proposal_name = #{proposalName},</if>
            <if test="proposalPhone != null and proposalPhone != ''">proposal_phone = #{proposalPhone},</if>
            <if test="boundary != null">boundary = #{boundary},</if>
            <if test="partyAffiliation != null">party_affiliation = #{partyAffiliation},</if>
            <if test="contactAddress != null">contact_address = #{contactAddress},</if>
            <if test="categoryId != null">category_id = #{categoryId},</if>
            <if test="categoryName != null">category_name = #{categoryName},</if>
            <if test="proposalType != null">proposal_type = #{proposalType},</if>
            <if test="proposalContent != null">proposal_content = #{proposalContent},</if>
            <if test="isJointly != null">is_jointly = #{isJointly},</if>
            <if test="isPublicity != null">is_publicity = #{isPublicity},</if>
            <if test="contentPublicity != null">content_publicity = #{contentPublicity},</if>
            <if test="isSurvey != null">is_survey = #{isSurvey},</if>
            <if test="isFirst != null">is_first = #{isFirst},</if>
            <if test="isPerson != null">is_person = #{isPerson},</if>
            <if test="isRecord != null">is_record = #{isRecord},</if>
            <if test="negotiateType != null">negotiate_type = #{negotiateType},</if>
            <if test="proposedContractor != null">proposed_contractor = #{proposedContractor},</if>
            <if test="proposalProgress != null">proposal_progress = #{proposalProgress},</if>
            <if test="backReason != null">back_reason = #{backReason},</if>
            <if test="rollingProcess != null">rolling_process = #{rollingProcess},</if>
            <if test="complexType != null">complex_type = #{complexType},</if>
            <if test="isCasesTogether != null">is_cases_together = #{isCasesTogether},</if>
            <if test="uniteProposalId != null">unite_proposal_id = #{uniteProposalId},</if>
            <if test="satisfaction != null">satisfaction = #{satisfaction},</if>
            <if test="membersOpinion != null">members_opinion = #{membersOpinion},</if>
            <if test="cbdwdfwy != null  ">cbdwdfwy = #{cbdwdfwy},</if>
            <if test="zxSatisfaction != null ">zx_satisfaction = #{zxSatisfaction},</if>
            <if test="zxOpinion != null ">zx_opinion = #{zxOpinion},</if>
            <if test="isKeyPoint != null ">is_key_point = #{isKeyPoint},</if>
            <if test="keyPointArgument != null  ">key_point_argument = #{keyPointArgument},</if>
            <if test="isOutstanding != null  ">is_outstanding = #{isOutstanding},</if>
            <if test="outstandingArgument != null ">outstanding_argument = #{outstandingArgument},</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>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where proposal_id = #{proposalId}
    </update>

    <delete id="deleteProposalInfoByProposalId" parameterType="Long">
        delete
        from proposal_info
        where proposal_id = #{proposalId}
    </delete>

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