ReleaseMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.supplier.mapper.ReleaseMapper">
  5. <!-- 供应商发布路线 -->
  6. <insert id="addReleaseVal" parameterType="SupplierRoute">
  7. insert into bus_supplier_route(code,origin,destination,start_time,end_time,look_num,title_img,offer_name,price_all,people_num,uuid,jdrq,update_date,title_day_name,state_type)
  8. values(#{code},#{origin},#{destination},#{startTime},#{endTime},0,#{titleImg},#{offerName},#{priceAll},#{peopleNum},#{uuid},CONVERT(VARCHAR(100), SYSDATETIME(), 20),CONVERT(VARCHAR(100), SYSDATETIME(), 20),#{titleDayName},'1')
  9. </insert>
  10. <!-- 查询路线发布 -->
  11. <select id="getRelease" parameterType="SupplierRoute" resultType="SupplierRoute">
  12. select top ${limit} * from bus_supplier_route
  13. <trim prefix="WHERE" prefixOverrides="and | or">
  14. <if test="startTime != null and startTime !=''">
  15. and CONVERT (datetime, start_time) <![CDATA[ >= ]]> #{startTime} and CONVERT(datetime, end_time) <![CDATA[ <= ]]> #{endTime}
  16. </if>
  17. <if test="destination != null and destination !=''">
  18. and destination = #{destination}
  19. </if>
  20. <if test="code != null and code !=''">
  21. and code = #{code}
  22. </if>
  23. and state_type = '1'
  24. and id not in (select top ${page} id from bus_supplier_route
  25. <trim prefix="WHERE" prefixOverrides="and | or">
  26. <if test="startTime != null and startTime !=''">
  27. and CONVERT (datetime, start_time) <![CDATA[ >= ]]> #{startTime} and CONVERT(datetime, end_time) <![CDATA[ <= ]]> #{endTime}
  28. </if>
  29. <if test="destination != null and destination !=''">
  30. and destination = #{destination}
  31. </if>
  32. <if test="code != null and code !=''">
  33. and code = #{code}
  34. </if>
  35. </trim>
  36. order by id desc
  37. ) order by id desc
  38. </trim>
  39. </select>
  40. <!-- 查询路线条数 -->
  41. <select id="getReleaseCount" resultType="int" parameterType="SupplierRoute">
  42. select count(*) as count from bus_supplier_route
  43. <trim prefix="WHERE" prefixOverrides="and | or">
  44. <if test="startTime != null and startTime !=''">
  45. and CONVERT (datetime, start_time) <![CDATA[ >= ]]> #{startTime} and CONVERT(datetime, end_time) <![CDATA[ <= ]]> #{endTime}
  46. </if>
  47. <if test="destination != null and destination !=''">
  48. and destination = #{destination}
  49. </if>
  50. <if test="code != null and code !=''">
  51. and code = #{code}
  52. </if>
  53. and state_type = '1'
  54. </trim>
  55. </select>
  56. <!-- 查询路线条数 -->
  57. <select id="getReleaseVal" resultType="SupplierRoute" parameterType="SupplierRoute">
  58. select * from bus_supplier_route
  59. <trim prefix="WHERE" prefixOverrides="and | or">
  60. <if test="uuid != null and uuid !=''">
  61. and uuid = #{uuid}
  62. </if>
  63. </trim>
  64. </select>
  65. <!-- 修改路线 -->
  66. <update id="updateSupplierRoute" parameterType="SupplierRoute">
  67. update bus_supplier_route
  68. <set>
  69. <trim suffixOverrides=",">
  70. <if test="origin != null and origin != ''">
  71. origin = #{origin},
  72. </if>
  73. <if test="destination != null and destination != ''">
  74. destination = #{destination},
  75. </if>
  76. <if test="startTime != null and startTime != ''">
  77. start_time = #{startTime},
  78. </if>
  79. <if test="endTime != null and endTime != ''">
  80. end_time = #{endTime},
  81. </if>
  82. <if test="titleImg != null and titleImg != ''">
  83. title_img = #{titleImg},
  84. </if>
  85. <if test="offerName != null and offerName != ''">
  86. offer_name = #{offerName},
  87. </if>
  88. <if test="priceAll != null and priceAll != ''">
  89. price_all = #{priceAll},
  90. </if>
  91. <if test="peopleNum != null and peopleNum != ''">
  92. people_num = #{peopleNum},
  93. </if>
  94. update_date = SYSDATETIME(),
  95. </trim>
  96. where uuid = #{uuid}
  97. </set>
  98. </update>
  99. </mapper>