EntMapMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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.sys.mapper.EntMapMapper">
  4. <resultMap id="MapDtoMap" type="com.zhyc.xps.sys.dto.EntMapDto">
  5. <result column="oc_id" property="ocId" jdbcType="BIGINT"/>
  6. <result column="map_id" property="mapId" jdbcType="BIGINT"/>
  7. <result column="map_title" property="mapTitle" jdbcType="VARCHAR"/>
  8. <result column="map_desc" property="mapDesc" jdbcType="VARCHAR"/>
  9. <result column="map_cat_id" property="mapCatId" jdbcType="BIGINT"/>
  10. <result column="map_raster_layer" property="mapRasterLayer" jdbcType="VARCHAR"/>
  11. <result column="map_type_id" property="mapTypeId" jdbcType="BIGINT"/>
  12. </resultMap>
  13. <sql id="MapDto_Cols">
  14. oc_id,
  15. map_id,
  16. map_title,
  17. map_desc,
  18. map_cat_id,
  19. map_raster_layer,
  20. map_type_id
  21. </sql>
  22. <!--根据ID获取信息-->
  23. <select id="getById" resultMap="MapDtoMap">
  24. SELECT
  25. <include refid="MapDto_Cols"/>
  26. FROM ent_map
  27. WHERE 1 = 1
  28. <if test="ocId != null">
  29. AND oc_id = #{ocId ,jdbcType=BIGINT}
  30. </if>
  31. <if test="mapId != null">
  32. AND map_id = #{mapId ,jdbcType=BIGINT}
  33. </if>
  34. </select>
  35. <!--分页查询信息-->
  36. <select id="getByPage" parameterType="java.util.Map" resultMap="MapDtoMap">
  37. SELECT
  38. <include refid="MapDto_Cols"/>
  39. FROM ent_map
  40. WHERE 1 = 1 AND deleted_flag = 0
  41. <if test="ocId != null">
  42. AND oc_id = #{ocId ,jdbcType=BIGINT}
  43. </if>
  44. <if test="keywords != null and keywords != ''">
  45. and map_title like "%"#{keywords}"%"
  46. </if>
  47. ORDER BY map_id ASC
  48. </select>
  49. <select id="getByList" parameterType="java.util.Map" resultMap="MapDtoMap" >
  50. SELECT
  51. <include refid="MapDto_Cols"/>
  52. FROM ent_map
  53. WHERE 1 = 1 AND deleted_flag = 0
  54. <if test="ocId != null">
  55. AND oc_id = #{ocId ,jdbcType=BIGINT}
  56. </if>
  57. <if test="keywords != null and keywords != ''">
  58. AND map_title like "%"#{keywords}"%"
  59. </if>
  60. </select>
  61. <insert id="create" parameterType="com.zhyc.xps.sys.entity.EntMap">
  62. INSERT INTO ent_map
  63. <trim prefix="(" suffix=")" suffixOverrides=",">
  64. <if test="ocId != null">
  65. oc_id,
  66. </if>
  67. <if test="mapId != null">
  68. map_id,
  69. </if>
  70. <if test="mapTitle != null">
  71. map_title,
  72. </if>
  73. <if test="mapDesc != null">
  74. map_desc,
  75. </if>
  76. <if test="mapRasterLayer != null">
  77. map_raster_layer,
  78. </if>
  79. <if test="mapCatId != null">
  80. map_cat_id,
  81. </if>
  82. <if test="mapTypeId != null">
  83. map_type_id,
  84. </if>
  85. <if test="createdBy != null">
  86. created_by,
  87. </if>
  88. <if test="createdAt != null">
  89. created_at,
  90. </if>
  91. </trim>
  92. <trim prefix="values (" suffix=")" suffixOverrides=",">
  93. <if test="ocId != null">
  94. #{ocId ,jdbcType=BIGINT},
  95. </if>
  96. <if test="mapId != null">
  97. #{mapId ,jdbcType=BIGINT},
  98. </if>
  99. <if test="mapTitle != null">
  100. #{mapTitle ,jdbcType=VARCHAR},
  101. </if>
  102. <if test="mapDesc != null">
  103. #{mapDesc ,jdbcType=VARCHAR},
  104. </if>
  105. <if test="mapRasterLayer != null">
  106. #{mapRasterLayer ,jdbcType=BIGINT},
  107. </if>
  108. <if test="mapCatId != null">
  109. #{mapCatId ,jdbcType=BIGINT},
  110. </if>
  111. <if test="mapTypeId != null">
  112. #{mapTypeId ,jdbcType=BIGINT},
  113. </if>
  114. <if test="createdBy != null">
  115. #{createdBy ,jdbcType=BIGINT},
  116. </if>
  117. <if test="createdAt != null">
  118. #{createdAt ,jdbcType=TIMESTAMP},
  119. </if>
  120. </trim>
  121. </insert>
  122. <!--更新-->
  123. <update id="update" parameterType="com.zhyc.xps.sys.entity.EntMap">
  124. UPDATE ent_map
  125. <trim suffixOverrides=",">
  126. <set>
  127. <if test="mapTitle != null and mapTitle != ''">
  128. map_title = #{mapTitle, jdbcType=VARCHAR},
  129. </if>
  130. <if test="mapDesc != null and mapDesc != ''">
  131. map_desc = #{mapDesc, jdbcType=VARCHAR},
  132. </if>
  133. <if test="mapRasterLayer != null and mapRasterLayer != ''">
  134. map_raster_layer = #{mapRasterLayer ,jdbcType=VARCHAR},
  135. </if>
  136. <if test="mapCatId != null">
  137. map_cat_id = #{mapCatId ,jdbcType=BIGINT},
  138. </if>
  139. <if test="mapTypeId != null">
  140. map_type_id = #{mapTypeId ,jdbcType=BIGINT},
  141. </if>
  142. <if test="updatedBy != null ">
  143. updated_by = #{updatedBy ,jdbcType=BIGINT},
  144. </if>
  145. <if test="updatedAt != null">
  146. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  147. </if>
  148. </set>
  149. </trim>
  150. WHERE 1 = 1
  151. <if test="ocId != null">
  152. AND oc_id = #{ocId ,jdbcType=BIGINT}
  153. </if>
  154. <if test="mapId != null">
  155. AND map_id = #{mapId ,jdbcType=BIGINT}
  156. </if>
  157. </update>
  158. <!--删除-->
  159. <update id="delete" parameterType="java.util.Map">
  160. UPDATE ent_map
  161. <trim suffixOverrides=",">
  162. <set>
  163. <if test="deletedFlag != null">
  164. deleted_flag = #{deletedFlag, jdbcType=BIGINT},
  165. </if>
  166. <if test="deletedAt != null">
  167. deleted_at = #{deletedAt, jdbcType=TIMESTAMP},
  168. </if>
  169. <if test="deletedBy != null">
  170. deleted_by = #{deletedBy,jdbcType=BIGINT},
  171. </if>
  172. </set>
  173. </trim>
  174. WHERE 1 =1
  175. <if test="mapId != null">
  176. AND map_id = #{mapId ,jdbcType=BIGINT}
  177. </if>
  178. <if test="ocId != null">
  179. AND oc_id = #{ocId ,jdbcType=BIGINT}
  180. </if>
  181. </update>
  182. </mapper>