FamilyInformationMapper.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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.supervision.peopleManage.mapper.FamilyInformationMapper">
  6. <resultMap type="FamilyInformation" id="FamilyInformationResult">
  7. <result property="id" column="id" />
  8. <result property="peopleId" column="people_id" />
  9. <result property="name" column="name" />
  10. <result property="characterRelationship" column="character_relationship" />
  11. <result property="phoneNumber" column="phone_number" />
  12. <result property="unitName" column="unit_name" />
  13. </resultMap>
  14. <sql id="selectFamilyInformationVo">
  15. select id, people_id, name, character_relationship, phone_number, unit_name from family_information
  16. </sql>
  17. <select id="selectFamilyInformationList" parameterType="FamilyInformation" resultMap="FamilyInformationResult">
  18. <include refid="selectFamilyInformationVo"/>
  19. <where>
  20. <if test="peopleId != null "> and people_id = #{peopleId}</if>
  21. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  22. <if test="characterRelationship != null and characterRelationship != ''"> and character_relationship = #{characterRelationship}</if>
  23. <if test="phoneNumber != null and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>
  24. <if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
  25. </where>
  26. </select>
  27. <select id="selectFamilyInformationById" parameterType="Long" resultMap="FamilyInformationResult">
  28. <include refid="selectFamilyInformationVo"/>
  29. where id = #{id}
  30. </select>
  31. <insert id="insertFamilyInformation" parameterType="FamilyInformation">
  32. insert into family_information
  33. <trim prefix="(" suffix=")" suffixOverrides=",">
  34. <if test="id != null">id,</if>
  35. <if test="peopleId != null">people_id,</if>
  36. <if test="name != null">name,</if>
  37. <if test="characterRelationship != null">character_relationship,</if>
  38. <if test="phoneNumber != null">phone_number,</if>
  39. <if test="unitName != null">unit_name,</if>
  40. </trim>
  41. <trim prefix="values (" suffix=")" suffixOverrides=",">
  42. <if test="id != null">#{id},</if>
  43. <if test="peopleId != null">#{peopleId},</if>
  44. <if test="name != null">#{name},</if>
  45. <if test="characterRelationship != null">#{characterRelationship},</if>
  46. <if test="phoneNumber != null">#{phoneNumber},</if>
  47. <if test="unitName != null">#{unitName},</if>
  48. </trim>
  49. </insert>
  50. <update id="updateFamilyInformation" parameterType="FamilyInformation">
  51. update family_information
  52. <trim prefix="SET" suffixOverrides=",">
  53. <if test="peopleId != null">people_id = #{peopleId},</if>
  54. <if test="name != null">name = #{name},</if>
  55. <if test="characterRelationship != null">character_relationship = #{characterRelationship},</if>
  56. <if test="phoneNumber != null">phone_number = #{phoneNumber},</if>
  57. <if test="unitName != null">unit_name = #{unitName},</if>
  58. </trim>
  59. where id = #{id}
  60. </update>
  61. <delete id="deleteFamilyInformationById" parameterType="Long">
  62. delete from family_information where id = #{id}
  63. </delete>
  64. <delete id="deleteFamilyInformationByIds" parameterType="String">
  65. delete from family_information where id in
  66. <foreach item="id" collection="array" open="(" separator="," close=")">
  67. #{id}
  68. </foreach>
  69. </delete>
  70. </mapper>