ShippingDao.xml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.ShippingDao">
  4. <resultMap type="com.kmall.admin.entity.ShippingEntity" id="shippingMap">
  5. <result property="id" column="id"/>
  6. <result property="code" column="code"/>
  7. <result property="name" column="name"/>
  8. </resultMap>
  9. <select id="queryObject" resultType="com.kmall.admin.entity.ShippingEntity">
  10. select
  11. `id`,
  12. `code`,
  13. `name`
  14. from mall_shipping
  15. where id = #{id}
  16. </select>
  17. <select id="queryObjectByCode" resultType="com.kmall.admin.entity.ShippingEntity">
  18. select
  19. `id`,
  20. `code`,
  21. `name`
  22. from mall_shipping
  23. where code = #{code}
  24. </select>
  25. <select id="queryList" resultType="com.kmall.admin.entity.ShippingEntity">
  26. select
  27. `id`,
  28. `code`,
  29. `name`
  30. from mall_shipping
  31. WHERE 1=1 and status = 0
  32. <if test="name != null and name.trim() != ''">
  33. AND name LIKE concat('%',#{name},'%')
  34. </if>
  35. <choose>
  36. <when test="sidx != null and sidx.trim() != ''">
  37. order by ${sidx} ${order}
  38. </when>
  39. <otherwise>
  40. order by id desc
  41. </otherwise>
  42. </choose>
  43. <if test="offset != null and limit != null">
  44. limit #{offset}, #{limit}
  45. </if>
  46. </select>
  47. <select id="queryTotal" resultType="int">
  48. select count(*) from mall_shipping
  49. WHERE 1=1 and status = 0
  50. <if test="name != null and name.trim() != ''">
  51. AND name LIKE concat('%',#{name},'%')
  52. </if>
  53. </select>
  54. <insert id="save" parameterType="com.kmall.admin.entity.ShippingEntity" useGeneratedKeys="true" keyProperty="id">
  55. insert into mall_shipping(
  56. `code`,
  57. `name`)
  58. values(
  59. #{code},
  60. #{name})
  61. </insert>
  62. <update id="update" parameterType="com.kmall.admin.entity.ShippingEntity">
  63. update mall_shipping
  64. <set>
  65. <if test="code != null">`code` = #{code},</if>
  66. <if test="name != null">`name` = #{name}</if>
  67. </set>
  68. where id = #{id}
  69. </update>
  70. <delete id="delete">
  71. delete from mall_shipping where id = #{value}
  72. </delete>
  73. <delete id="deleteBatch">
  74. delete from mall_shipping where id in
  75. <foreach item="id" collection="array" open="(" separator="," close=")">
  76. #{id}
  77. </foreach>
  78. </delete>
  79. </mapper>