<?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.SysDeptRegionMapper">
|
|
<resultMap type="SysDeptRegion" id="SysDeptRegionResult">
|
<id property="regionId" column="region_id" />
|
<result property="deptId" column="dept_id" />
|
<result property="province" column="province" />
|
<result property="city" column="city" />
|
<result property="area" column="area" />
|
<result property="address" column="address" />
|
<result property="hospitalName" column="hospital_name" />
|
<result property="regionType" column="region_type" />
|
<result property="status" column="status" />
|
<result property="remark" column="remark" />
|
<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="selectDeptRegionVo">
|
select region_id, dept_id, province, city, area, address, hospital_name, region_type, status, remark, create_by, create_time, update_by, update_time
|
from sys_dept_region
|
</sql>
|
|
<select id="selectDeptRegionListByDeptId" parameterType="Long" resultMap="SysDeptRegionResult">
|
<include refid="selectDeptRegionVo"/>
|
where dept_id = #{deptId}
|
and status = '0'
|
order by region_id
|
</select>
|
|
<select id="selectDeptRegionListByDeptIds" resultMap="SysDeptRegionResult">
|
<include refid="selectDeptRegionVo"/>
|
where dept_id in
|
<foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
|
#{deptId}
|
</foreach>
|
and status = '0'
|
order by dept_id, region_id
|
</select>
|
|
<insert id="insertDeptRegion" parameterType="SysDeptRegion">
|
insert into sys_dept_region(
|
<if test="deptId != null">dept_id,</if>
|
<if test="province != null and province != ''">province,</if>
|
<if test="city != null and city != ''">city,</if>
|
<if test="area != null and area != ''">area,</if>
|
<if test="address != null and address != ''">address,</if>
|
<if test="hospitalName != null and hospitalName != ''">hospital_name,</if>
|
<if test="regionType != null and regionType != ''">region_type,</if>
|
<if test="status != null">status,</if>
|
<if test="remark != null">remark,</if>
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
create_time
|
)values(
|
<if test="deptId != null">#{deptId},</if>
|
<if test="province != null and province != ''">#{province},</if>
|
<if test="city != null and city != ''">#{city},</if>
|
<if test="area != null and area != ''">#{area},</if>
|
<if test="address != null and address != ''">#{address},</if>
|
<if test="hospitalName != null and hospitalName != ''">#{hospitalName},</if>
|
<if test="regionType != null and regionType != ''">#{regionType},</if>
|
<if test="status != null">#{status},</if>
|
<if test="remark != null">#{remark},</if>
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
sysdate()
|
)
|
</insert>
|
|
<update id="updateDeptRegion" parameterType="SysDeptRegion">
|
update sys_dept_region
|
<set>
|
<if test="province != null">province = #{province},</if>
|
<if test="city != null">city = #{city},</if>
|
<if test="area != null">area = #{area},</if>
|
<if test="address != null">address = #{address},</if>
|
<if test="hospitalName != null">hospital_name = #{hospitalName},</if>
|
<if test="regionType != null and regionType != ''">region_type = #{regionType},</if>
|
<if test="status != null">status = #{status},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
update_time = sysdate()
|
</set>
|
where region_id = #{regionId}
|
</update>
|
|
<delete id="deleteDeptRegionById" parameterType="Long">
|
delete from sys_dept_region where region_id = #{regionId}
|
</delete>
|
|
<delete id="deleteDeptRegionByDeptId" parameterType="Long">
|
delete from sys_dept_region where dept_id = #{deptId}
|
</delete>
|
|
</mapper>
|