rax-remote-v2/upms/upms-biz/src/main/resources/mapper/SysHospitalMapper.xml

72 lines
1.7 KiB
XML
Raw Normal View History

<?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.rax.admin.mapper.SysHospitalMapper">
<sql id="hospitalPropertiesSQL">
id,
name,
code,
status,
province,
start_time "startTime",
end_time "endTime",
domain,
city
</sql>
<sql id="hospitalSelectSQL">
2024-03-25 11:21:32 +08:00
FROM sys_hospital
WHERE del_flag = 0
<if test="name != null and name != ''">
<bind name="bindName" value="'%' + name + '%'"/>
2024-04-26 18:54:32 +08:00
AND name LIKE #{bindName}
</if>
</sql>
<select id="getHospitalList" resultType="com.rax.admin.api.dto.HospitalDTO">
SELECT
<include refid="hospitalPropertiesSQL"/>
<include refid="hospitalSelectSQL"/>
2024-03-25 11:21:32 +08:00
ORDER BY create_time DESC
LIMIT #{offset},#{limit};
</select>
<select id="getHospitalTotal" resultType="java.lang.Integer">
SELECT COUNT(*)
<include refid="hospitalSelectSQL"/>
</select>
<update id="deleteByIds">
update sys_hospital set del_flag = 1
where
<if test="ids != null and ids.length != 0">
<foreach item="item" index="index" collection="ids"
open="id in (" separator="," close=")" nullable="false">
#{item}
</foreach>
</if>
</update>
<delete id="delHospitalManager">
DELETE FROM sys_hospital_manager where hospital_id = #{hospitalId};
</delete>
<insert id="insertHospitalManager">
INSERT INTO sys_hospital_manager VALUES (#{hospitalId}, #{userId});
</insert>
<select id="getHospitalManager" resultType="map">
select u.user_id "id", u.name, u.phone
from sys_hospital_manager hm
left join sys_user u
on u.user_id = hm.user_id
where u.del_flag = 0 and hm.hospital_id = #{hospitalId};
</select>
</mapper>