1
0

AdPositionDao.xml 2.6 KB

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