<?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="RecipeRegisterMapper">

	<select id="selectArchivesList" parameterType="pd" resultType="pd">
		select *,DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%s') AS updateTime2 from s_dtp_ysfw_archive_management where 1=1
		<if test="archivesId != null and archivesId!=''">
			and id=#{archivesId}
		</if>
		<if test="serviceTypeNumber!= null and serviceTypeNumber!=''">
			and serviceTypeNumber=#{serviceTypeNumber}
		</if>
		<if test="serviceTypeName!= null and serviceTypeName!=''">
			and serviceTypeName=#{serviceTypeName}
		</if>
		<if test="followUpPerson!= null and followUpPerson!=''">
			and followUpPerson=#{followUpPerson}
		</if>
		<if test="gender!= null and gender!=''">
			and gender=#{gender}
		</if>
		<if test="name!= null and name!=''">
			and name=#{name}
		</if>
		<if test="genericName!= null and genericName!=''">
			and genericName=#{genericName}
		</if>
		<if test="acceptFollowUp!= null and acceptFollowUp!=''">
			and acceptFollowUp=#{acceptFollowUp}
		</if>
		<if test="archiveCompleteStatus!= null and archiveCompleteStatus!=''">
			and archiveCompleteStatus=#{archiveCompleteStatus}
		</if>
		<if test="followUpPerson!= null and followUpPerson!=''">
			and followUpPerson=#{followUpPerson}
		</if>
		<if test="storeName!= null and storeName!=''">
			and storeName=#{storeName}
		</if>
		<if test="disease!= null and disease!=''">
			and disease=#{disease}
		</if>
		<if test="flipStatus!= null and flipStatus!=''">
			and flipStatus=#{flipStatus}
		</if>
		<if test="updateTime!= null and updateTime!=''">
			and updateTime like concat(#{updateTime}, '%')
		</if>
		<if test="joinProject!= null and joinProject!=''">
			and joinProject=#{joinProject}
		</if>
		<if test="charityAssistance!= null and charityAssistance!=''">
			and charityAssistance=#{charityAssistance}
		</if>

	</select>


	<update id="updateArchives" parameterType="pd" >
		<if test="up != null and up!=''">
			update s_dtp_ysfw_archive_management set
		</if>
		<if test="name!= null and name!=''">
			name=#{name},
		</if>
		<if test="gender!= null and  gender!=''">
			gender=#{gender},
		</if>
		<if test="age!= null and age!=''">
			age=#{age},
		</if>
		<if test="phoneNumber!= null and  phoneNumber!=''">
			phoneNumber=#{phoneNumber},
		</if>
		<if test="documentType!= null and documentType!=''">
			documentType=#{documentType},
		</if>
		<if test="documentNumber!= null and documentNumber!=''">
			documentNumber=#{documentNumber},
		</if>
		<if test="realNameStatus!= null and realNameStatus!=''">
			realNameStatus=#{realNameStatus},
		</if>
		<if test="flipStatus!= null and flipStatus!=''">
			flipStatus=#{flipStatus},
		</if>
		<if test="disease!= null and disease!=''">
			disease=#{disease},
		</if>
		<if test="genericName!= null and genericName!=''">
			genericName=#{genericName},
		</if>
		<if test="productName!= null and productName!=''">
			productName=#{productName},
		</if>
		<if test="mdmCode!= null and mdmCode!=''">
			mdmCode=#{mdmCode},
		</if>
		<if test="manufacturer!= null and manufacturer!=''">
			manufacturer=#{manufacturer},
		</if>
		<if test="storeName!= null and storeName!=''">
			storeName=#{storeName},
		</if>
		<!--<if test="归属门店!= null and 归属门店!=''">
                 归属门店=#{归属门店},
        </if>-->
		<if test="archiveCreator!= null and archiveCreator!=''">
			archiveCreator=#{archiveCreator},
		</if>
		<if test="archiveCompleter!= null and archiveCompleter!=''">
			archiveCompleter=#{archiveCompleter},
		</if>
		<if test="acceptFollowUp!= null and acceptFollowUp!=''">
			acceptFollowUp=#{acceptFollowUp},
		</if>
		<if test="followUpPerson!= null and followUpPerson!=''">
			followUpPerson=#{followUpPerson},
		</if>
		<if test="archiveCompleteStatus!= null and archiveCompleteStatus!=''">
			archiveCompleteStatus=#{archiveCompleteStatus},
		</if>
		<if test="charityAssistance!= null and charityAssistance!=''">
			charityAssistance=#{charityAssistance},
		</if>
		<if test="joinProject!= null and joinProject!=''">
			joinProject=#{joinProject},
		</if>
		<if test="followUpStatus!= null and followUpStatus!=''">
			followUpStatus=#{followUpStatus},
		</if>
		<if test="updateTime!= null and updateTime!=''">
			updateTime=#{updateTime}
		</if>
		<!--<if test="createTime!= null and createTime!=''">
			create_time=#{createTime}
		</if>-->

		<if test="up != null and up!=''">
			<if test="id!= null and id!=''">
				where id=#{id}
			</if>
		</if>
	</update>

	<delete id="archivesRemove" parameterType="pd">
		<if test="ids != null">
			delete from s_dtp_ysfw_archive_management where
			<if test="ids != null">
				id in(#{ids})
			</if>
		</if>
	</delete>


</mapper>
