BerthingPointConfigMapper.xml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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.ruoyi.system.mapper.BerthingPointConfigMapper">
  4. <resultMap type="com.ruoyi.system.domain.BerthingPointConfig" id="BerthingPointConfigMap">
  5. <result property="stopId" column="stop_id" jdbcType="INTEGER"/>
  6. <result property="id" column="id" jdbcType="VARCHAR"/>
  7. <result property="siteId" column="site_id" jdbcType="INTEGER"/>
  8. <result property="planid" column="planid" jdbcType="INTEGER"/>
  9. <result property="berthingId" column="berthing_id" jdbcType="INTEGER"/>
  10. <result property="positions" column="positions" jdbcType="VARCHAR"/>
  11. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  12. <result property="status" column="status" jdbcType="INTEGER"/>
  13. <result property="isDel" column="is_del" jdbcType="INTEGER"/>
  14. <result property="wlevel" column="wlevel" jdbcType="NUMERIC"/>
  15. <result property="factors" column="factors" jdbcType="VARCHAR"/>
  16. <result property="siteName" column="site_name" jdbcType="VARBINARY"/>
  17. </resultMap>
  18. <!--查询单个-->
  19. <select id="queryById" resultMap="BerthingPointConfigMap">
  20. select
  21. stop_id, id, site_id, planid, berthing_id, positions, create_time, status, is_del, wlevel, factors
  22. from berthing_point_config
  23. where stop_id = #{stopId}
  24. </select>
  25. <!--查询单个-->
  26. <select id="queryByPlanid" resultMap="BerthingPointConfigMap">
  27. select
  28. stop_id, id, site_id, planid, berthing_id, positions, create_time, status, is_del, wlevel, factors
  29. from berthing_point_config
  30. where site_id = #{siteId} and planid = #{planid} and is_del = 0
  31. </select>
  32. <!--查询单个-->
  33. <select id="queryMaxPlanid" resultMap="BerthingPointConfigMap">
  34. select
  35. MAX(planid) as planid
  36. from berthing_point_config
  37. where site_id = #{siteId} and is_del = 0
  38. </select>
  39. <!--查询指定行数据-->
  40. <select id="queryAllByLimit" resultMap="BerthingPointConfigMap">
  41. select
  42. a.stop_id, a.id, a.site_id, a.planid, a.berthing_id, a.positions, a.create_time, a.status, a.is_del, a.wlevel, a.factors, b.site_name
  43. from berthing_point_config as a
  44. join site_info as b on a.site_id = b.site_id
  45. <where>
  46. <if test="stopPointQuery.stopId != null">
  47. and a.stop_id = #{stopPointQuery.stopId}
  48. </if>
  49. <if test="stopPointQuery.siteId != null">
  50. and a.site_id = #{stopPointQuery.siteId}
  51. </if>
  52. and a.is_del = 0
  53. </where>
  54. order by a.wlevel desc
  55. </select>
  56. <!--统计总行数-->
  57. <select id="count" resultType="java.lang.Long">
  58. select count(1)
  59. from berthing_point_config
  60. <where>
  61. <if test="stopId != null">
  62. and stop_id = #{stopId}
  63. </if>
  64. <if test="id != null and id != ''">
  65. and id = #{id}
  66. </if>
  67. <if test="siteId != null">
  68. and site_id = #{siteId}
  69. </if>
  70. <if test="planid != null">
  71. and planid = #{planid}
  72. </if>
  73. <if test="berthingId != null">
  74. and berthing_id = #{berthingId}
  75. </if>
  76. <if test="positions != null and positions != ''">
  77. and positions = #{positions}
  78. </if>
  79. <if test="createTime != null">
  80. and create_time = #{createTime}
  81. </if>
  82. <if test="status != null">
  83. and status = #{status}
  84. </if>
  85. <if test="isDel != null">
  86. and is_del = #{isDel}
  87. </if>
  88. <if test="wlevel != null">
  89. and wlevel = #{wlevel}
  90. </if>
  91. <if test="factors != null and factors != ''">
  92. and factors = #{factors}
  93. </if>
  94. and is_del = 0
  95. </where>
  96. </select>
  97. <!--新增所有列-->
  98. <insert id="insert" keyProperty="stopId" useGeneratedKeys="true">
  99. insert into berthing_point_config (id, site_id, planid, berthing_id, positions, create_time, status, is_del, wlevel, factors)
  100. values (#{id}, #{siteId}, #{planid}, #{berthingId}, #{positions}, #{createTime}, #{status}, #{isDel}, #{wlevel}, #{factors})
  101. </insert>
  102. <insert id="insertBatch" keyProperty="stopId" useGeneratedKeys="true">
  103. insert into berthing_point_config(id, site_id, planid, berthing_id, positions, create_time, status, is_del, wlevel, factors)
  104. values
  105. <foreach collection="entities" item="entity" separator=",">
  106. (#{entity.id}, #{entity.siteId}, #{entity.planid}, #{entity.berthingId}, #{entity.positions}, #{entity.createTime}, #{entity.status}, #{entity.isDel}, #{entity.wlevel}, #{entity.factors})
  107. </foreach>
  108. </insert>
  109. <insert id="insertOrUpdateBatch" keyProperty="stopId" useGeneratedKeys="true">
  110. insert into berthing_point_config(id, site_id, planid, berthing_id, positions, create_time, status, is_del, wlevel, factors)
  111. values
  112. <foreach collection="entities" item="entity" separator=",">
  113. (#{entity.id}, #{entity.siteId}, #{entity.planid}, #{entity.berthingId}, #{entity.positions}, #{entity.createTime}, #{entity.status}, #{entity.isDel}, #{entity.wlevel}, #{entity.factors})
  114. </foreach>
  115. on duplicate key update
  116. id = values(id),
  117. site_id = values(site_id),
  118. planid = values(planid),
  119. berthing_id = values(berthing_id),
  120. positions = values(positions),
  121. create_time = values(create_time),
  122. status = values(status),
  123. is_del = values(is_del),
  124. wlevel = values(wlevel),
  125. factors = values(factors)
  126. </insert>
  127. <!--通过主键修改数据-->
  128. <update id="update">
  129. update berthing_point_config
  130. <set>
  131. <if test="id != null and id != ''">
  132. id = #{id},
  133. </if>
  134. <if test="siteId != null">
  135. site_id = #{siteId},
  136. </if>
  137. <if test="planid != null">
  138. planid = #{planid},
  139. </if>
  140. <if test="berthingId != null">
  141. berthing_id = #{berthingId},
  142. </if>
  143. <if test="positions != null and positions != ''">
  144. positions = #{positions},
  145. </if>
  146. <if test="createTime != null">
  147. create_time = #{createTime},
  148. </if>
  149. <if test="status != null">
  150. status = #{status},
  151. </if>
  152. <if test="isDel != null">
  153. is_del = #{isDel},
  154. </if>
  155. <if test="wlevel != null">
  156. wlevel = #{wlevel},
  157. </if>
  158. <if test="factors != null and factors != ''">
  159. factors = #{factors},
  160. </if>
  161. </set>
  162. where stop_id = #{stopId}
  163. </update>
  164. <!--通过主键删除-->
  165. <update id="deleteById">
  166. update berthing_point_config set is_del = 1 where stop_id = #{stopId}
  167. </update>
  168. </mapper>