123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?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.HospitalDeptMapper">
- <resultMap type="HospitalDept" id="HospitalDeptResult">
- <result property="deptId" column="dept_id" />
- <result property="parentId" column="parent_id" />
- <result property="ancestors" column="ancestors" />
- <result property="deptName" column="dept_name" />
- <result property="orderNum" column="order_num" />
- <result property="leader" column="leader" />
- <result property="phone" column="phone" />
- <result property="email" column="email" />
- <result property="status" column="status" />
- <result property="isDel" column="is_del" />
- <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="hospitalId" column="hospital_id" />
- </resultMap>
- <sql id="selectHospitalDeptVo">
- select dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, is_del, create_by, create_time, update_by, update_time, hospital_id from hospital_dept
- </sql>
- <select id="selectHospitalDeptList" parameterType="HospitalDept" resultMap="HospitalDeptResult">
- <include refid="selectHospitalDeptVo"/>
- <where>
- <if test="parentId != null "> and parent_id = #{parentId}</if>
- <if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
- <if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
- <if test="orderNum != null "> and order_num = #{orderNum}</if>
- <if test="leader != null and leader != ''"> and leader = #{leader}</if>
- <if test="phone != null and phone != ''"> and phone = #{phone}</if>
- <if test="email != null and email != ''"> and email = #{email}</if>
- <if test="status != null "> and status = #{status}</if>
- <if test="isDel != null "> and is_del = #{isDel}</if>
- <if test="hospitalId != null "> and hospital_id = #{hospitalId}</if>
- </where>
- </select>
- <select id="selectHospitalDeptByDeptId" parameterType="Long" resultMap="HospitalDeptResult">
- <include refid="selectHospitalDeptVo"/>
- where dept_id = #{deptId}
- </select>
- <insert id="insertHospitalDept" parameterType="HospitalDept" useGeneratedKeys="true" keyProperty="deptId">
- insert into hospital_dept
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="parentId != null">parent_id,</if>
- <if test="ancestors != null">ancestors,</if>
- <if test="deptName != null">dept_name,</if>
- <if test="orderNum != null">order_num,</if>
- <if test="leader != null">leader,</if>
- <if test="phone != null">phone,</if>
- <if test="email != null">email,</if>
- <if test="status != null">status,</if>
- <if test="isDel != null">is_del,</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>
- <if test="hospitalId != null">hospital_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="parentId != null">#{parentId},</if>
- <if test="ancestors != null">#{ancestors},</if>
- <if test="deptName != null">#{deptName},</if>
- <if test="orderNum != null">#{orderNum},</if>
- <if test="leader != null">#{leader},</if>
- <if test="phone != null">#{phone},</if>
- <if test="email != null">#{email},</if>
- <if test="status != null">#{status},</if>
- <if test="isDel != null">#{isDel},</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>
- <if test="hospitalId != null">#{hospitalId},</if>
- </trim>
- </insert>
- <update id="updateHospitalDept" parameterType="HospitalDept">
- update hospital_dept
- <trim prefix="SET" suffixOverrides=",">
- <if test="parentId != null">parent_id = #{parentId},</if>
- <if test="ancestors != null">ancestors = #{ancestors},</if>
- <if test="deptName != null">dept_name = #{deptName},</if>
- <if test="orderNum != null">order_num = #{orderNum},</if>
- <if test="leader != null">leader = #{leader},</if>
- <if test="phone != null">phone = #{phone},</if>
- <if test="email != null">email = #{email},</if>
- <if test="status != null">status = #{status},</if>
- <if test="isDel != null">is_del = #{isDel},</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>
- <if test="hospitalId != null">hospital_id = #{hospitalId},</if>
- </trim>
- where dept_id = #{deptId}
- </update>
- <delete id="deleteHospitalDeptByDeptId" parameterType="Long">
- delete from hospital_dept where dept_id = #{deptId}
- </delete>
- <delete id="deleteHospitalDeptByDeptIds" parameterType="String">
- delete from hospital_dept where dept_id in
- <foreach item="deptId" collection="array" open="(" separator="," close=")">
- #{deptId}
- </foreach>
- </delete>
- </mapper>
|