TopicCategoryDao.xml 2.4 KB

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