PostDischargePatientManage/postdischarge-manage/src/main/resources/mapper/manage/specialdiseaseroutepackage/SpecialDiseaseRoutePackageMapper.xml
2024-04-09 13:24:39 +08:00

168 lines
6.2 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.xinelu.manage.mapper.specialdiseaseroutepackage.SpecialDiseaseRoutePackageMapper">
<resultMap type="SpecialDiseaseRoutePackage" id="SpecialDiseaseRoutePackageResult">
<result property="id" column="id"/>
<result property="routeId" column="route_id"/>
<result property="servicePackageId" column="service_package_id"/>
<result property="routeName" column="route_name"/>
<result property="packageName" column="package_name"/>
<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="selectSpecialDiseaseRoutePackageVo">
select id,
route_id,
service_package_id,
route_name,
package_name,
create_by,
create_time,
update_by,
update_time
from special_disease_route_package
</sql>
<select id="selectSpecialDiseaseRoutePackageList" parameterType="SpecialDiseaseRoutePackage"
resultMap="SpecialDiseaseRoutePackageResult">
<include refid="selectSpecialDiseaseRoutePackageVo"/>
<where>
<if test="routeId != null ">
and route_id = #{routeId}
</if>
<if test="servicePackageId != null ">
and service_package_id = #{servicePackageId}
</if>
<if test="routeName != null and routeName != ''">
and route_name like concat('%', #{routeName}, '%')
</if>
<if test="packageName != null and packageName != ''">
and package_name like concat('%', #{packageName}, '%')
</if>
</where>
</select>
<select id="selectSpecialDiseaseRoutePackageById" parameterType="Long"
resultMap="SpecialDiseaseRoutePackageResult">
<include refid="selectSpecialDiseaseRoutePackageVo"/>
where id = #{id}
</select>
<insert id="insertSpecialDiseaseRoutePackage" parameterType="SpecialDiseaseRoutePackage" useGeneratedKeys="true"
keyProperty="id">
insert into special_disease_route_package
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="routeId != null">route_id,
</if>
<if test="servicePackageId != null">service_package_id,
</if>
<if test="routeName != null">route_name,
</if>
<if test="packageName != null">package_name,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="routeId != null">#{routeId},
</if>
<if test="servicePackageId != null">#{servicePackageId},
</if>
<if test="routeName != null">#{routeName},
</if>
<if test="packageName != null">#{packageName},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updateSpecialDiseaseRoutePackage" parameterType="SpecialDiseaseRoutePackage">
update special_disease_route_package
<trim prefix="SET" suffixOverrides=",">
<if test="routeId != null">route_id =
#{routeId},
</if>
<if test="servicePackageId != null">service_package_id =
#{servicePackageId},
</if>
<if test="routeName != null">route_name =
#{routeName},
</if>
<if test="packageName != null">package_name =
#{packageName},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSpecialDiseaseRoutePackageById" parameterType="Long">
delete
from special_disease_route_package
where id = #{id}
</delete>
<delete id="deleteSpecialDiseaseRoutePackageByIds" parameterType="String">
delete from special_disease_route_package where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="insertSpecialDiseaseRoutePackageList">
insert into special_disease_route_package(
route_id,
service_package_id,
route_name,
package_name,
create_by,
create_time
) values
<foreach item="specialDiseaseRoutePackageList" index="index" collection="list" separator=",">
(
#{specialDiseaseRoutePackageList.routeId},
#{specialDiseaseRoutePackageList.servicePackageId},
#{specialDiseaseRoutePackageList.routeName},
#{specialDiseaseRoutePackageList.packageName},
#{specialDiseaseRoutePackageList.createBy},
#{specialDiseaseRoutePackageList.createTime}
)
</foreach>
</insert>
<delete id="deleteSpecialDiseaseRoutePackageByRouteId">
delete
from special_disease_route_package
where route_id = #{routeId}
</delete>
</mapper>