|
@@ -0,0 +1,140 @@
|
|
|
+<?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.care.mapper.CarePersonsMapper">
|
|
|
+
|
|
|
+ <resultMap type="CarePersons" id="CarePersonsResult">
|
|
|
+ <result property="personId" column="person_id" />
|
|
|
+ <result property="name" column="name" />
|
|
|
+ <result property="dateOfBirth" column="date_of_birth" />
|
|
|
+ <result property="gender" column="gender" />
|
|
|
+ <result property="idNumber" column="id_number" />
|
|
|
+ <result property="address" column="address" />
|
|
|
+ <result property="phoneNumber" column="phone_number" />
|
|
|
+ <result property="emergencyContact" column="emergency_contact" />
|
|
|
+ <result property="emergencyPhone" column="emergency_phone" />
|
|
|
+ <result property="healthStatus" column="health_status" />
|
|
|
+ <result property="medicalConditions" column="medical_conditions" />
|
|
|
+ <result property="disability" column="disability" />
|
|
|
+ <result property="registeredDate" column="registered_date" />
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
+ <result property="delFlag" column="del_flag" />
|
|
|
+ <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="remark" column="remark" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectCarePersonsVo">
|
|
|
+ select person_id, name, date_of_birth, gender, id_number, address, phone_number, emergency_contact, emergency_phone, health_status, medical_conditions, disability, registered_date, user_id, del_flag, create_by, create_time, update_by, update_time, remark from care_persons
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectCarePersonsList" parameterType="CarePersons" resultMap="CarePersonsResult">
|
|
|
+ <include refid="selectCarePersonsVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
|
+ <if test="dateOfBirth != null and dateOfBirth != ''"> and date_of_birth = #{dateOfBirth}</if>
|
|
|
+ <if test="gender != null and gender != ''"> and gender = #{gender}</if>
|
|
|
+ <if test="idNumber != null and idNumber != ''"> and id_number = #{idNumber}</if>
|
|
|
+ <if test="address != null and address != ''"> and address = #{address}</if>
|
|
|
+ <if test="phoneNumber != null and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>
|
|
|
+ <if test="emergencyContact != null and emergencyContact != ''"> and emergency_contact = #{emergencyContact}</if>
|
|
|
+ <if test="emergencyPhone != null and emergencyPhone != ''"> and emergency_phone = #{emergencyPhone}</if>
|
|
|
+ <if test="healthStatus != null and healthStatus != ''"> and health_status = #{healthStatus}</if>
|
|
|
+ <if test="medicalConditions != null and medicalConditions != ''"> and medical_conditions = #{medicalConditions}</if>
|
|
|
+ <if test="disability != null and disability != ''"> and disability = #{disability}</if>
|
|
|
+ <if test="registeredDate != null and registeredDate != ''"> and registered_date = #{registeredDate}</if>
|
|
|
+ <if test="userId != null "> and user_id = #{userId}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectCarePersonsByPersonId" parameterType="Long" resultMap="CarePersonsResult">
|
|
|
+ <include refid="selectCarePersonsVo"/>
|
|
|
+ where person_id = #{personId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertCarePersons" parameterType="CarePersons" useGeneratedKeys="true" keyProperty="personId">
|
|
|
+ insert into care_persons
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="name != null and name != ''">name,</if>
|
|
|
+ <if test="dateOfBirth != null and dateOfBirth != ''">date_of_birth,</if>
|
|
|
+ <if test="gender != null and gender != ''">gender,</if>
|
|
|
+ <if test="idNumber != null and idNumber != ''">id_number,</if>
|
|
|
+ <if test="address != null">address,</if>
|
|
|
+ <if test="phoneNumber != null">phone_number,</if>
|
|
|
+ <if test="emergencyContact != null">emergency_contact,</if>
|
|
|
+ <if test="emergencyPhone != null">emergency_phone,</if>
|
|
|
+ <if test="healthStatus != null">health_status,</if>
|
|
|
+ <if test="medicalConditions != null">medical_conditions,</if>
|
|
|
+ <if test="disability != null and disability != ''">disability,</if>
|
|
|
+ <if test="registeredDate != null and registeredDate != ''">registered_date,</if>
|
|
|
+ <if test="userId != null">user_id,</if>
|
|
|
+ <if test="delFlag != null">del_flag,</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="remark != null">remark,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="name != null and name != ''">#{name},</if>
|
|
|
+ <if test="dateOfBirth != null and dateOfBirth != ''">#{dateOfBirth},</if>
|
|
|
+ <if test="gender != null and gender != ''">#{gender},</if>
|
|
|
+ <if test="idNumber != null and idNumber != ''">#{idNumber},</if>
|
|
|
+ <if test="address != null">#{address},</if>
|
|
|
+ <if test="phoneNumber != null">#{phoneNumber},</if>
|
|
|
+ <if test="emergencyContact != null">#{emergencyContact},</if>
|
|
|
+ <if test="emergencyPhone != null">#{emergencyPhone},</if>
|
|
|
+ <if test="healthStatus != null">#{healthStatus},</if>
|
|
|
+ <if test="medicalConditions != null">#{medicalConditions},</if>
|
|
|
+ <if test="disability != null and disability != ''">#{disability},</if>
|
|
|
+ <if test="registeredDate != null and registeredDate != ''">#{registeredDate},</if>
|
|
|
+ <if test="userId != null">#{userId},</if>
|
|
|
+ <if test="delFlag != null">#{delFlag},</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="remark != null">#{remark},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateCarePersons" parameterType="CarePersons">
|
|
|
+ update care_persons
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="name != null and name != ''">name = #{name},</if>
|
|
|
+ <if test="dateOfBirth != null and dateOfBirth != ''">date_of_birth = #{dateOfBirth},</if>
|
|
|
+ <if test="gender != null and gender != ''">gender = #{gender},</if>
|
|
|
+ <if test="idNumber != null and idNumber != ''">id_number = #{idNumber},</if>
|
|
|
+ <if test="address != null">address = #{address},</if>
|
|
|
+ <if test="phoneNumber != null">phone_number = #{phoneNumber},</if>
|
|
|
+ <if test="emergencyContact != null">emergency_contact = #{emergencyContact},</if>
|
|
|
+ <if test="emergencyPhone != null">emergency_phone = #{emergencyPhone},</if>
|
|
|
+ <if test="healthStatus != null">health_status = #{healthStatus},</if>
|
|
|
+ <if test="medicalConditions != null">medical_conditions = #{medicalConditions},</if>
|
|
|
+ <if test="disability != null and disability != ''">disability = #{disability},</if>
|
|
|
+ <if test="registeredDate != null and registeredDate != ''">registered_date = #{registeredDate},</if>
|
|
|
+ <if test="userId != null">user_id = #{userId},</if>
|
|
|
+ <if test="delFlag != null">del_flag = #{delFlag},</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="remark != null">remark = #{remark},</if>
|
|
|
+ </trim>
|
|
|
+ where person_id = #{personId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteCarePersonsByPersonId" parameterType="Long">
|
|
|
+ delete from care_persons where person_id = #{personId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteCarePersonsByPersonIds" parameterType="String">
|
|
|
+ delete from care_persons where person_id in
|
|
|
+ <foreach item="personId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{personId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|