<?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.project.mapper.ServiceOrganallocationMapper"> 
 | 
  
 | 
    <resultMap type="com.ruoyi.project.domain.ServiceOrganallocation" id="ServiceOrganallocationResult"> 
 | 
        <result property="id"    column="ID"    /> 
 | 
        <result property="organid"    column="OrganID"    /> 
 | 
        <result property="organnumber"    column="OrganNumber"    /> 
 | 
        <result property="applicantuserid"    column="ApplicantUserID"    /> 
 | 
        <result property="applicantusername"    column="ApplicantUserName"    /> 
 | 
        <result property="applicanttime"    column="ApplicantTime"    /> 
 | 
        <result property="checkuserid"    column="CheckUserID"    /> 
 | 
        <result property="checkusername"    column="CheckUserName"    /> 
 | 
        <result property="checktime"    column="CheckTime"    /> 
 | 
        <result property="checksuggestion"    column="CheckSuggestion"    /> 
 | 
        <result property="allocationstatus"    column="AllocationStatus"    /> 
 | 
        <result property="name"    column="Name"    /> 
 | 
        <result property="sex"    column="Sex"    /> 
 | 
        <result property="idcardtype"    column="IDCardType"    /> 
 | 
        <result property="idcardno"    column="IDCardNo"    /> 
 | 
        <result property="age"    column="Age"    /> 
 | 
        <result property="ageunit"    column="AgeUnit"    /> 
 | 
        <result property="birthday"    column="Birthday"    /> 
 | 
        <result property="phone"    column="Phone"    /> 
 | 
        <result property="residenceaddress"    column="ResidenceAddress"    /> 
 | 
        <result property="residenceprovince"    column="ResidenceProvince"    /> 
 | 
        <result property="residenceprovincename"    column="ResidenceProvinceName"    /> 
 | 
        <result property="residencecity"    column="ResidenceCity"    /> 
 | 
        <result property="residencecityname"    column="ResidenceCityName"    /> 
 | 
        <result property="residencetown"    column="ResidenceTown"    /> 
 | 
        <result property="residencetownname"    column="ResidenceTownName"    /> 
 | 
        <result property="residencecommunity"    column="ResidenceCommunity"    /> 
 | 
        <result property="residencecommunityname"    column="ResidenceCommunityName"    /> 
 | 
        <result property="residencecountycode"    column="ResidenceCountyCode"    /> 
 | 
        <result property="residencecountyname"    column="ResidenceCountyName"    /> 
 | 
        <result property="del_flag"    column="del_flag"    /> 
 | 
        <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="selectServiceOrganallocationVo"> 
 | 
        select service_organallocation.* from service_organallocation 
 | 
                                                  LEFT JOIN service_donateorgan on service_organallocation.OrganID=service_donateorgan.ID 
 | 
                                                  LEFT JOIN service_donatebaseinfo on service_donateorgan.InfoID=service_donatebaseinfo.ID 
 | 
                                                  LEFT JOIN base_organization on base_organization.OrganizationID = service_donatebaseinfo.TreatmentHospitalNo 
 | 
    </sql> 
 | 
  
 | 
    <select id="selectServiceOrganallocationList" parameterType="com.ruoyi.project.domain.ServiceOrganallocation" resultMap="ServiceOrganallocationResult"> 
 | 
        <include refid="selectServiceOrganallocationVo"/> 
 | 
        <where> 
 | 
            <if test="organid != null "> and service_organallocation.OrganID = #{organid}</if> 
 | 
            <if test="organnumber != null  and organnumber != ''"> and service_organallocation.OrganNumber = #{organnumber}</if> 
 | 
            <if test="applicantuserid != null  and applicantuserid != ''"> and service_organallocation.ApplicantUserID = #{applicantuserid}</if> 
 | 
            <if test="applicantusername != null  and applicantusername != ''"> and service_organallocation.ApplicantUserName like concat('%', #{applicantusername}, '%')</if> 
 | 
            <if test="applicanttime != null "> and service_organallocation.ApplicantTime = #{applicanttime}</if> 
 | 
            <if test="checkuserid != null  and checkuserid != ''"> and service_organallocation.CheckUserID = #{checkuserid}</if> 
 | 
            <if test="checkusername != null  and checkusername != ''"> and service_organallocation.CheckUserName like concat('%', #{checkusername}, '%')</if> 
 | 
            <if test="checktime != null "> and service_organallocation.CheckTime = #{checktime}</if> 
 | 
            <if test="checksuggestion != null  and checksuggestion != ''"> and service_organallocation.CheckSuggestion = #{checksuggestion}</if> 
 | 
            <if test="allocationstatus != null "> and service_organallocation.AllocationStatus = #{allocationstatus}</if> 
 | 
            <if test="name != null  and name != ''"> and service_organallocation.Name like concat('%', #{name}, '%')</if> 
 | 
            <if test="sex != null "> and service_organallocation.Sex = #{sex}</if> 
 | 
            <if test="idcardtype != null "> and service_organallocation.IDCardType = #{idcardtype}</if> 
 | 
            <if test="idcardno != null  and idcardno != ''"> and service_organallocation.IDCardNo = #{idcardno}</if> 
 | 
            <if test="age != null "> and service_organallocation.Age = #{age}</if> 
 | 
            <if test="ageunit != null  and ageunit != ''"> and service_organallocation.AgeUnit = #{ageunit}</if> 
 | 
            <if test="birthday != null  and birthday != ''"> and service_organallocation.Birthday = #{birthday}</if> 
 | 
            <if test="phone != null  and phone != ''"> and service_organallocation.Phone = #{phone}</if> 
 | 
            <if test="residenceaddress != null  and residenceaddress != ''"> and service_organallocation.ResidenceAddress = #{residenceaddress}</if> 
 | 
            <if test="residenceprovince != null  and residenceprovince != ''"> and service_organallocation.ResidenceProvince = #{residenceprovince}</if> 
 | 
            <if test="residenceprovincename != null  and residenceprovincename != ''"> and service_organallocation.ResidenceProvinceName like concat('%', #{residenceprovincename}, '%')</if> 
 | 
            <if test="residencecity != null  and residencecity != ''"> and service_organallocation.ResidenceCity = #{residencecity}</if> 
 | 
            <if test="residencecityname != null  and residencecityname != ''"> and service_organallocation.ResidenceCityName like concat('%', #{residencecityname}, '%')</if> 
 | 
            <if test="residencetown != null  and residencetown != ''"> and service_organallocation.ResidenceTown = #{residencetown}</if> 
 | 
            <if test="residencetownname != null  and residencetownname != ''"> and service_organallocation.ResidenceTownName like concat('%', #{residencetownname}, '%')</if> 
 | 
            <if test="residencecommunity != null  and residencecommunity != ''"> and service_organallocation.ResidenceCommunity = #{residencecommunity}</if> 
 | 
            <if test="residencecommunityname != null  and residencecommunityname != ''"> and service_organallocation.ResidenceCommunityName like concat('%', #{residencecommunityname}, '%')</if> 
 | 
            <if test="residencecountycode != null  and residencecountycode != ''"> and service_organallocation.ResidenceCountyCode = #{residencecountycode}</if> 
 | 
            <if test="residencecountyname != null  and residencecountyname != ''"> and service_organallocation.ResidenceCountyName like concat('%', #{residencecountyname}, '%')</if> 
 | 
            <if test="createBy != null  and createBy != ''"> and service_organallocation.create_by = #{createBy}</if> 
 | 
            <if test="starttime != null "> and `service_organallocation`.ApplicantTime >= #{starttime} </if> 
 | 
            <if test="endtime != null ">  and `service_organallocation`.ApplicantTime <= #{endtime}</if> 
 | 
            <if test="reporterno != null  and reporterno != ''"> and `service_donatebaseinfo`.ReporterNo = #{reporterno}</if> 
 | 
            <if test="city != null and city != ''"> and `base_organization`.`City` = #{city}</if> 
 | 
        </where> 
 | 
  
 | 
        order by create_time desc 
 | 
    </select> 
 | 
    <select id="countNumber" resultType="java.lang.Integer"> 
 | 
        select count(*) from service_organallocation 
 | 
        where ApplicantTime >= #{starttime} and ApplicantTime <= #{endtime} 
 | 
    </select> 
 | 
  
 | 
</mapper> 
 |