FsHospitalMapper.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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.his.mapper.FsHospitalMapper">
  6. <resultMap type="FsHospital" id="FsHospitalResult">
  7. <result property="hospitalId" column="hospital_id" />
  8. <result property="hospitalName" column="hospital_name" />
  9. <result property="hospitalType" column="hospital_type" />
  10. <result property="hospitalLevel" column="hospital_level" />
  11. <result property="descs" column="descs" />
  12. <result property="imgUrl" column="img_url" />
  13. <result property="cityIds" column="city_ids" />
  14. <result property="province" column="province" />
  15. <result property="city" column="city" />
  16. <result property="district" column="district" />
  17. <result property="address" column="address" />
  18. <result property="lng" column="lng" />
  19. <result property="lat" column="lat" />
  20. <result property="status" column="status" />
  21. <result property="remark" column="remark" />
  22. <result property="sealUrl" column="seal_url" />
  23. <result property="phone" column="phone" />
  24. </resultMap>
  25. <sql id="selectFsHospitalVo">
  26. select hospital_id, hospital_name, hospital_type, hospital_level, descs, img_url, city_ids, province, city, district, address, lng, lat, status, remark, seal_url, phone from fs_hospital
  27. </sql>
  28. <select id="selectFsHospitalList" parameterType="FsHospital" resultMap="FsHospitalResult">
  29. <include refid="selectFsHospitalVo"/>
  30. <where>
  31. <if test="hospitalName != null and hospitalName != ''"> and hospital_name like concat('%', #{hospitalName}, '%')</if>
  32. <if test="hospitalType != null "> and hospital_type = #{hospitalType}</if>
  33. <if test="hospitalLevel != null "> and hospital_level = #{hospitalLevel}</if>
  34. <if test="descs != null and descs != ''"> and descs = #{descs}</if>
  35. <if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
  36. <if test="cityIds != null and cityIds != ''"> and city_ids = #{cityIds}</if>
  37. <if test="province != null and province != ''"> and province = #{province}</if>
  38. <if test="city != null and city != ''"> and city = #{city}</if>
  39. <if test="district != null and district != ''"> and district = #{district}</if>
  40. <if test="address != null and address != ''"> and address = #{address}</if>
  41. <if test="lng != null and lng != ''"> and lng = #{lng}</if>
  42. <if test="lat != null and lat != ''"> and lat = #{lat}</if>
  43. <if test="status != null "> and status = #{status}</if>
  44. <if test="sealUrl != null and sealUrl != ''"> and seal_url = #{sealUrl}</if>
  45. <if test="phone != null and phone != ''"> and phone = #{phone}</if>
  46. </where>
  47. ORDER BY hospital_id DESC
  48. </select>
  49. <select id="selectFsHospitalByHospitalId" parameterType="Long" resultMap="FsHospitalResult">
  50. <include refid="selectFsHospitalVo"/>
  51. where hospital_id = #{hospitalId}
  52. </select>
  53. <insert id="insertFsHospital" parameterType="FsHospital" useGeneratedKeys="true" keyProperty="hospitalId">
  54. insert into fs_hospital
  55. <trim prefix="(" suffix=")" suffixOverrides=",">
  56. <if test="hospitalName != null">hospital_name,</if>
  57. <if test="hospitalType != null">hospital_type,</if>
  58. <if test="hospitalLevel != null">hospital_level,</if>
  59. <if test="descs != null">descs,</if>
  60. <if test="imgUrl != null">img_url,</if>
  61. <if test="cityIds != null">city_ids,</if>
  62. <if test="province != null">province,</if>
  63. <if test="city != null">city,</if>
  64. <if test="district != null">district,</if>
  65. <if test="address != null">address,</if>
  66. <if test="lng != null">lng,</if>
  67. <if test="lat != null">lat,</if>
  68. <if test="status != null">status,</if>
  69. <if test="remark != null">remark,</if>
  70. <if test="sealUrl != null">seal_url,</if>
  71. <if test="phone != null">phone,</if>
  72. </trim>
  73. <trim prefix="values (" suffix=")" suffixOverrides=",">
  74. <if test="hospitalName != null">#{hospitalName},</if>
  75. <if test="hospitalType != null">#{hospitalType},</if>
  76. <if test="hospitalLevel != null">#{hospitalLevel},</if>
  77. <if test="descs != null">#{descs},</if>
  78. <if test="imgUrl != null">#{imgUrl},</if>
  79. <if test="cityIds != null">#{cityIds},</if>
  80. <if test="province != null">#{province},</if>
  81. <if test="city != null">#{city},</if>
  82. <if test="district != null">#{district},</if>
  83. <if test="address != null">#{address},</if>
  84. <if test="lng != null">#{lng},</if>
  85. <if test="lat != null">#{lat},</if>
  86. <if test="status != null">#{status},</if>
  87. <if test="remark != null">#{remark},</if>
  88. <if test="sealUrl != null">#{sealUrl},</if>
  89. <if test="phone != null">#{phone},</if>
  90. </trim>
  91. </insert>
  92. <update id="updateFsHospital" parameterType="FsHospital">
  93. update fs_hospital
  94. <trim prefix="SET" suffixOverrides=",">
  95. <if test="hospitalName != null">hospital_name = #{hospitalName},</if>
  96. <if test="hospitalType != null">hospital_type = #{hospitalType},</if>
  97. <if test="hospitalLevel != null">hospital_level = #{hospitalLevel},</if>
  98. <if test="descs != null">descs = #{descs},</if>
  99. <if test="imgUrl != null">img_url = #{imgUrl},</if>
  100. <if test="cityIds != null">city_ids = #{cityIds},</if>
  101. <if test="province != null">province = #{province},</if>
  102. <if test="city != null">city = #{city},</if>
  103. <if test="district != null">district = #{district},</if>
  104. <if test="address != null">address = #{address},</if>
  105. <if test="lng != null">lng = #{lng},</if>
  106. <if test="lat != null">lat = #{lat},</if>
  107. <if test="status != null">status = #{status},</if>
  108. <if test="remark != null">remark = #{remark},</if>
  109. <if test="sealUrl != null">seal_url = #{sealUrl},</if>
  110. <if test="phone != null">phone = #{phone},</if>
  111. </trim>
  112. where hospital_id = #{hospitalId}
  113. </update>
  114. <delete id="deleteFsHospitalByHospitalId" parameterType="Long">
  115. delete from fs_hospital where hospital_id = #{hospitalId}
  116. </delete>
  117. <delete id="deleteFsHospitalByHospitalIds" parameterType="String">
  118. delete from fs_hospital where hospital_id in
  119. <foreach item="hospitalId" collection="array" open="(" separator="," close=")">
  120. #{hospitalId}
  121. </foreach>
  122. </delete>
  123. </mapper>