forked from kidgrow-microservices-platform

zhaoxiaohao
2021-03-02 1a50269b1d072fe2da7e70ae48315ebeb4ef95f4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?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.kidgrow.oprationcenter.mapper.ScreeningOrganizationInfoMapper">
    <!--定义查询列-->
    <sql id="Column_List">
 
       *
 
    </sql>
 
    <!--sql查询片段-->
    <sql id="where">
        <where>
            <!--查询条件自行添加-->
            <if test="p.id != null and p.id != ''">
                and id = #{p.id}
            </if>
            <if test="p.province != null and p.province != ''">
                and province = #{p.province}
            </if>
            <if test="p.city != null and p.city != ''">
                and city = #{p.city}
            </if>
            <if test="p.area != null and p.area != ''">
                and area = #{p.area}
            </if>
            <if test="p.organizationName != null and p.organizationName != ''">
                and organization_name = #{p.organizationName}
            </if>
            <if test="p.organizationNameLike != null and p.organizationNameLike != ''">
                and organization_name like '%${p.organizationNameLike}%'
            </if>
            <if test="p.contactName != null and p.contactName != ''">
                and contact_name = #{p.contactName}
            </if>
            <if test="p.contactNumber != null and p.contactNumber != ''">
                and contact_number = #{p.contactNumber}
            </if>
            <if test="p.sourceHospitalId != null and p.sourceHospitalId != ''">
                and source_hospital_id = #{p.sourceHospitalId}
            </if>
            <if test="p.sourceHospitalName != null and p.sourceHospitalName != ''">
                and source_hospital_name = #{p.sourceHospitalName}
            </if>
            <if test="p.remarks != null and p.remarks != ''">
                and remarks = #{p.remarks}
            </if>
            <if test="p.createTime != null and p.createTime != ''">
                and create_time = #{p.createTime}
            </if>
            <if test="p.abbreviation != null and p.abbreviation != ''">
                and abbreviation = #{p.abbreviation}
            </if>
            <if test="p.qrCode != null and p.qrCode != ''">
                and qr_code = #{p.qrCode}
            </if>
            <if test="p.community != null and p.community != ''">
                and community = #{p.community}
            </if>
            <if test="p.organizationNo != null and p.organizationNo != ''">
                and organization_no = #{p.organizationNo}
            </if>
            <if test="p.createUserId != null and p.createUserId != ''">
                and create_user_id = #{p.createUserId}
            </if>
            <if test="p.updateTime != null and p.updateTime != ''">
                and update_time = #{p.updateTime}
            </if>
            <if test="p.updateUserId != null and p.updateUserId != ''">
                and update_user_id = #{p.updateUserId}
            </if>
            <if test="p.areaCode != null and p.areaCode != ''">
                and area_code = #{p.areaCode}
            </if>
            <if test="p.parentId != null and p.parentId != ''">
                and parent_id = #{p.parentId}
            </if>
             <if test="p.orgLevel != null and p.orgLevel != ''">
                and org_level = #{p.orgLevel}
            </if>
        </where>
    </sql>
 
    <!--定义根据-OrganizationInfo当作查询条件返回对象-->
    <select id="findByObject" resultType="com.kidgrow.oprationcenter.model.ScreeningOrganizationInfo">
        select
        <include refid="Column_List"/>
        from screening_organization_info
        <include refid="where"/>
        order by id desc
        limit 1
 
    </select>
 
    <!--定义根据-OrganizationInfo当作查询条件返回对象集合-->
    <select id="findList" resultType="com.kidgrow.oprationcenter.model.ScreeningOrganizationInfo">
        select
        <include refid="Column_List"/>
        from screening_organization_info
        <include refid="where"/>
        order by id desc
    </select>
 
    <select id="findByHospitalId" resultType="com.kidgrow.oprationcenter.model.ScreeningOrganizationInfo" parameterType="java.lang.Long">
        select
        <include refid="Column_List"/>
        from screening_organization_info
        where source_hospital_id=#{t}
    </select>
 
    <select id="findByKeyWord" resultType="com.kidgrow.oprationcenter.model.ScreeningOrganizationInfo" parameterType="java.util.Map" >
        SELECT
            *
        FROM
            screening_organization_info
        WHERE
            source_hospital_id=${p.id}
            <if test="p.keyword != null and p.keyword != ''">
             and organization_name LIKE '%${p.keyword}%'
            </if>
    </select>
</mapper>