12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?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.fs.hospital.mapper.HospitalUserPostMapper">
- <resultMap type="HospitalUserPost" id="HospitalUserPostResult">
- <result property="userId" column="user_id" />
- <result property="postId" column="post_id" />
- <result property="hospitalId" column="hospital_id" />
- </resultMap>
- <sql id="selectHospitalUserPostVo">
- select user_id, post_id, hospital_id from hospital_user_post
- </sql>
- <select id="selectHospitalUserPostList" parameterType="HospitalUserPost" resultMap="HospitalUserPostResult">
- <include refid="selectHospitalUserPostVo"/>
- <where>
- <if test="hospitalId != null "> and hospital_id = #{hospitalId}</if>
- </where>
- </select>
- <select id="selectHospitalUserPostByUserId" parameterType="Long" resultMap="HospitalUserPostResult">
- <include refid="selectHospitalUserPostVo"/>
- where user_id = #{userId}
- </select>
- <insert id="insertHospitalUserPost" parameterType="HospitalUserPost">
- insert into hospital_user_post
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="userId != null">user_id,</if>
- <if test="postId != null">post_id,</if>
- <if test="hospitalId != null">hospital_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="userId != null">#{userId},</if>
- <if test="postId != null">#{postId},</if>
- <if test="hospitalId != null">#{hospitalId},</if>
- </trim>
- </insert>
- <update id="updateHospitalUserPost" parameterType="HospitalUserPost">
- update hospital_user_post
- <trim prefix="SET" suffixOverrides=",">
- <if test="postId != null">post_id = #{postId},</if>
- <if test="hospitalId != null">hospital_id = #{hospitalId},</if>
- </trim>
- where user_id = #{userId}
- </update>
- <delete id="deleteHospitalUserPostByUserId" parameterType="Long">
- delete from hospital_user_post where user_id = #{userId}
- </delete>
- <delete id="deleteHospitalUserPostByUserIds" parameterType="String">
- delete from hospital_user_post where user_id in
- <foreach item="userId" collection="array" open="(" separator="," close=")">
- #{userId}
- </foreach>
- </delete>
- <insert id="batchUserPost">
- insert into hospital_user_post(user_id, post_id) values
- <foreach item="item" index="index" collection="list" separator=",">
- (#{item.userId},#{item.postId})
- </foreach>
- </insert>
- <delete id="deleteUserPostByUserId" parameterType="Long">
- delete from hospital_user_post where user_id=#{userId}
- </delete>
- </mapper>
|