ApiAdPositionMapper.xml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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.api.dao.ApiAdPositionMapper">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.kmall.api.entity.AdPositionVo" id="adPositionMap">
  6. <result property="id" column="id"/>
  7. <result property="name" column="name"/>
  8. <result property="width" column="width"/>
  9. <result property="height" column="height"/>
  10. <result property="desc" column="desc"/>
  11. </resultMap>
  12. <select id="queryObject" resultType="com.kmall.api.entity.AdPositionVo">
  13. select * from mall_ad_position where id = #{value}
  14. </select>
  15. <select id="queryList" resultType="com.kmall.api.entity.AdPositionVo">
  16. select * from mall_ad_position
  17. <choose>
  18. <when test="sidx != null and sidx.trim() != ''">
  19. order by ${sidx} ${order}
  20. </when>
  21. <otherwise>
  22. order by id desc
  23. </otherwise>
  24. </choose>
  25. <if test="offset != null and limit != null">
  26. limit #{offset}, #{limit}
  27. </if>
  28. </select>
  29. <select id="queryTotal" resultType="int">
  30. select count(*) from mall_ad_position
  31. </select>
  32. <insert id="save" parameterType="com.kmall.api.entity.AdPositionVo" useGeneratedKeys="true" keyProperty="id">
  33. insert into mall_ad_position
  34. (
  35. `name`,
  36. `width`,
  37. `height`,
  38. `desc`
  39. )
  40. values
  41. (
  42. #{name},
  43. #{width},
  44. #{height},
  45. #{desc}
  46. )
  47. </insert>
  48. <update id="update" parameterType="com.kmall.api.entity.AdPositionVo">
  49. update mall_ad_position
  50. <set>
  51. <if test="name != null">`name` = #{name},</if>
  52. <if test="width != null">`width` = #{width},</if>
  53. <if test="height != null">`height` = #{height},</if>
  54. <if test="desc != null">`desc` = #{desc}</if>
  55. </set>
  56. where id = #{id}
  57. </update>
  58. <delete id="delete">
  59. delete from mall_ad_position where id = #{value}
  60. </delete>
  61. <delete id="deleteBatch">
  62. delete from mall_ad_position where id in
  63. <foreach item="id" collection="array" open="(" separator="," close=")">
  64. #{id}
  65. </foreach>
  66. </delete>
  67. </mapper>