HosMapper.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.zhyc.xps.lylc.mapper.HosMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="HosDtoResultMap" type="com.zhyc.xps.lylc.dto.HosDto">
  6. <result column="oc_id" property="ocId" jdbcType="BIGINT" />
  7. <result column="hos_name" property="hosName" jdbcType="VARCHAR" />
  8. <result column="hos_code" property="hosCode" jdbcType="VARCHAR" />
  9. <result column="hos_tyshxydm" property="hosTyshxydm" jdbcType="VARCHAR" />
  10. <result column="hos_wzjd" property="hosWzjd" jdbcType="DECIMAL" />
  11. <result column="hos_wzwd" property="hosWzwd" jdbcType="DECIMAL" />
  12. <result column="hos_zcdz" property="hosZcdz" jdbcType="VARCHAR" />
  13. <result column="hos_scjydz" property="hosScjydz" jdbcType="VARCHAR" />
  14. <result column="hos_cat_id" property="hosCatId" jdbcType="BIGINT" />
  15. <result column="hos_website" property="hosWebsite" jdbcType="VARCHAR" />
  16. <result column="hos_grade" property="hosGrade" jdbcType="BIGINT" />
  17. <result column="hos_level" property="hosLevel" jdbcType="BIGINT" />
  18. <result column="hos_intro" property="hosIntro" jdbcType="VARCHAR" />
  19. <result column="access_time" property="accessTime" jdbcType="TIMESTAMP"/>
  20. <result column="access_status" property="accessStatus" jdbcType="BIGINT" />
  21. </resultMap>
  22. <!-- 通用查询结果列 -->
  23. <sql id="HosDto_Cols">
  24. A.oc_id,
  25. A.hos_name,
  26. A.hos_code,
  27. A.hos_tyshxydm,
  28. A.hos_wzjd,
  29. A.hos_wzwd,
  30. A.hos_zcdz,
  31. A.hos_scjydz,
  32. A.hos_cat_id,
  33. A.hos_website,
  34. A.hos_grade,
  35. A.hos_level,
  36. A.hos_intro,
  37. B.access_time,
  38. B.status AS access_status
  39. </sql>
  40. <!--基于ID查询-->
  41. <select id="getById" resultMap="HosDtoResultMap">
  42. SELECT
  43. <include refid="HosDto_Cols"/>
  44. FROM hos AS A
  45. LEFT JOIN oc_access AS B ON (A.oc_id = B.oc_id)
  46. WHERE A.deleted_flag = 0
  47. <if test="ocId != null">
  48. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  49. </if>
  50. </select>
  51. <!--分页查询-->
  52. <select id="getByPage" parameterType="java.util.Map" resultMap="HosDtoResultMap" >
  53. SELECT
  54. <include refid="HosDto_Cols"/>
  55. FROM hos AS A
  56. LEFT JOIN oc_access AS B ON (A.oc_id = B.oc_id)
  57. WHERE A.deleted_flag = 0
  58. <if test="keywords != null and keywords != ''">
  59. AND A.hos_name like "%"#{keywords}"%"
  60. </if>
  61. ORDER BY A.oc_id ASC
  62. </select>
  63. <!--列表查询-->
  64. <select id="getByList" parameterType="java.util.Map" resultMap="HosDtoResultMap">
  65. SELECT
  66. <include refid="HosDto_Cols"/>
  67. FROM hos AS A
  68. LEFT JOIN oc_access AS B ON (A.oc_id = B.oc_id)
  69. WHERE A.deleted_flag = 0
  70. <if test="keywords != null and keywords != ''">
  71. AND A.hos_name like "%"#{keywords}"%"
  72. </if>
  73. </select>
  74. <insert id="create" parameterType="com.zhyc.xps.lylc.entity.Hos">
  75. INSERT INTO hos
  76. <trim prefix="(" suffix=")" suffixOverrides=",">
  77. <if test="ocId != null">
  78. oc_id,
  79. </if>
  80. <if test="ocId != null">
  81. oc_id,
  82. </if>
  83. <if test="hosName != null and hosName != ''">
  84. hos_name,
  85. </if>
  86. <if test="hosCode != null and hosCode != ''">
  87. hos_code,
  88. </if>
  89. <if test="hosTyshxydm != null and hosTyshxydm != ''">
  90. hos_tyshxydm,
  91. </if>
  92. <if test="hosWzjd != null">
  93. hos_wzjd,
  94. </if>
  95. <if test="hosWzwd != null">
  96. hos_wzwd,
  97. </if>
  98. <if test="hosZcdz != null and hosZcdz != ''">
  99. hos_zcdz,
  100. </if>
  101. <if test="hosScjydz != null and hosScjydz != ''">
  102. hos_scjydz,
  103. </if>
  104. <if test="hosCatId != null">
  105. hos_cat_id,
  106. </if>
  107. <if test="hosWebsite != null and hosWebsite != ''">
  108. hos_website,
  109. </if>
  110. <if test="hosGrade != null">
  111. hos_grade,
  112. </if>
  113. <if test="hosLevel != null">
  114. hos_level,
  115. </if>
  116. <if test="hosIntro != null and hosIntro != ''">
  117. hos_intro,
  118. </if>
  119. <if test="createdBy != null">
  120. created_by,
  121. </if>
  122. <if test="createdAt != null">
  123. created_at,
  124. </if>
  125. </trim>
  126. <trim prefix="values (" suffix=")" suffixOverrides=",">
  127. <if test="ocId != null">
  128. #{ocId,jdbcType=BIGINT},
  129. </if>
  130. <if test="ocId != null">
  131. #{ocId ,jdbcType=BIGINT},
  132. </if>
  133. <if test="hosName != null and hosName != ''">
  134. #{hosName ,jdbcType=VARCHAR},
  135. </if>
  136. <if test="hosCode != null and hosCode != ''">
  137. #{hosCode ,jdbcType=VARCHAR},
  138. </if>
  139. <if test="hosTyshxydm != null and hosTyshxydm != ''">
  140. #{hosTyshxydm ,jdbcType=VARCHAR},
  141. </if>
  142. <if test="hosWzjd != null">
  143. #{hosWzjd ,jdbcType=DECIMAL},
  144. </if>
  145. <if test="hosWzwd != null">
  146. #{hosWzwd ,jdbcType=DECIMAL},
  147. </if>
  148. <if test="hosZcdz != null and hosZcdz != ''">
  149. #{hosZcdz ,jdbcType=VARCHAR},
  150. </if>
  151. <if test="hosScjydz != null and hosScjydz != ''">
  152. #{hosScjydz ,jdbcType=VARCHAR},
  153. </if>
  154. <if test="hosCatId != null">
  155. #{hosCatId ,jdbcType=BIGINT},
  156. </if>
  157. <if test="hosWebsite != null and hosWebsite != ''">
  158. #{hosWebsite ,jdbcType=VARCHAR},
  159. </if>
  160. <if test="hosGrade != null">
  161. #{hosGrade ,jdbcType=BIGINT},
  162. </if>
  163. <if test="hosLevel != null">
  164. #{hosLevel ,jdbcType=BIGINT},
  165. </if>
  166. <if test="hosIntro != null and hosIntro != ''">
  167. #{hosIntro ,jdbcType=VARCHAR},
  168. </if>
  169. <if test="createdBy != null">
  170. #{createdBy ,jdbcType=BIGINT},
  171. </if>
  172. <if test="createdAt != null">
  173. #{createdAt ,jdbcType=TIMESTAMP},
  174. </if>
  175. </trim>
  176. </insert>
  177. <!--更新-->
  178. <update id="update" parameterType="com.zhyc.xps.lylc.entity.Hos">
  179. UPDATE hos
  180. <trim suffixOverrides=",">
  181. <set>
  182. <if test="hosName != null and hosName != ''">
  183. hos_name = #{hosName, jdbcType=VARCHAR},
  184. </if>
  185. <if test="hosCode != null and hosCode != ''">
  186. hos_code = #{hosCode ,jdbcType=VARCHAR},
  187. </if>
  188. <if test="hosTyshxydm != null and hosTyshxydm != ''">
  189. hos_tyshxydm = #{hosTyshxydm ,jdbcType=VARCHAR},
  190. </if>
  191. <if test="hosWzjd != null">
  192. hos_wzjd = #{hosWzjd ,jdbcType=DECIMAL},
  193. </if>
  194. <if test="hosWzwd != null">
  195. hos_wzwd = #{hosWzwd ,jdbcType=DECIMAL},
  196. </if>
  197. <if test="hosZcdz != null and hosZcdz != ''">
  198. hos_zcdz = #{hosZcdz ,jdbcType=VARCHAR},
  199. </if>
  200. <if test="hosScjydz != null and hosScjydz != ''">
  201. hos_scjydz = #{hosScjydz ,jdbcType=VARCHAR},
  202. </if>
  203. <if test="hosCatId != null">
  204. hos_cat_id = #{hosCatId ,jdbcType=BIGINT},
  205. </if>
  206. <if test="hosWebsite != null and hosWebsite != ''">
  207. hos_website = #{hosWebsite ,jdbcType=VARCHAR},
  208. </if>
  209. <if test="hosGrade != null">
  210. hos_grade = #{hosGrade ,jdbcType=BIGINT},
  211. </if>
  212. <if test="hosLevel != null">
  213. hos_level = #{hosLevel ,jdbcType=BIGINT},
  214. </if>
  215. <if test="hosIntro != null and hosIntro != ''">
  216. hos_intro = #{hosIntro, jdbcType=VARCHAR},
  217. </if>
  218. <if test="updatedBy != null ">
  219. updated_by = #{updatedBy ,jdbcType=BIGINT},
  220. </if>
  221. <if test="updatedAt != null">
  222. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  223. </if>
  224. </set>
  225. </trim>
  226. WHERE 1 = 1
  227. <if test="ocId != null">
  228. AND oc_id = #{ocId ,jdbcType=BIGINT}
  229. </if>
  230. </update>
  231. <!--删除-->
  232. <update id="delete" parameterType="java.util.Map">
  233. UPDATE hos
  234. <trim suffixOverrides=",">
  235. <set>
  236. <if test="deletedFlag != null">
  237. deleted_flag = #{deletedFlag,jdbcType=BIGINT},
  238. </if>
  239. <if test="deletedTime != null">
  240. deleted_time = #{deletedTime,jdbcType=TIMESTAMP},
  241. </if>
  242. <if test="deletedBy != null">
  243. deleted_by = #{deletedBy,jdbcType=BIGINT},
  244. </if>
  245. </set>
  246. </trim>
  247. WHERE oc_id = #{ocId ,jdbcType=BIGINT}
  248. </update>
  249. </mapper>