You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.2 KiB
XML

3 years ago
<?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.THospitalMapper">
<resultMap type="THospital" id="THospitalResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="num" column="num" />
</resultMap>
<sql id="selectTHospitalVo">
select id, name, num from t_hospital
</sql>
<select id="selectTHospitalList" parameterType="THospital" resultMap="THospitalResult">
<include refid="selectTHospitalVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="num != null "> and num = #{num}</if>
</where>
</select>
<select id="selectTHospitalById" parameterType="Long" resultMap="THospitalResult">
<include refid="selectTHospitalVo"/>
where id = #{id}
</select>
<insert id="insertTHospital" parameterType="THospital" useGeneratedKeys="true" keyProperty="id">
insert into t_hospital
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="num != null">num,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="num != null">#{num},</if>
</trim>
</insert>
<update id="updateTHospital" parameterType="THospital">
update t_hospital
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="num != null">num = #{num},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTHospitalById" parameterType="Long">
delete from t_hospital where id = #{id}
</delete>
<delete id="deleteTHospitalByIds" parameterType="String">
delete from t_hospital where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>