BkFenceMapper.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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.miniapp.bus.mapper.BkFenceMapper">
  6. <resultMap type="com.miniapp.bus.domain.BkFence" id="BkFenceResult">
  7. <result property="id" column="id" />
  8. <result property="customerId" column="customer_id" />
  9. <result property="productId" column="product_id" />
  10. <result property="fenceName" column="fence_name" />
  11. <result property="fenceAlias" column="fence_alias" />
  12. <result property="fenceStartAddress" column="fence_start_address" />
  13. <result property="fenceStartLocation" column="fence_start_location" />
  14. <result property="fenceEndAddress" column="fence_end_address" />
  15. <result property="fenceEndLocation" column="fence_end_location" />
  16. <result property="status" column="status" />
  17. <result property="deltag" column="deltag" />
  18. <result property="createBy" column="create_by" />
  19. <result property="createTime" column="create_time" />
  20. <result property="updateBy" column="update_by" />
  21. <result property="updateTime" column="update_time" />
  22. <result property="remark" column="remark" />
  23. </resultMap>
  24. <resultMap type="com.miniapp.bus.domain.dto.BkFenceDto" id="BkFenceDtoResult">
  25. <result property="id" column="id" />
  26. <result property="customerId" column="customer_id" />
  27. <result property="productId" column="product_id" />
  28. <result property="fenceName" column="fence_name" />
  29. <result property="fenceAlias" column="fence_alias" />
  30. <result property="fenceStartAddress" column="fence_start_address" />
  31. <result property="fenceStartLocation" column="fence_start_location" />
  32. <result property="fenceEndAddress" column="fence_end_address" />
  33. <result property="fenceEndLocation" column="fence_end_location" />
  34. <result property="status" column="status" />
  35. <result property="deltag" column="deltag" />
  36. <result property="createBy" column="create_by" />
  37. <result property="createTime" column="create_time" />
  38. <result property="updateBy" column="update_by" />
  39. <result property="updateTime" column="update_time" />
  40. <result property="remark" column="remark" />
  41. <result property="customerName" column="customer_name" />
  42. <result property="productName" column="productName" />
  43. </resultMap>
  44. <sql id="selectBkFenceVo">
  45. select id, customer_id, product_id, fence_name, fence_alias, fence_start_address, fence_start_location,fence_end_address,fence_end_location, status, deltag, create_by, create_time, update_by, update_time, remark from bk_fence
  46. </sql>
  47. <select id="selectBkFenceList" parameterType="BkFence" resultMap="BkFenceResult">
  48. <include refid="selectBkFenceVo"/>
  49. <where>
  50. <if test="customerId != null "> and customer_id = #{customerId}</if>
  51. <if test="productId != null "> and product_id = #{productId}</if>
  52. <if test="fenceName != null and fenceName != ''"> and fence_name like concat('%', #{fenceName}, '%')</if>
  53. <if test="fenceAlias != null and fenceAlias != ''"> and fence_alias = #{fenceAlias}</if>
  54. <if test="status != null and status != ''"> and status = #{status}</if>
  55. <if test="deltag != null and deltag != ''"> and deltag = #{deltag}</if>
  56. </where>
  57. </select>
  58. <select id="selectBkFenceById" parameterType="Long" resultMap="BkFenceResult">
  59. <include refid="selectBkFenceVo"/>
  60. where id = #{id}
  61. </select>
  62. <insert id="insertBkFence" parameterType="BkFence" useGeneratedKeys="true" keyProperty="id">
  63. insert into bk_fence
  64. <trim prefix="(" suffix=")" suffixOverrides=",">
  65. <if test="customerId != null">customer_id,</if>
  66. <if test="productId != null">product_id,</if>
  67. <if test="fenceName != null">fence_name,</if>
  68. <if test="fenceAlias != null">fence_alias,</if>
  69. <if test="fenceStartAddress != null">fence_start_address,</if>
  70. <if test="fenceStartLocation != null">fence_start_location,</if>
  71. <if test="fenceEndAddress != null">fence_end_address,</if>
  72. <if test="fenceEndLocation != null">fence_end_location,</if>
  73. <if test="status != null">status,</if>
  74. <if test="deltag != null">deltag,</if>
  75. <if test="createBy != null">create_by,</if>
  76. <if test="createTime != null">create_time,</if>
  77. <if test="updateBy != null">update_by,</if>
  78. <if test="updateTime != null">update_time,</if>
  79. <if test="remark != null">remark,</if>
  80. </trim>
  81. <trim prefix="values (" suffix=")" suffixOverrides=",">
  82. <if test="customerId != null">#{customerId},</if>
  83. <if test="productId != null">#{productId},</if>
  84. <if test="fenceName != null">#{fenceName},</if>
  85. <if test="fenceAlias != null">#{fenceAlias},</if>
  86. <if test="fenceStartAddress != null">#{fenceStartAddress},</if>
  87. <if test="fenceStartLocation != null">#{fenceStartLocation},</if>
  88. <if test="fenceEndAddress != null">#{fenceEndAddress},</if>
  89. <if test="fenceEndLocation != null">#{fenceEndLocation},</if>
  90. <if test="status != null">#{status},</if>
  91. <if test="deltag != null">#{deltag},</if>
  92. <if test="createBy != null">#{createBy},</if>
  93. <if test="createTime != null">#{createTime},</if>
  94. <if test="updateBy != null">#{updateBy},</if>
  95. <if test="updateTime != null">#{updateTime},</if>
  96. <if test="remark != null">#{remark},</if>
  97. </trim>
  98. </insert>
  99. <update id="updateBkFence" parameterType="BkFence">
  100. update bk_fence
  101. <trim prefix="SET" suffixOverrides=",">
  102. <if test="customerId != null">customer_id = #{customerId},</if>
  103. <if test="productId != null">product_id = #{productId},</if>
  104. <if test="fenceName != null">fence_name = #{fenceName},</if>
  105. <if test="fenceAlias != null">fence_alias = #{fenceAlias},</if>
  106. <if test="fenceStartAddress != null">fence_start_address = #{fenceStartAddress},</if>
  107. <if test="fenceStartLocation != null">fence_start_location = #{fenceStartLocation},</if>
  108. <if test="fenceEndAddress != null">fence_end_address = #{fenceEndAddress},</if>
  109. <if test="fenceEndLocation != null">fence_end_location = #{fenceEndLocation},</if>
  110. <if test="status != null">status = #{status},</if>
  111. <if test="deltag != null">deltag = #{deltag},</if>
  112. <if test="createBy != null">create_by = #{createBy},</if>
  113. <if test="createTime != null">create_time = #{createTime},</if>
  114. <if test="updateBy != null">update_by = #{updateBy},</if>
  115. <if test="updateTime != null">update_time = #{updateTime},</if>
  116. <if test="remark != null">remark = #{remark},</if>
  117. </trim>
  118. where id = #{id}
  119. </update>
  120. <delete id="deleteBkFenceById" parameterType="Long">
  121. delete from bk_fence where id = #{id}
  122. </delete>
  123. <delete id="deleteBkFenceByIds" parameterType="String">
  124. delete from bk_fence where id in
  125. <foreach item="id" collection="array" open="(" separator="," close=")">
  126. #{id}
  127. </foreach>
  128. </delete>
  129. <select id="selectBkFenceDtoList" parameterType="com.miniapp.bus.domain.dto.BkFenceDto" resultMap="BkFenceDtoResult">
  130. select t.id, t.customer_id, t.product_id, t.fence_name, t.fence_alias, t.fence_start_address, t.fence_start_location,t.fence_end_address,t.fence_end_location, t.status, t.deltag, t.create_by, t.create_time, t.update_by, t.update_time, t.remark,a.productName,b.customer_name from bk_fence t
  131. LEFT JOIN basic_product a ON t.product_id = a.id
  132. LEFT JOIN basic_customer b ON t.customer_id = b.id
  133. <where>
  134. <if test="customerId != null "> and customer_id = #{customerId}</if>
  135. <if test="productId != null "> and product_id = #{productId}</if>
  136. <if test="fenceName != null and fenceName != ''"> and fence_name like concat('%', #{fenceName}, '%')</if>
  137. <if test="fenceAlias != null and fenceAlias != ''"> and fence_alias = #{fenceAlias}</if>
  138. <if test="status != null and status != ''"> and status = #{status}</if>
  139. <if test="deltag != null and deltag != ''"> and deltag = #{deltag}</if>
  140. </where>
  141. </select>
  142. </mapper>