HospitalMemberLevelMapper.xml 5.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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.hospital.mapper.HospitalMemberLevelMapper">
  6. <resultMap type="HospitalMemberLevel" id="HospitalMemberLevelResult">
  7. <result property="levelId" column="level_id" />
  8. <result property="levelName" column="level_name" />
  9. <result property="level" column="level" />
  10. <result property="levelValue" column="level_value" />
  11. <result property="totalIntegral" column="total_integral" />
  12. <result property="hospitalId" column="hospital_id" />
  13. <result property="configJson" column="config_json" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateTime" column="update_time" />
  16. <result property="createBy" column="create_by" />
  17. <result property="updateBy" column="update_by" />
  18. </resultMap>
  19. <sql id="selectHospitalMemberLevelVo">
  20. select level_id, level_name, level, level_value,total_integral, hospital_id, config_json, create_time, update_time, create_by, update_by from hospital_member_level
  21. </sql>
  22. <select id="selectHospitalMemberLevelList" parameterType="HospitalMemberLevel" resultMap="HospitalMemberLevelResult">
  23. <include refid="selectHospitalMemberLevelVo"/>
  24. <where>
  25. <if test="levelName != null and levelName != ''"> and level_name like concat('%', #{levelName}, '%')</if>
  26. <if test="level != null "> and level = #{level}</if>
  27. <if test="levelValue != null "> and level_value = #{levelValue}</if>
  28. <if test="totalIntegral != null "> and total_integral = #{totalIntegral}</if>
  29. <if test="hospitalId != null "> and hospital_id = #{hospitalId}</if>
  30. <if test="configJson != null and configJson != ''"> and config_json = #{configJson}</if>
  31. </where>
  32. </select>
  33. <select id="selectHospitalMemberLevelByLevelId" parameterType="Long" resultMap="HospitalMemberLevelResult">
  34. <include refid="selectHospitalMemberLevelVo"/>
  35. where level_id = #{levelId}
  36. </select>
  37. <insert id="insertHospitalMemberLevel" parameterType="HospitalMemberLevel" useGeneratedKeys="true" keyProperty="levelId">
  38. insert into hospital_member_level
  39. <trim prefix="(" suffix=")" suffixOverrides=",">
  40. <if test="levelName != null">level_name,</if>
  41. <if test="level != null">level,</if>
  42. <if test="levelValue != null">level_value,</if>
  43. <if test="totalIntegral != null">total_integral,</if>
  44. <if test="hospitalId != null">hospital_id,</if>
  45. <if test="configJson != null">config_json,</if>
  46. <if test="createTime != null">create_time,</if>
  47. <if test="updateTime != null">update_time,</if>
  48. <if test="createBy != null">create_by,</if>
  49. <if test="updateBy != null">update_by,</if>
  50. </trim>
  51. <trim prefix="values (" suffix=")" suffixOverrides=",">
  52. <if test="levelName != null">#{levelName},</if>
  53. <if test="level != null">#{level},</if>
  54. <if test="levelValue != null">#{levelValue},</if>
  55. <if test="totalIntegral != null">#{totalIntegral},</if>
  56. <if test="hospitalId != null">#{hospitalId},</if>
  57. <if test="configJson != null">#{configJson},</if>
  58. <if test="createTime != null">#{createTime},</if>
  59. <if test="updateTime != null">#{updateTime},</if>
  60. <if test="createBy != null">#{createBy},</if>
  61. <if test="updateBy != null">#{updateBy},</if>
  62. </trim>
  63. </insert>
  64. <update id="updateHospitalMemberLevel" parameterType="HospitalMemberLevel">
  65. update hospital_member_level
  66. <trim prefix="SET" suffixOverrides=",">
  67. <if test="levelName != null">level_name = #{levelName},</if>
  68. <if test="level != null">level = #{level},</if>
  69. <if test="levelValue != null">level_value = #{levelValue},</if>
  70. <if test="totalIntegral != null">total_integral = #{totalIntegral},</if>
  71. <if test="hospitalId != null">hospital_id = #{hospitalId},</if>
  72. <if test="configJson != null">config_json = #{configJson},</if>
  73. <if test="createTime != null">create_time = #{createTime},</if>
  74. <if test="updateTime != null">update_time = #{updateTime},</if>
  75. <if test="createBy != null">create_by = #{createBy},</if>
  76. <if test="updateBy != null">update_by = #{updateBy},</if>
  77. </trim>
  78. where level_id = #{levelId}
  79. </update>
  80. <delete id="deleteHospitalMemberLevelByLevelId" parameterType="Long">
  81. delete from hospital_member_level where level_id = #{levelId}
  82. </delete>
  83. <delete id="deleteHospitalMemberLevelByLevelIds" parameterType="String">
  84. delete from hospital_member_level where level_id in
  85. <foreach item="levelId" collection="array" open="(" separator="," close=")">
  86. #{levelId}
  87. </foreach>
  88. </delete>
  89. </mapper>