110 lines
5.0 KiB
XML
110 lines
5.0 KiB
XML
<?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.transitPlatForm.interfaceCommon.mapper.RegHospitalMapper">
|
|
<resultMap type="RegHospital" id="RegHospitalResult">
|
|
<id property="hospitalId" column="hospital_id" />
|
|
<result property="hospitalCode" column="hospital_code" />
|
|
<result property="hospitalName" column="hospital_name" />
|
|
<result property="hospitalUserinfo" column="hospital_userinfo" />
|
|
<result property="status" column="status" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="remark" column="remark" />
|
|
</resultMap>
|
|
|
|
<sql id="selecthospitalVo">
|
|
select hospital_id, hospital_code, hospital_name, hospital_userinfo, status, create_by, create_time, remark
|
|
from Reg_hospital
|
|
</sql>
|
|
|
|
<select id="selectHospitalList" parameterType="RegHospital" resultMap="RegHospitalResult">
|
|
<include refid="selecthospitalVo"/>
|
|
<where>
|
|
<if test="hospitalCode != null and hospitalCode != ''">
|
|
AND hospital_code like '%'+#{hospitalCode}+'%'
|
|
</if>
|
|
<if test="status != null and status != ''">
|
|
AND status = #{status}
|
|
</if>
|
|
<if test="hospitalName != null and hospitalName != ''">
|
|
AND hospital_name like '%'+#{hospitalName}+'%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectHospitalAll" resultMap="RegHospitalResult">
|
|
<include refid="selecthospitalVo"/>
|
|
</select>
|
|
|
|
<select id="selectHospitalById" parameterType="Long" resultMap="RegHospitalResult">
|
|
<include refid="selecthospitalVo"/>
|
|
where hospital_id = #{hospitalId}
|
|
</select>
|
|
|
|
|
|
|
|
<select id="checkHospitalNameUnique" parameterType="String" resultMap="RegHospitalResult">
|
|
select top 1 hospital_id, hospital_code, hospital_name, hospital_userinfo, status, create_by, create_time, remark
|
|
from Reg_hospital
|
|
where hospital_name=#{hospitalName}
|
|
</select>
|
|
|
|
<select id="checkHospitalCodeUnique" parameterType="String" resultMap="RegHospitalResult">
|
|
select top 1 hospital_id, hospital_code, hospital_name, hospital_userinfo, status, create_by, create_time, remark
|
|
from Reg_hospital
|
|
where hospital_code=#{hospitalCode}
|
|
</select>
|
|
|
|
<update id="updateHospital" parameterType="RegHospital">
|
|
update Reg_hospital
|
|
<set>
|
|
<if test="hospitalCode != null and hospitalCode != ''">hospital_code = #{hospitalCode},</if>
|
|
<if test="hospitalName != null and hospitalName != ''">hospital_name = #{hospitalName},</if>
|
|
<if test="hospitalUserinfo != null">hospital_userinfo = #{hospitalUserinfo},</if>
|
|
<if test="status != null and status != ''">status = #{status},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
update_time = getdate()
|
|
</set>
|
|
where hospital_id = #{hospitalId}
|
|
</update>
|
|
|
|
<insert id="insertHospital" parameterType="RegHospital" useGeneratedKeys="true" keyProperty="hospitalId">
|
|
insert into Reg_hospital(
|
|
<if test="hospitalId != null and hospitalId != 0">hospital_id,</if>
|
|
<if test="hospitalCode != null and hospitalCode != ''">hospital_code,</if>
|
|
<if test="hospitalName != null and hospitalName != ''">hospital_name,</if>
|
|
<if test="hospitalUserinfo != null">hospital_userinfo,</if>
|
|
<if test="status != null and status != ''">status,</if>
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
create_time
|
|
)values(
|
|
<if test="hospitalId != null and hospitalId != 0">#{hospitalId},</if>
|
|
<if test="hospitalCode != null and hospitalCode != ''">#{hospitalCode},</if>
|
|
<if test="hospitalName != null and hospitalName != ''">#{hospitalName},</if>
|
|
<if test="hospitalUserinfo != null">#{hospitalUserinfo},</if>
|
|
<if test="status != null and status != ''">#{status},</if>
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
getdate()
|
|
)
|
|
</insert>
|
|
|
|
<delete id="deleteHospitalById" parameterType="Long">
|
|
delete from Reg_hospital where hospital_id = #{hospitalId}
|
|
</delete>
|
|
|
|
<delete id="deleteHospitalByIds" parameterType="Long">
|
|
delete from Reg_hospital where hospital_id in
|
|
<foreach collection="array" item="hospitalId" open="(" separator="," close=")">
|
|
#{hospitalId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
|
|
</mapper> |