1
0

ApiTopicCategoryMapper.xml 2.0 KB

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