PostDischargePatientManage/postdischarge-manage/src/main/resources/mapper/manage/PropagandaMaterialsMapper.xml

129 lines
5.6 KiB
XML
Raw Normal View History

2024-02-27 14:04:33 +08:00
<?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.PropagandaMaterialsMapper">
<resultMap type="PropagandaMaterials" id="PropagandaMaterialsResult">
<result property="id" column="id"/>
<result property="propagandaId" column="propaganda_id"/>
<result property="propagandaTitle" column="propaganda_title"/>
<result property="materialsId" column="materials_id"/>
<result property="materialsName" column="materials_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="selectPropagandaMaterialsVo">
select id, propaganda_id, propaganda_title, materials_id, materials_name, create_by, create_time, update_by, update_time from propaganda_materials
</sql>
<select id="selectPropagandaMaterialsList" parameterType="PropagandaMaterials" resultMap="PropagandaMaterialsResult">
<include refid="selectPropagandaMaterialsVo"/>
<where>
<if test="propagandaId != null ">
and propaganda_id = #{propagandaId}
</if>
<if test="propagandaTitle != null and propagandaTitle != ''">
and propaganda_title = #{propagandaTitle}
</if>
<if test="materialsId != null ">
and materials_id = #{materialsId}
</if>
<if test="materialsName != null and materialsName != ''">
and materials_name like concat('%', #{materialsName}, '%')
</if>
</where>
</select>
<select id="selectPropagandaMaterialsById" parameterType="Long"
resultMap="PropagandaMaterialsResult">
<include refid="selectPropagandaMaterialsVo"/>
where id = #{id}
</select>
<insert id="insertPropagandaMaterials" parameterType="PropagandaMaterials" useGeneratedKeys="true"
keyProperty="id">
insert into propaganda_materials
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="propagandaId != null">propaganda_id,
</if>
<if test="propagandaTitle != null">propaganda_title,
</if>
<if test="materialsId != null">materials_id,
</if>
<if test="materialsName != null">materials_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="propagandaId != null">#{propagandaId},
</if>
<if test="propagandaTitle != null">#{propagandaTitle},
</if>
<if test="materialsId != null">#{materialsId},
</if>
<if test="materialsName != null">#{materialsName},
</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="updatePropagandaMaterials" parameterType="PropagandaMaterials">
update propaganda_materials
<trim prefix="SET" suffixOverrides=",">
<if test="propagandaId != null">propaganda_id =
#{propagandaId},
</if>
<if test="propagandaTitle != null">propaganda_title =
#{propagandaTitle},
</if>
<if test="materialsId != null">materials_id =
#{materialsId},
</if>
<if test="materialsName != null">materials_name =
#{materialsName},
</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="deletePropagandaMaterialsById" parameterType="Long">
delete from propaganda_materials where id = #{id}
</delete>
<delete id="deletePropagandaMaterialsByIds" parameterType="String">
delete from propaganda_materials where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>