QwCompanyMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.qw.mapper.QwCompanyMapper">
  6. <resultMap type="QwCompany" id="QwCompanyResult">
  7. <result property="id" column="id" />
  8. <result property="corpId" column="corp_id" />
  9. <result property="corpName" column="corp_name" />
  10. <result property="openSecret" column="open_secret" />
  11. <result property="openCorpId" column="open_corp_id" />
  12. <result property="serverAgentId" column="server_agent_id" />
  13. <result property="serverBookCorpId" column="server_book_corp_id" />
  14. <result property="serverBookSecret" column="server_book_secret" />
  15. <result property="token" column="token" />
  16. <result property="encodingAesKey" column="encoding_aes_key" />
  17. <result property="providerSecret" column="provider_secret" />
  18. <result property="realmNameUrl" column="realm_name_url" />
  19. <result property="notifyUrl" column="notify_url" />
  20. <result property="chatToolbar" column="chat_toolbar" />
  21. <result property="chatToolbarOauth" column="chat_toolbar_oauth" />
  22. <result property="companyIds" column="company_ids" />
  23. <result property="status" column="status" />
  24. <result property="createTime" column="create_time" />
  25. <result property="updateTime" column="update_time" />
  26. <result property="createBy" column="create_by" />
  27. <result property="isBuy" column="is_buy" />
  28. <result property="msgSecret" column="msg_secret" />
  29. <result property="msgPrivateKey" column="msg_private_key" />
  30. <result property="miniAppId" column="mini_app_id" />
  31. <result property="companyServerNum" column="company_server_num" />
  32. <result property="shareAppId" column="share_app_id" />
  33. <result property="shareAgentId" column="share_agent_id" />
  34. <result property="shareSchema" column="share_schema" />
  35. </resultMap>
  36. <sql id="selectQwCompanyVo">
  37. select id, corp_id, corp_name, open_secret, open_corp_id, server_agent_id, server_book_corp_id, server_book_secret, token, encoding_aes_key, provider_secret, realm_name_url, notify_url, chat_toolbar, chat_toolbar_oauth, company_ids, status, create_time, update_time, create_by,is_buy,mini_app_id,company_server_num,share_app_id,share_agent_id,share_schema from qw_company
  38. </sql>
  39. <select id="selectQwCompanyList" parameterType="QwCompany" resultMap="QwCompanyResult">
  40. <include refid="selectQwCompanyVo"/>
  41. <where>
  42. <if test="corpId != null and corpId != ''"> and corp_id = #{corpId}</if>
  43. <if test="corpName != null and corpName != ''"> and corp_name like concat('%', #{corpName}, '%')</if>
  44. <if test="openSecret != null and openSecret != ''"> and open_secret = #{openSecret}</if>
  45. <if test="openCorpId != null and openCorpId != ''"> and open_corp_id = #{openCorpId}</if>
  46. <if test="serverAgentId != null and serverAgentId != ''"> and server_agent_id = #{serverAgentId}</if>
  47. <if test="serverBookCorpId != null and serverBookCorpId != ''"> and server_book_corp_id = #{serverBookCorpId}</if>
  48. <if test="serverBookSecret != null and serverBookSecret != ''"> and server_book_secret = #{serverBookSecret}</if>
  49. <if test="token != null and token != ''"> and token = #{token}</if>
  50. <if test="encodingAesKey != null and encodingAesKey != ''"> and encoding_aes_key = #{encodingAesKey}</if>
  51. <if test="providerSecret != null and providerSecret != ''"> and provider_secret = #{providerSecret}</if>
  52. <if test="realmNameUrl != null and realmNameUrl != ''"> and realm_name_url = #{realmNameUrl}</if>
  53. <if test="notifyUrl != null and notifyUrl != ''"> and notify_url = #{notifyUrl}</if>
  54. <if test="chatToolbar != null and chatToolbar != ''"> and chat_toolbar = #{chatToolbar}</if>
  55. <if test="chatToolbarOauth != null and chatToolbarOauth != ''"> and chat_toolbar_oauth = #{chatToolbarOauth}</if>
  56. <if test="companyIds != null and companyIds != ''"> and FIND_IN_SET(#{companyIds}, company_ids) > 0</if>
  57. <if test="status != null "> and status = #{status}</if>
  58. <if test="isBuy != null "> and isBuy = #{isBuy}</if>
  59. <if test="createDeptId != null "> and create_dept_id = #{createDeptId}</if>
  60. <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
  61. <if test="shareAppId != null and shareAppId != ''"> and share_app_id = #{shareAppId}</if>
  62. <if test="shareAgentId != null and shareAgentId != ''"> and share_agent_id = #{shareAgentId}</if>
  63. <if test="shareSchema != null and shareSchema != ''"> and share_schema = #{shareSchema}</if>
  64. </where>
  65. </select>
  66. <select id="selectQwCompanyMiniProgramList" resultType="com.fs.qw.domain.QwCompany">
  67. SELECT
  68. qc.id,
  69. qc.corp_id,
  70. qc.corp_name,
  71. qc.open_secret,
  72. qc.open_corp_id,
  73. qc.server_agent_id,
  74. qc.server_book_corp_id,
  75. qc.server_book_secret,
  76. qc.token,
  77. qc.encoding_aes_key,
  78. qc.provider_secret,
  79. qc.realm_name_url,
  80. qc.notify_url,
  81. qc.chat_toolbar,
  82. qc.chat_toolbar_oauth,
  83. qc.company_ids,
  84. qc.STATUS,
  85. qc.create_time,
  86. qc.update_time,
  87. qc.create_by,
  88. qc.is_buy,
  89. qc.mini_app_id,
  90. qc.company_server_num,
  91. qc.share_app_id,
  92. qc.share_agent_id,
  93. qc.share_schema,
  94. sc.`name` AS mini_name
  95. FROM
  96. qw_company qc
  97. LEFT JOIN
  98. fs_course_play_source_config sc ON qc.mini_app_id = sc.appid
  99. <where>
  100. <if test="corpId != null and corpId != ''"> and qc.corp_id = #{corpId}</if>
  101. <if test="corpName != null and corpName != ''"> and qc.corp_name like concat('%', #{corpName}, '%')</if>
  102. <if test="openSecret != null and openSecret != ''"> and qc.open_secret = #{openSecret}</if>
  103. <if test="openCorpId != null and openCorpId != ''"> and qc.open_corp_id = #{openCorpId}</if>
  104. <if test="serverAgentId != null and serverAgentId != ''"> and qc.server_agent_id = #{serverAgentId}</if>
  105. <if test="serverBookCorpId != null and serverBookCorpId != ''"> and qc.server_book_corp_id = #{serverBookCorpId}</if>
  106. <if test="serverBookSecret != null and serverBookSecret != ''"> and qc.server_book_secret = #{serverBookSecret}</if>
  107. <if test="token != null and token != ''"> and qc.token = #{token}</if>
  108. <if test="encodingAesKey != null and encodingAesKey != ''"> and qc.encoding_aes_key = #{encodingAesKey}</if>
  109. <if test="providerSecret != null and providerSecret != ''"> and qc.provider_secret = #{providerSecret}</if>
  110. <if test="realmNameUrl != null and realmNameUrl != ''"> and qc.realm_name_url = #{realmNameUrl}</if>
  111. <if test="notifyUrl != null and notifyUrl != ''"> and qc.notify_url = #{notifyUrl}</if>
  112. <if test="chatToolbar != null and chatToolbar != ''"> and qc.chat_toolbar = #{chatToolbar}</if>
  113. <if test="chatToolbarOauth != null and chatToolbarOauth != ''"> and qc.chat_toolbar_oauth = #{chatToolbarOauth}</if>
  114. <if test="companyIds != null and companyIds != ''"> and FIND_IN_SET(#{companyIds}, qc.company_ids) > 0</if>
  115. <if test="status != null "> and qc.status = #{status}</if>
  116. <if test="isBuy != null "> and qc.isBuy = #{isBuy}</if>
  117. <if test="createDeptId != null "> and qc.create_dept_id = #{createDeptId}</if>
  118. <if test="createUserId != null "> and qc.create_user_id = #{createUserId}</if>
  119. <if test="shareAppId != null and shareAppId != ''"> and qc.share_app_id = #{shareAppId}</if>
  120. <if test="shareAgentId != null and shareAgentId != ''"> and qc.share_agent_id = #{shareAgentId}</if>
  121. <if test="shareSchema != null and shareSchema != ''"> and qc.share_schema = #{shareSchema}</if>
  122. <if test="miniName != null and miniName != ''">and sc.`name` like concat('%', #{miniName}, '%') </if>
  123. </where>
  124. </select>
  125. <select id="selectQwCompanyById" parameterType="Long" resultMap="QwCompanyResult">
  126. <include refid="selectQwCompanyVo"/>
  127. where id = #{id}
  128. </select>
  129. <select id="selectQwCompanyByCropID" parameterType="String" resultMap="QwCompanyResult">
  130. <include refid="selectQwCompanyVo"/>
  131. where corp_id = #{corpId}
  132. </select>
  133. <insert id="insertQwCompany" parameterType="QwCompany" useGeneratedKeys="true" keyProperty="id">
  134. insert into qw_company
  135. <trim prefix="(" suffix=")" suffixOverrides=",">
  136. <if test="corpId != null">corp_id,</if>
  137. <if test="corpName != null">corp_name,</if>
  138. <if test="openSecret != null">open_secret,</if>
  139. <if test="openCorpId != null">open_corp_id,</if>
  140. <if test="serverAgentId != null">server_agent_id,</if>
  141. <if test="serverBookCorpId != null">server_book_corp_id,</if>
  142. <if test="serverBookSecret != null">server_book_secret,</if>
  143. <if test="token != null">token,</if>
  144. <if test="encodingAesKey != null">encoding_aes_key,</if>
  145. <if test="providerSecret != null">provider_secret,</if>
  146. <if test="realmNameUrl != null">realm_name_url,</if>
  147. <if test="notifyUrl != null">notify_url,</if>
  148. <if test="chatToolbar != null">chat_toolbar,</if>
  149. <if test="chatToolbarOauth != null">chat_toolbar_oauth,</if>
  150. <if test="companyIds != null">company_ids,</if>
  151. <if test="status != null">status,</if>
  152. <if test="createTime != null">create_time,</if>
  153. <if test="updateTime != null">update_time,</if>
  154. <if test="createBy != null">create_by,</if>
  155. <if test="isBuy != null">is_buy,</if>
  156. <if test="miniAppId != null">mini_app_id,</if>
  157. <if test="companyServerNum != null">company_server_num,</if>
  158. <if test="createUserId != null != null">create_user_id,</if>
  159. <if test="createDeptId != null">create_dept_id,</if>
  160. <if test="shareAppId != null">share_app_id,</if>
  161. <if test="shareAgentId != null">share_agent_id,</if>
  162. <if test="shareSchema != null">share_schema,</if>
  163. </trim>
  164. <trim prefix="values (" suffix=")" suffixOverrides=",">
  165. <if test="corpId != null">#{corpId},</if>
  166. <if test="corpName != null">#{corpName},</if>
  167. <if test="openSecret != null">#{openSecret},</if>
  168. <if test="openCorpId != null">#{openCorpId},</if>
  169. <if test="serverAgentId != null">#{serverAgentId},</if>
  170. <if test="serverBookCorpId != null">#{serverBookCorpId},</if>
  171. <if test="serverBookSecret != null">#{serverBookSecret},</if>
  172. <if test="token != null">#{token},</if>
  173. <if test="encodingAesKey != null">#{encodingAesKey},</if>
  174. <if test="providerSecret != null">#{providerSecret},</if>
  175. <if test="realmNameUrl != null">#{realmNameUrl},</if>
  176. <if test="notifyUrl != null">#{notifyUrl},</if>
  177. <if test="chatToolbar != null">#{chatToolbar},</if>
  178. <if test="chatToolbarOauth != null">#{chatToolbarOauth},</if>
  179. <if test="companyIds != null">#{companyIds},</if>
  180. <if test="status != null">#{status},</if>
  181. <if test="createTime != null">#{createTime},</if>
  182. <if test="updateTime != null">#{updateTime},</if>
  183. <if test="createBy != null">#{createBy},</if>
  184. <if test="isBuy != null">#{isBuy},</if>
  185. <if test="miniAppId != null">#{miniAppId},</if>
  186. <if test="companyServerNum != null">#{companyServerNum},</if>
  187. <if test="createUserId != null">#{createUserId},</if>
  188. <if test="createDeptId != null">#{createDeptId},</if>
  189. <if test="shareAppId != null">#{shareAppId},</if>
  190. <if test="shareAgentId != null">#{shareAgentId},</if>
  191. <if test="shareSchema != null">#{shareSchema},</if>
  192. </trim>
  193. </insert>
  194. <update id="updateQwCompany" parameterType="QwCompany">
  195. update qw_company
  196. <trim prefix="SET" suffixOverrides=",">
  197. <if test="corpId != null">corp_id = #{corpId},</if>
  198. <if test="corpName != null">corp_name = #{corpName},</if>
  199. <if test="openSecret != null">open_secret = #{openSecret},</if>
  200. <if test="openCorpId != null">open_corp_id = #{openCorpId},</if>
  201. <if test="serverAgentId != null">server_agent_id = #{serverAgentId},</if>
  202. <if test="serverBookCorpId != null">server_book_corp_id = #{serverBookCorpId},</if>
  203. <if test="serverBookSecret != null">server_book_secret = #{serverBookSecret},</if>
  204. <if test="token != null">token = #{token},</if>
  205. <if test="encodingAesKey != null">encoding_aes_key = #{encodingAesKey},</if>
  206. <if test="providerSecret != null">provider_secret = #{providerSecret},</if>
  207. <if test="realmNameUrl != null">realm_name_url = #{realmNameUrl},</if>
  208. <if test="notifyUrl != null">notify_url = #{notifyUrl},</if>
  209. <if test="chatToolbar != null">chat_toolbar = #{chatToolbar},</if>
  210. <if test="chatToolbarOauth != null">chat_toolbar_oauth = #{chatToolbarOauth},</if>
  211. <if test="companyIds != null">company_ids = #{companyIds},</if>
  212. <if test="status != null">status = #{status},</if>
  213. <if test="createTime != null">create_time = #{createTime},</if>
  214. <if test="updateTime != null">update_time = #{updateTime},</if>
  215. <if test="createBy != null">create_by = #{createBy},</if>
  216. <if test="isBuy != null">is_buy = #{isBuy},</if>
  217. <if test="miniAppId != null">mini_app_id = #{miniAppId},</if>
  218. <if test="companyServerNum != null">company_server_num = #{companyServerNum},</if>
  219. <if test="shareAppId != null">share_app_id = #{shareAppId},</if>
  220. <if test="shareAgentId != null">share_agent_id = #{shareAgentId},</if>
  221. <if test="shareSchema != null">share_schema = #{shareSchema},</if>
  222. </trim>
  223. where id = #{id}
  224. </update>
  225. <delete id="deleteQwCompanyById" parameterType="Long">
  226. delete from qw_company where id = #{id}
  227. </delete>
  228. <delete id="deleteQwCompanyByIds" parameterType="String">
  229. delete from qw_company where id in
  230. <foreach item="id" collection="array" open="(" separator="," close=")">
  231. #{id}
  232. </foreach>
  233. </delete>
  234. <select id="selectQwCompanyListOptionsVO" resultType="com.fs.qw.vo.QwOptionsVO">
  235. SELECT * from qw_company
  236. <where>
  237. <if test="userId != null">
  238. and create_user_id = #{userId}
  239. </if>
  240. <if test="deptId != null">
  241. and create_dept_id = #{deptId}
  242. </if>
  243. </where>
  244. </select>
  245. <select id="selectByCorpIds" resultType="com.fs.qw.domain.QwCompany">
  246. select * from qw_company where corp_id in <foreach collection="corpIds" item="item" open="(" close=")" separator=",">#{item}</foreach>
  247. </select>
  248. </mapper>