wlzboy
5 天以前 7de1396e315896dbc72a9d54e44f77434ea90f18
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?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.TbHospDataMapper">
 
    <resultMap type="TbHospData" id="TbHospDataResult">
        <id     property="hospId"              column="hosp_id"              />
        <result property="legacyHospId"        column="legacy_hosp_id"       />
        <result property="hospName"            column="hosp_name"            />
        <result property="hospCityId"          column="hosp_city_id"         />
        <result property="hospShort"           column="hosp_short"           />
        <result property="hopsProvince"        column="hops_province"        />
        <result property="hopsCity"            column="hops_city"            />
        <result property="hopsArea"            column="hops_area"            />
        <result property="hospAddress"         column="hosp_address"         />
        <result property="hospTel"             column="hosp_tel"             />
        <result property="hospUnitId"          column="hosp_unit_id"         />
        <result property="hospState"           column="hosp_state"           />
        <result property="hospOaId"            column="hosp_oa_id"           />
        <result property="hospIntroducerId"    column="hosp_introducer_id"   />
        <result property="hospIntroducerDate"  column="hosp_introducer_date" />
        <result property="hospLevel"           column="hosp_level"           />
        <result property="status"              column="status"               />
        <result property="remark"              column="remark"               />
        <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="selectTbHospDataVo">
        select hosp_id, legacy_hosp_id, hosp_name, hosp_city_id, hosp_short, 
               hops_province, hops_city, hops_area, hosp_address, hosp_tel, 
               hosp_unit_id, hosp_state, hosp_oa_id, hosp_introducer_id, 
               hosp_introducer_date, hosp_level, status, remark, 
               create_by, create_time, update_by, update_time
        from tb_hosp_data
    </sql>
 
    <select id="selectTbHospDataList" parameterType="TbHospData" resultMap="TbHospDataResult">
        <include refid="selectTbHospDataVo"/>
        <where>
            <if test="legacyHospId != null">
                and legacy_hosp_id = #{legacyHospId}
            </if>
            <if test="hospName != null and hospName != ''">
                and hosp_name like concat('%', #{hospName}, '%')
            </if>
            <if test="hopsProvince != null and hopsProvince != ''">
                and hops_province like concat('%', #{hopsProvince}, '%')
            </if>
            <if test="hopsCity != null and hopsCity != ''">
                and hops_city like concat('%', #{hopsCity}, '%')
            </if>
            <if test="hopsArea != null and hopsArea != ''">
                and hops_area like concat('%', #{hopsArea}, '%')
            </if>
            <if test="status != null and status != ''">
                and status = #{status}
            </if>
        </where>
        order by hosp_id desc
    </select>
 
    <select id="selectTbHospDataById" parameterType="Long" resultMap="TbHospDataResult">
        <include refid="selectTbHospDataVo"/>
        where hosp_id = #{hospId}
    </select>
 
    <select id="selectTbHospDataByLegacyId" parameterType="Integer" resultMap="TbHospDataResult">
        <include refid="selectTbHospDataVo"/>
        where legacy_hosp_id = #{legacyHospId}
    </select>
 
    <insert id="insertTbHospData" parameterType="TbHospData" useGeneratedKeys="true" keyProperty="hospId">
        insert into tb_hosp_data(
            <if test="legacyHospId != null">legacy_hosp_id,</if>
            <if test="hospName != null and hospName != ''">hosp_name,</if>
            <if test="hospCityId != null">hosp_city_id,</if>
            <if test="hospShort != null">hosp_short,</if>
            <if test="hopsProvince != null">hops_province,</if>
            <if test="hopsCity != null">hops_city,</if>
            <if test="hopsArea != null">hops_area,</if>
            <if test="hospAddress != null">hosp_address,</if>
            <if test="hospTel != null">hosp_tel,</if>
            <if test="hospUnitId != null">hosp_unit_id,</if>
            <if test="hospState != null">hosp_state,</if>
            <if test="hospOaId != null">hosp_oa_id,</if>
            <if test="hospIntroducerId != null">hosp_introducer_id,</if>
            <if test="hospIntroducerDate != null">hosp_introducer_date,</if>
            <if test="hospLevel != null">hosp_level,</if>
            <if test="status != null">status,</if>
            <if test="remark != null">remark,</if>
            <if test="createBy != null and createBy != ''">create_by,</if>
            create_time
        )values(
            <if test="legacyHospId != null">#{legacyHospId},</if>
            <if test="hospName != null and hospName != ''">#{hospName},</if>
            <if test="hospCityId != null">#{hospCityId},</if>
            <if test="hospShort != null">#{hospShort},</if>
            <if test="hopsProvince != null">#{hopsProvince},</if>
            <if test="hopsCity != null">#{hopsCity},</if>
            <if test="hopsArea != null">#{hopsArea},</if>
            <if test="hospAddress != null">#{hospAddress},</if>
            <if test="hospTel != null">#{hospTel},</if>
            <if test="hospUnitId != null">#{hospUnitId},</if>
            <if test="hospState != null">#{hospState},</if>
            <if test="hospOaId != null">#{hospOaId},</if>
            <if test="hospIntroducerId != null">#{hospIntroducerId},</if>
            <if test="hospIntroducerDate != null">#{hospIntroducerDate},</if>
            <if test="hospLevel != null">#{hospLevel},</if>
            <if test="status != null">#{status},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createBy != null and createBy != ''">#{createBy},</if>
            sysdate()
        )
    </insert>
 
    <update id="updateTbHospData" parameterType="TbHospData">
        update tb_hosp_data
        <set>
            <if test="legacyHospId != null">legacy_hosp_id = #{legacyHospId},</if>
            <if test="hospName != null and hospName != ''">hosp_name = #{hospName},</if>
            <if test="hospCityId != null">hosp_city_id = #{hospCityId},</if>
            <if test="hospShort != null">hosp_short = #{hospShort},</if>
            <if test="hopsProvince != null">hops_province = #{hopsProvince},</if>
            <if test="hopsCity != null">hops_city = #{hopsCity},</if>
            <if test="hopsArea != null">hops_area = #{hopsArea},</if>
            <if test="hospAddress != null">hosp_address = #{hospAddress},</if>
            <if test="hospTel != null">hosp_tel = #{hospTel},</if>
            <if test="hospUnitId != null">hosp_unit_id = #{hospUnitId},</if>
            <if test="hospState != null">hosp_state = #{hospState},</if>
            <if test="hospOaId != null">hosp_oa_id = #{hospOaId},</if>
            <if test="hospIntroducerId != null">hosp_introducer_id = #{hospIntroducerId},</if>
            <if test="hospIntroducerDate != null">hosp_introducer_date = #{hospIntroducerDate},</if>
            <if test="hospLevel != null">hosp_level = #{hospLevel},</if>
            <if test="status != null">status = #{status},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            update_time = sysdate()
        </set>
        where hosp_id = #{hospId}
    </update>
 
    <delete id="deleteTbHospDataById" parameterType="Long">
        delete from tb_hosp_data where hosp_id = #{hospId}
    </delete>
 
    <delete id="deleteTbHospDataByIds" parameterType="Long">
        delete from tb_hosp_data where hosp_id in
        <foreach collection="array" item="hospId" open="(" separator="," close=")">
            #{hospId}
        </foreach>
    </delete>
 
</mapper>