CmPageBigTopicMapper.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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.cmpage.dao.CmPageBigTopicDao">
  4. <sql id="cmPageBigTopicColumns">
  5. a.id AS "id",
  6. a.title AS "title",
  7. a.description AS "description",
  8. a.suspensionName AS "suspensionName",
  9. a.sort AS "sort",
  10. a.enabledStatus AS "enabledStatus",
  11. a.crmEnabledStatus AS "crmEnabledStatus",
  12. a.createBy AS "createBy.id",
  13. a.createDate AS "createDate",
  14. a.updateBy AS "updateBy.id",
  15. a.updateDate AS "updateDate",
  16. a.delFlag AS "delFlag"
  17. </sql>
  18. <sql id="cmPageBigTopicJoins">
  19. </sql>
  20. <select id="get" resultType="CmPageBigTopic">
  21. SELECT
  22. <include refid="cmPageBigTopicColumns"/>
  23. FROM cm_page_big_topic a
  24. <include refid="cmPageBigTopicJoins"/>
  25. WHERE a.id = #{id}
  26. </select>
  27. <select id="findList" resultType="CmPageBigTopic">
  28. SELECT
  29. <include refid="cmPageBigTopicColumns"/>
  30. FROM cm_page_big_topic a
  31. <include refid="cmPageBigTopicJoins"/>
  32. <where>
  33. a.delFlag = 0
  34. </where>
  35. <choose>
  36. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  37. ORDER BY ${page.orderBy}
  38. </when>
  39. <otherwise>
  40. ORDER BY a.sort DESC,a.enabledStatus DESC,a.createDate DESC,crmEnabledStatus DESC
  41. </otherwise>
  42. </choose>
  43. </select>
  44. <select id="findAllList" resultType="CmPageBigTopic">
  45. SELECT
  46. <include refid="cmPageBigTopicColumns"/>
  47. FROM cm_page_big_topic a
  48. <include refid="cmPageBigTopicJoins"/>
  49. <where>
  50. a.delFlag = 0
  51. </where>
  52. <choose>
  53. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  54. ORDER BY ${page.orderBy}
  55. </when>
  56. <otherwise>
  57. </otherwise>
  58. </choose>
  59. </select>
  60. <insert id="insert" parameterType="CmPageBigTopic" keyProperty="id" useGeneratedKeys="true">
  61. INSERT INTO cm_page_big_topic(
  62. title,
  63. description,
  64. suspensionName,
  65. sort,
  66. enabledStatus,
  67. crmEnabledStatus,
  68. createBy,
  69. createDate,
  70. updateBy,
  71. updateDate,
  72. delFlag
  73. ) VALUES (
  74. #{title},
  75. #{description},
  76. #{suspensionName},
  77. #{sort},
  78. #{enabledStatus},
  79. #{crmEnabledStatus},
  80. #{createBy.id},
  81. #{createDate},
  82. #{updateBy.id},
  83. #{updateDate},
  84. #{delFlag}
  85. )
  86. </insert>
  87. <update id="update">
  88. UPDATE cm_page_big_topic SET
  89. title = #{title},
  90. description = #{description},
  91. suspensionName = #{suspensionName},
  92. sort = #{sort},
  93. enabledStatus = #{enabledStatus},
  94. crmEnabledStatus = #{crmEnabledStatus},
  95. createBy = #{createBy.id},
  96. createDate = #{createDate},
  97. updateBy = #{updateBy.id},
  98. updateDate = #{updateDate},
  99. delFlag = #{delFlag}
  100. WHERE id = #{id}
  101. </update>
  102. <update id="delete">
  103. UPDATE cm_page_big_topic a SET a.delFlag = #{delFlag}
  104. WHERE id = #{id}
  105. </update>
  106. <update id="updateEnabledStatusByIds">
  107. UPDATE cm_page_big_topic a SET a.enabledStatus = #{param1}
  108. WHERE a.id IN
  109. <foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
  110. #{id}
  111. </foreach>
  112. </update>
  113. <update id="updateCrmEnabledStatusByIds">
  114. UPDATE cm_page_big_topic a SET a.crmEnabledStatus = #{param1}
  115. WHERE a.id IN
  116. <foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
  117. #{id}
  118. </foreach>
  119. </update>
  120. </mapper>