FsPatientMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.store.mapper.FsPatientMapper">
  6. <resultMap type="FsPatient" id="FsPatientResult">
  7. <result property="patientId" column="patient_id" />
  8. <result property="patientName" column="patient_name" />
  9. <result property="userId" column="user_id" />
  10. <result property="idCard" column="id_card" />
  11. <result property="birthday" column="birthday" />
  12. <result property="gender" column="gender" />
  13. <result property="status" column="status" />
  14. <result property="isDel" column="is_del" />
  15. <result property="patientRelation" column="patient_relation" />
  16. </resultMap>
  17. <sql id="selectFsPatientVo">
  18. select patient_id, patient_name, user_id, id_card, birthday, gender, status, is_del, patient_relation from fs_patient
  19. </sql>
  20. <select id="selectFsPatientList" parameterType="FsPatient" resultMap="FsPatientResult">
  21. <include refid="selectFsPatientVo"/>
  22. <where>
  23. <if test="patientName != null and patientName != ''"> and patient_name like concat('%', #{patientName}, '%')</if>
  24. <if test="userId != null "> and user_id = #{userId}</if>
  25. <if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
  26. <if test="birthday != null "> and birthday = #{birthday}</if>
  27. <if test="gender != null "> and gender = #{gender}</if>
  28. <if test="status != null "> and status = #{status}</if>
  29. <if test="isDel != null "> and is_del = #{isDel}</if>
  30. <if test="patientRelation != null "> and patient_relation = #{patientRelation}</if>
  31. </where>
  32. order by patient_id desc
  33. </select>
  34. <select id="selectFsPatientById" parameterType="Long" resultMap="FsPatientResult">
  35. <include refid="selectFsPatientVo"/>
  36. where patient_id = #{patientId}
  37. </select>
  38. <insert id="insertFsPatient" parameterType="FsPatient" useGeneratedKeys="true" keyProperty="patientId">
  39. insert into fs_patient
  40. <trim prefix="(" suffix=")" suffixOverrides=",">
  41. <if test="patientName != null">patient_name,</if>
  42. <if test="userId != null">user_id,</if>
  43. <if test="idCard != null">id_card,</if>
  44. <if test="birthday != null">birthday,</if>
  45. <if test="gender != null">gender,</if>
  46. <if test="status != null">status,</if>
  47. <if test="isDel != null">is_del,</if>
  48. <if test="patientRelation != null">patient_relation,</if>
  49. </trim>
  50. <trim prefix="values (" suffix=")" suffixOverrides=",">
  51. <if test="patientName != null">#{patientName},</if>
  52. <if test="userId != null">#{userId},</if>
  53. <if test="idCard != null">#{idCard},</if>
  54. <if test="birthday != null">#{birthday},</if>
  55. <if test="gender != null">#{gender},</if>
  56. <if test="status != null">#{status},</if>
  57. <if test="isDel != null">#{isDel},</if>
  58. <if test="patientRelation != null">#{patientRelation},</if>
  59. </trim>
  60. </insert>
  61. <update id="updateFsPatient" parameterType="FsPatient">
  62. update fs_patient
  63. <trim prefix="SET" suffixOverrides=",">
  64. <if test="patientName != null">patient_name = #{patientName},</if>
  65. <if test="userId != null">user_id = #{userId},</if>
  66. <if test="idCard != null">id_card = #{idCard},</if>
  67. <if test="birthday != null">birthday = #{birthday},</if>
  68. <if test="gender != null">gender = #{gender},</if>
  69. <if test="status != null">status = #{status},</if>
  70. <if test="isDel != null">is_del = #{isDel},</if>
  71. <if test="patientRelation != null">patient_relation = #{patientRelation},</if>
  72. </trim>
  73. where patient_id = #{patientId}
  74. </update>
  75. <update id="deleteFsPatientById" parameterType="Long">
  76. update fs_patient set is_del=1 where patient_id = #{patientId}
  77. </update>
  78. <update id="deleteFsPatientByIds" parameterType="String">
  79. update fs_patient set is_del=1 where patient_id in
  80. <foreach item="patientId" collection="array" open="(" separator="," close=")">
  81. #{patientId}
  82. </foreach>
  83. </update>
  84. </mapper>