FreightItemDao.xml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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.kmall.admin.dao.FreightItemDao">
  4. <resultMap type="com.kmall.admin.entity.FreightItemEntity" id="freightItemMap">
  5. <result property="id" column="id"/>
  6. <result property="freId" column="fre_id"/>
  7. <result property="deliveryArea" column="delivery_area"/>
  8. <result property="firstPiece" column="first_piece"/>
  9. <result property="freight" column="freight"/>
  10. <result property="continuePiece" column="continue_piece"/>
  11. <result property="renew" column="renew"/>
  12. </resultMap>
  13. <select id="queryObject" resultType="com.kmall.admin.entity.FreightItemEntity">
  14. select
  15. `id`,
  16. `fre_id`,
  17. `delivery_area`,
  18. `first_piece`,
  19. `freight`,
  20. `continue_piece`,
  21. `renew`
  22. from mall_freight_item
  23. where id = #{id}
  24. </select>
  25. <select id="queryList" resultType="com.kmall.admin.entity.FreightItemEntity">
  26. select
  27. `id`,
  28. `fre_id`,
  29. `delivery_area`,
  30. `first_piece`,
  31. `freight`,
  32. `continue_piece`,
  33. `renew`
  34. from mall_freight_item
  35. WHERE 1=1
  36. <if test="name != null and name.trim() != ''">
  37. AND name LIKE concat('%',#{name},'%')
  38. </if>
  39. <if test="freId != null and freId != ''">
  40. AND fre_id = #{freId}
  41. </if>
  42. <choose>
  43. <when test="sidx != null and sidx.trim() != ''">
  44. order by ${sidx} ${order}
  45. </when>
  46. <otherwise>
  47. order by id desc
  48. </otherwise>
  49. </choose>
  50. <if test="offset != null and limit != null">
  51. limit #{offset}, #{limit}
  52. </if>
  53. </select>
  54. <select id="queryTotal" resultType="int">
  55. select count(*) from mall_freight_item
  56. WHERE 1=1
  57. <if test="name != null and name.trim() != ''">
  58. AND name LIKE concat('%',#{name},'%')
  59. </if>
  60. <if test="freId != null and freId != ''">
  61. AND fre_id = #{freId}
  62. </if>
  63. </select>
  64. <insert id="save" parameterType="com.kmall.admin.entity.FreightItemEntity" useGeneratedKeys="true" keyProperty="id">
  65. insert into mall_freight_item(
  66. `fre_id`,
  67. `delivery_area`,
  68. `first_piece`,
  69. `freight`,
  70. `continue_piece`,
  71. `renew`)
  72. values(
  73. #{freId},
  74. #{deliveryArea},
  75. #{firstPiece},
  76. #{freight},
  77. #{continuePiece},
  78. #{renew})
  79. </insert>
  80. <update id="update" parameterType="com.kmall.admin.entity.FreightItemEntity">
  81. update mall_freight_item
  82. <set>
  83. <if test="freId != null">`fre_id` = #{freId}, </if>
  84. <if test="deliveryArea != null">`delivery_area` = #{deliveryArea}, </if>
  85. <if test="firstPiece != null">`first_piece` = #{firstPiece}, </if>
  86. <if test="freight != null">`freight` = #{freight}, </if>
  87. <if test="continuePiece != null">`continue_piece` = #{continuePiece}, </if>
  88. <if test="renew != null">`renew` = #{renew}</if>
  89. </set>
  90. where id = #{id}
  91. </update>
  92. <delete id="delete">
  93. delete from mall_freight_item where id = #{value}
  94. </delete>
  95. <delete id="deleteBatch">
  96. delete from mall_freight_item where id in
  97. <foreach item="id" collection="array" open="(" separator="," close=")">
  98. #{id}
  99. </foreach>
  100. </delete>
  101. <delete id="deleteByFreId">
  102. delete from mall_freight_item where fre_id = #{freId}
  103. </delete>
  104. <select id="queryObjectByFreightId" resultType="com.kmall.admin.entity.FreightItemEntity">
  105. select
  106. `id`,
  107. `fre_id`,
  108. `delivery_area`,
  109. `first_piece`,
  110. `freight`,
  111. `continue_piece`,
  112. `renew`
  113. from mall_freight_item
  114. where fre_id = #{freightId}
  115. </select>
  116. </mapper>