CmWxPopularSearchMapper.xml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.caimei.modules.miniprogram.dao.CmWxPopularSearchDao">
  4. <sql id="cmWxPopularSearchColumns">
  5. a.id AS "id",
  6. a.sort AS "sort",
  7. a.keyword AS "keyword",
  8. a.clickCount AS "clickCount",
  9. a.addTime AS "addTime",
  10. a.status AS "status"
  11. </sql>
  12. <sql id="cmWxPopularSearchJoins">
  13. </sql>
  14. <select id="get" resultType="CmWxPopularSearch">
  15. SELECT
  16. <include refid="cmWxPopularSearchColumns"/>
  17. FROM cm_wx_popular_search a
  18. <include refid="cmWxPopularSearchJoins"/>
  19. WHERE a.id = #{id}
  20. </select>
  21. <select id="findList" resultType="CmWxPopularSearch">
  22. SELECT
  23. <include refid="cmWxPopularSearchColumns"/>
  24. FROM cm_wx_popular_search a
  25. <include refid="cmWxPopularSearchJoins"/>
  26. <where>
  27. </where>
  28. <choose>
  29. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  30. ORDER BY ${page.orderBy} desc
  31. </when>
  32. <otherwise>
  33. </otherwise>
  34. </choose>
  35. </select>
  36. <select id="findAllList" resultType="CmWxPopularSearch">
  37. SELECT
  38. <include refid="cmWxPopularSearchColumns"/>
  39. FROM cm_wx_popular_search a
  40. <include refid="cmWxPopularSearchJoins"/>
  41. <where>
  42. <if test="keyword != null and keyword != ''">
  43. AND a.keyword = #{keyword}
  44. </if>
  45. </where>
  46. <choose>
  47. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  48. ORDER BY ${page.orderBy} desc
  49. </when>
  50. <otherwise>
  51. </otherwise>
  52. </choose>
  53. </select>
  54. <insert id="insert" parameterType="CmWxPopularSearch" keyProperty="id" useGeneratedKeys="true">
  55. INSERT INTO cm_wx_popular_search(
  56. id,
  57. sort,
  58. keyword,
  59. addTime,
  60. status
  61. ) VALUES (
  62. #{id},
  63. #{sort},
  64. #{keyword},
  65. #{addTime},
  66. #{status}
  67. )
  68. </insert>
  69. <update id="update">
  70. UPDATE cm_wx_popular_search SET
  71. sort = #{sort},
  72. keyword = #{keyword},
  73. addTime = #{addTime},
  74. status = #{status}
  75. WHERE id = #{id}
  76. </update>
  77. <delete id="delete">
  78. DELETE FROM cm_wx_popular_search
  79. WHERE id = #{id}
  80. </delete>
  81. </mapper>