WeChatDao.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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.caimei365.manager.dao.WeChatDao">
  4. <select id="getWechatMenuList" resultType="com.caimei365.manager.entity.wechat.WechatMenu">
  5. SELECT a.id, a.parentId, a.parentIds, a.`name`, a.sort, a.type, a.`key`,
  6. a.url, a.mediaId, a.appid, a.pagepath AS pagePath, a.wxType
  7. FROM wechat_menu a
  8. WHERE a.wxType = #{wxType} AND a.parentId = #{parentId}
  9. ORDER BY a.sort ASC
  10. </select>
  11. <select id="getWechatMenu" resultType="com.caimei365.manager.entity.wechat.WechatMenu">
  12. SELECT a.id, a.parentId, a.parentIds, a.`name`, a.sort, a.type, a.`key`,
  13. a.url, a.mediaId, a.appid, a.pagepath AS pagePath, a.wxType
  14. FROM wechat_menu a WHERE a.id = #{id}
  15. </select>
  16. <select id="countChildByParentId" resultType="java.lang.Integer">
  17. SELECT IFNULL(COUNT(*),0) FROM wechat_menu WHERE parentId = #{parentId}
  18. </select>
  19. <update id="updateWechatMenu">
  20. UPDATE wechat_menu SET parentId = #{parentId}, parentIds = #{parentIds}, name = #{name}, sort = #{sort},
  21. type = #{type}, `key` = #{key}, url = #{url}, mediaId = #{mediaId}, appid = #{appid},
  22. pagepath = #{pagePath}, updateBy = #{userId}, updateDate = NOW()
  23. WHERE id = #{id}
  24. </update>
  25. <insert id="insertWechatMenu" keyProperty="id" useGeneratedKeys="true">
  26. INSERT INTO wechat_menu(parentId, parentIds, `name`, sort, type, `key`, url, mediaId, appid, pagepath, wxType, createBy, createDate)
  27. VALUES (#{parentId}, #{parentIds}, #{name}, #{sort}, #{type}, #{key}, #{url}, #{mediaId}, #{appid}, #{pagePath}, #{wxType}, #{userId}, NOW())
  28. </insert>
  29. <delete id="deleteWechatMenu">
  30. DELETE FROM wechat_menu WHERE id = #{id}
  31. </delete>
  32. <select id="getReplyList" resultType="com.caimei365.manager.entity.wechat.WechatReply">
  33. SELECT a.cm_wxparamID AS id, a.keyword, a.title, a.responsetype AS responseType,
  34. a.msgtype AS msgType, a.relateID AS relateId, a.wx_type AS wxType, IFNULL(a.update_date,a.create_date) AS updateTime
  35. FROM wechat_reply a
  36. <where>
  37. <if test=" wxType != null and wxType != ''">
  38. AND a.wx_type =#{wxType}
  39. </if>
  40. <if test="responseType != null and responseType != ''">
  41. AND a.responsetype = #{responseType}
  42. </if>
  43. <if test="msgType != null and msgType != ''">
  44. AND a.msgtype = #{msgType}
  45. </if>
  46. <if test="title != null and title != ''">
  47. AND a.title LIKE concat('%',#{title},'%')
  48. </if>
  49. </where>
  50. ORDER BY updateTime DESC
  51. </select>
  52. <select id="getWechatReply" resultType="com.caimei365.manager.entity.wechat.WechatReply">
  53. SELECT a.cm_wxparamID AS id, a.keyword, a.title, a.responsetype AS responseType,
  54. a.msgtype AS msgType, a.relateID AS relateId, a.wx_type AS wxType, IFNULL(a.update_date,a.create_date) AS updateTime
  55. FROM wechat_reply a WHERE a.cm_wxparamID = #{id}
  56. </select>
  57. <update id="updateWechatReply">
  58. UPDATE wechat_reply SET keyword = #{keyword}, title = #{title}, responsetype = #{responseType},
  59. msgtype = #{msgType}, relateID = #{relateId}, update_by = #{userId}, update_date = NOW()
  60. WHERE cm_wxparamID = #{id}
  61. </update>
  62. <insert id="insertWechatReply" keyProperty="id" useGeneratedKeys="true">
  63. INSERT INTO wechat_reply(keyword, title, responsetype, msgtype, relateID, wx_type, create_by, create_date)
  64. VALUES (#{keyword}, #{title}, #{responseType}, #{msgType}, #{relateId}, #{wxType}, #{userId}, NOW())
  65. </insert>
  66. <delete id="deleteWechatReply">
  67. DELETE FROM wechat_reply WHERE cm_wxparamID = #{id}
  68. </delete>
  69. <select id="getTextList" resultType="com.caimei365.manager.entity.wechat.WechatText">
  70. SELECT a.cm_wxtextID AS id, a.title, a.content, a.wx_type AS wxType,
  71. IFNULL(a.update_date,a.create_date) AS updateTime
  72. FROM wechat_text a
  73. <where>
  74. <if test=" wxType != null and wxType != ''">
  75. AND a.wx_type =#{wxType}
  76. </if>
  77. <if test="title != null and title != ''">
  78. AND a.title LIKE concat('%',#{title},'%')
  79. </if>
  80. </where>
  81. ORDER BY updateTime DESC
  82. </select>
  83. <select id="getWechatText" resultType="com.caimei365.manager.entity.wechat.WechatText">
  84. SELECT a.cm_wxtextID AS id, a.title, a.content, a.wx_type AS wxType,
  85. IFNULL(a.update_date,a.create_date) AS updateTime
  86. FROM wechat_text a WHERE a.cm_wxtextID = #{id}
  87. </select>
  88. <update id="updateWechatText">
  89. UPDATE wechat_text SET title = #{title}, content = #{content}, wx_type = #{wxType}, update_by = #{userId}, update_date = NOW()
  90. WHERE cm_wxtextID = #{id}
  91. </update>
  92. <insert id="insertWechatText" keyProperty="id" useGeneratedKeys="true">
  93. INSERT INTO wechat_text(title, content, wx_type, create_by, create_date)
  94. VALUES (#{title}, #{content}, #{wxType}, #{userId}, NOW())
  95. </insert>
  96. <delete id="deleteWechatText">
  97. DELETE FROM wechat_text WHERE cm_wxtextID = #{id}
  98. </delete>
  99. <select id="getArticleList" resultType="com.caimei365.manager.entity.wechat.WechatArticle">
  100. SELECT a.cm_wxarticleID AS id, a.title, a.wx_type AS wxType,
  101. IFNULL(a.update_date,a.create_date) AS updateTime
  102. FROM wechat_article a
  103. <where>
  104. <if test=" wxType != null and wxType != ''">
  105. AND a.wx_type =#{wxType}
  106. </if>
  107. <if test="title != null and title != ''">
  108. AND a.title LIKE concat('%',#{title},'%')
  109. </if>
  110. </where>
  111. ORDER BY updateTime DESC
  112. </select>
  113. <select id="getWechatArticle" resultType="com.caimei365.manager.entity.wechat.WechatArticle">
  114. SELECT a.cm_wxarticleID AS id, a.title, a.wx_type AS wxType,
  115. IFNULL(a.update_date,a.create_date) AS updateTime
  116. FROM wechat_article a WHERE a.cm_wxarticleID = #{id}
  117. </select>
  118. <select id="getArticleDetailIds" resultType="java.lang.Integer">
  119. SELECT cm_wxarticledtlID FROM wechat_article_detail WHERE cm_wxarticleID = #{articleId}
  120. </select>
  121. <select id="getArticleDetailList" resultType="com.caimei365.manager.entity.wechat.WechatArticleDetail">
  122. SELECT a.cm_wxarticledtlID AS id,a.cm_wxarticleID AS articleId, a.title, a.linkurl AS linkUrl, a.picurl AS pictureUrl
  123. FROM wechat_article_detail a WHERE a.cm_wxarticleID = #{articleId}
  124. </select>
  125. <select id="getWechatArticleDetail" resultType="com.caimei365.manager.entity.wechat.WechatArticleDetail">
  126. SELECT a.cm_wxarticledtlID AS id,a.cm_wxarticleID AS articleId, a.title, a.linkurl AS linkUrl, a.picurl AS pictureUrl
  127. FROM wechat_article_detail a WHERE a.cm_wxarticledtlID = #{id}
  128. </select>
  129. <update id="updateWechatArticle">
  130. UPDATE wechat_article SET title = #{title}, wx_type = #{wxType}, update_by = #{userId}, update_date = NOW()
  131. WHERE cm_wxarticleID = #{id}
  132. </update>
  133. <update id="updateWechatArticleDetail">
  134. UPDATE wechat_article_detail SET title = #{title}, linkurl = #{linkUrl}, picurl = #{pictureUrl}, update_by = #{userId}, update_date = NOW()
  135. WHERE cm_wxarticledtlID = #{id}
  136. </update>
  137. <insert id="insertWechatArticle" keyProperty="id" useGeneratedKeys="true">
  138. INSERT INTO wechat_article(title, wx_type, create_by, create_date)
  139. VALUES (#{title}, #{wxType}, #{userId}, NOW())
  140. </insert>
  141. <insert id="insertWechatArticleDetail" keyProperty="id" useGeneratedKeys="true">
  142. INSERT INTO wechat_article_detail(cm_wxarticleID, title, linkurl, picurl, create_by, create_date)
  143. VALUES (#{articleId}, #{title}, #{linkUrl},#{pictureUrl}, #{userId}, NOW())
  144. </insert>
  145. <delete id="deleteWechatArticle">
  146. DELETE FROM wechat_article WHERE cm_wxarticleID = #{id}
  147. </delete>
  148. <delete id="deleteDetailByArticleId">
  149. DELETE FROM wechat_article_detail WHERE cm_wxarticleID = #{articleId}
  150. </delete>
  151. <delete id="deleteWechatArticleDetail">
  152. DELETE FROM wechat_article_detail WHERE cm_wxarticledtlID = #{id}
  153. </delete>
  154. </mapper>