No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 

597 líneas
23 KiB

  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.iformall.mapper.WxCUserBasicInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCUserBasicInfo">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="phone" jdbcType="VARCHAR" property="phone"/>
  7. <result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/>
  8. <result column="education" jdbcType="VARCHAR" property="education"/>
  9. <result column="sex" jdbcType="INTEGER" property="sex"/>
  10. <result column="height" jdbcType="VARCHAR" property="height"/>
  11. <result column="weight" jdbcType="VARCHAR" property="weight"/>
  12. <result column="id_card" jdbcType="VARCHAR" property="idCard"/>
  13. <result column="email" jdbcType="VARCHAR" property="email"/>
  14. <result column="address" jdbcType="VARCHAR" property="address"/>
  15. <result column="poins" jdbcType="INTEGER" property="poins"/>
  16. <result column="tag_id" jdbcType="BIGINT" property="tagId"/>
  17. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  18. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  19. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  20. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  21. <result column="final_tenant_id" jdbcType="VARCHAR" property="finalTenantId"/>
  22. <result column="name" jdbcType="VARCHAR" property="name"/>
  23. <result column="level" jdbcType="VARCHAR" property="level"/>
  24. <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
  25. <result column="avatar_url" jdbcType="VARCHAR" property="avatarUrl"/>
  26. <result column="credit" jdbcType="INTEGER" property="credit"/>
  27. <result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/>
  28. <result column="locate_city" jdbcType="VARCHAR" property="locateCity"/>
  29. <result column="login_count" jdbcType="INTEGER" property="loginCount"/>
  30. <result column="act_record" jdbcType="INTEGER" property="actRecord"/>
  31. <result column="score_date" jdbcType="TIMESTAMP" property="scoreDate"/>
  32. <result column="status" jdbcType="INTEGER" property="status"/>
  33. </resultMap>
  34. <sql id="allColumns">
  35. wcubi.`id`,wcubi.`phone`,wcubi.`birthdate`,wcubi.`education`,wcubi.`sex`,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.`email`,
  36. wcubi.`address`,wcubi.`poins`,wcubi.`tag_id`,wcubi.`create_date`,wcubi.`update_date`,
  37. wcubi.`final_tenant_id`,wcubi.`tenant_id`,wcubi.`parent_tenant_id`,wcubi.`name`,wcubi.`nick_name`,
  38. wcubi.`avatar_url`,wcubi.`credit`,wcubi.`active_time`,wcubi.`locate_city`,wcubi.`login_count`,wcubi.`act_record`,
  39. wcubi.score_date,wcubi.status
  40. </sql>
  41. <sql id="dynamicWhereConditions">
  42. where wcubi.`final_tenant_id` = #{finalTenantId}
  43. <if test=" null != tenantId and '' != tenantId">
  44. and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
  45. </if>
  46. <if test=" null != id ">
  47. and wcubi.`id` = #{id}
  48. </if>
  49. <if test=" null != phone ">
  50. and wcubi.`phone` like concat('%', #{phone},'%')
  51. </if>
  52. <if test=" null != birthdate ">
  53. and wcubi.`birthdate` = #{birthdate}
  54. </if>
  55. <if test=" null != education ">
  56. and wcubi.`education` like concat('%', #{education},'%')
  57. </if>
  58. <if test=" null != sex ">
  59. and wcubi.`sex` = #{sex}
  60. </if>
  61. <if test=" null != email ">
  62. and wcubi.`email` like concat('%', #{email},'%')
  63. </if>
  64. <if test=" null != address ">
  65. and wcubi.`address` like concat('%', #{address},'%')
  66. </if>
  67. <if test=" null != levelStartScore ">
  68. and wcubi.poins &gt;= #{levelStartScore}
  69. </if>
  70. <if test=" null != levelEndScore">
  71. and wcubi.poins &lt; #{levelEndScore}
  72. </if>
  73. <if test=" null != tagId ">
  74. and wcubi.`tag_id` = #{tagId}
  75. </if>
  76. <if test=" null != createDate ">
  77. and wcubi.`create_date` = #{createDate}
  78. </if>
  79. <if test=" null != updateDate ">
  80. and wcubi.`update_date` = #{updateDate}
  81. </if>
  82. <if test=" null != actRecord ">
  83. and wcubi.`act_record` = #{actRecord}
  84. </if>
  85. <if test=" null != name ">
  86. and wcubi.`name` like concat('%', #{name},'%')
  87. </if>
  88. <if test=" null != nickName ">
  89. and wcubi.`nick_name` like concat('%', #{nickName},'%')
  90. </if>
  91. <if test=" null != startTime and null != endTime">
  92. and wcubi.`create_date` between #{startTime} and #{endTime}
  93. </if>
  94. <if test=" null != activeStartTime and null != activeEndTime">
  95. and wcubi.`active_time` between #{activeStartTime} and #{activeEndTime}
  96. </if>
  97. <if test=" null != status ">
  98. and wcubi.`status` = #{status}
  99. </if>
  100. <if test=" null != ids ">
  101. and wcubi.id in
  102. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  103. #{idItem}
  104. </foreach>
  105. </if>
  106. <if test=" null != sortColumns">order by ${sortColumns}</if>
  107. </sql>
  108. <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  109. select <include refid="allColumns"/>
  110. from wx_c_user_basic_info wcubi
  111. where wcubi.id =#{id}
  112. and wcubi.final_tenant_id = #{finalTenantId}
  113. </select>
  114. <select id="findList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap">
  115. select
  116. <include refid="allColumns"/>
  117. from wx_c_user_basic_info wcubi
  118. <include refid="dynamicWhereConditions"/>
  119. </select>
  120. <select id="findListPhoneAndNameByIds" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap">
  121. select id, phone, nick_name, name, sex
  122. from wx_c_user_basic_info wcubi
  123. where wcubi.`final_tenant_id` = #{finalTenantId}
  124. <if test=" null != ids ">
  125. and wcubi.id in
  126. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  127. #{idItem}
  128. </foreach>
  129. </if>
  130. </select>
  131. <select id="findIdList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultType="Long">
  132. select id
  133. from wx_c_user_basic_info wcubi
  134. <include refid="dynamicWhereConditions"/>
  135. </select>
  136. <update id="updateScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo">
  137. update wx_c_user_basic_info
  138. set poins = #{poins}
  139. where id = #{id}
  140. </update>
  141. <update id="updateUpScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo">
  142. update wx_c_user_basic_info
  143. set poins = poins+#{poins}
  144. where id = #{id}
  145. </update>
  146. <update id="updateDownScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo">
  147. update wx_c_user_basic_info
  148. set poins = poins-#{poins}
  149. where id = #{id}
  150. </update>
  151. <update id="updateNewId" parameterType="com.iformall.domain.vo.CUserBaseVo">
  152. update wx_c_user_basic_info
  153. set id = #{newId} , credit = #{credit} , poins = #{poins}
  154. where id = #{id}
  155. </update>
  156. <select id="findCountBySex" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  157. select count(wcubi.id)
  158. from wx_c_user_basic_info wcubi
  159. where wcubi.sex =#{sex}
  160. and wcubi.`final_tenant_id` = #{finalTenantId}
  161. <if test=" null != tenantId and '' != tenantId">
  162. and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
  163. </if>
  164. <if test=" null != startTime ">
  165. and wcubi.create_date &gt;= #{startTime}
  166. </if>
  167. <if test=" null != endTime">
  168. and wcubi.create_date &lt;= #{endTime}
  169. </if>
  170. </select>
  171. <select id="findCountByAge" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  172. select count(wcubi.id) from wx_c_user_basic_info wcubi
  173. where wcubi.`final_tenant_id` = #{finalTenantId}
  174. <if test=" null != tenantId and '' != tenantId">
  175. and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
  176. </if>
  177. <if test=" null != startTime ">
  178. and wcubi.create_date &gt;= #{startTime}
  179. </if>
  180. <if test=" null != endTime">
  181. and wcubi.create_date &lt;= #{endTime}
  182. </if>
  183. <if test=" null != birthStartTime ">
  184. and wcubi.birthdate &gt;= #{birthStartTime}
  185. </if>
  186. <if test=" null != birthEndTime">
  187. and wcubi.birthdate &lt;= #{birthEndTime}
  188. </if>
  189. <if test=" null == birthStartTime and null == birthEndTime">
  190. and wcubi.birthdate is null
  191. </if>
  192. </select>
  193. <select id="findCountByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  194. select count(wcubi.id)
  195. from wx_c_user_basic_info wcubi
  196. where wcubi.`final_tenant_id` = #{finalTenantId}
  197. <if test=" null != tenantId and '' != tenantId">
  198. and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
  199. </if>
  200. <if test=" null != startTime ">
  201. and wcubi.create_date &gt;= #{startTime}
  202. </if>
  203. <if test=" null != endTime">
  204. and wcubi.create_date &lt;= #{endTime}
  205. </if>
  206. <if test=" null != levelStartScore ">
  207. and wcubi.poins &gt;= #{levelStartScore}
  208. </if>
  209. <if test=" null != levelEndScore">
  210. and wcubi.poins &lt; #{levelEndScore}
  211. </if>
  212. <if test=" null == levelStartScore and null == levelEndScore">
  213. and wcubi.poins is null
  214. </if>
  215. </select>
  216. <sql id="allColumnsOfScoreList">
  217. wcubi.id,wcubi.phone,wcubi.birthdate,wcubi.education,wcubi.sex,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.email,wcubi.address,wcubi.poins,wcubi.tag_id,
  218. wcubi.create_date,wcubi.update_date,wcubi.name,wcubi.level,wcubi.nick_name,wcubi.score_date,wcubi.final_tenant_id
  219. </sql>
  220. <select id="findListByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap">
  221. select <include refid="allColumnsOfScoreList"/>
  222. from wx_c_user_basic_info wcubi
  223. where wcubi.status=0
  224. and wcubi.`final_tenant_id` = #{finalTenantId}
  225. <if test=" null != tenantId and '' != tenantId">
  226. and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
  227. </if>
  228. <if test=" null != levelStartScore ">
  229. and wcubi.poins &gt;= #{levelStartScore}
  230. </if>
  231. <if test=" null != levelEndScore">
  232. and wcubi.poins &lt;= #{levelEndScore}
  233. </if>
  234. <if test=" null == levelStartScore and null == levelEndScore">
  235. and wcubi.poins is null
  236. </if>
  237. order by wcubi.`active_time` DESC
  238. </select>
  239. <select id="findBirthdayList" resultMap="BaseResultMap">
  240. select <include refid="allColumnsOfScoreList"/>
  241. from wx_c_user_basic_info wcubi
  242. where wcubi.status = 0
  243. and wcubi.`final_tenant_id` = #{finalTenantId}
  244. <if test=" null != tenantId and '' != tenantId">
  245. and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
  246. </if>
  247. AND DATE_FORMAT(wcubi.birthdate,'%m-%d') &gt;= #{begin}
  248. AND DATE_FORMAT(wcubi.birthdate,'%m-%d') &lt;= #{end}
  249. order by wcubi.`active_time` DESC
  250. </select>
  251. <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  252. select count(wcubi.id)
  253. from wx_c_user_basic_info wcubi
  254. where wcubi.`final_tenant_id` = #{finalTenantId}
  255. <if test=" null != tenantId and '' != tenantId">
  256. and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
  257. </if>
  258. <if test=" null != startTime ">
  259. and wcubi.create_date &gt;= #{startTime}
  260. </if>
  261. <if test=" null != endTime">
  262. and wcubi.create_date &lt; #{endTime}
  263. </if>
  264. <if test="1 == queryImport">
  265. and wcubi.create_date like '%00:00:00'
  266. </if>
  267. <if test=" null != ids ">
  268. and wcubi.id in
  269. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  270. #{idItem}
  271. </foreach>
  272. </if>
  273. </select>
  274. <select id="findCountHistory" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="com.iformall.domain.vo.UserCountVo">
  275. select count(wcubi.id) as incCount,
  276. <if test="1 == reportType ">
  277. date_format(wcubi.create_date, '%Y-%m-%d') as reportTime
  278. </if>
  279. <if test="2 == reportType ">
  280. date_format(wcubi.create_date, '%Y-%m') as reportTime
  281. </if>
  282. <if test="3 == reportType ">
  283. date_format(wcubi.create_date, '%Y') as reportTime
  284. </if>
  285. from wx_c_user_basic_info wcubi
  286. where wcubi.`final_tenant_id` = #{finalTenantId}
  287. <if test=" null != tenantId and '' != tenantId">
  288. and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
  289. </if>
  290. <if test=" null != startTime ">
  291. and wcubi.create_date &gt;= #{startTime}
  292. </if>
  293. <if test=" null != endTime">
  294. and wcubi.create_date &lt; #{endTime}
  295. </if>
  296. <if test="1 == reportType or 2 == reportType or 3 == reportType">
  297. group by reportTime
  298. </if>
  299. </select>
  300. <resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxCUserBasicInfoVo">
  301. <id column="id" jdbcType="BIGINT" property="id"/>
  302. <result column="phone" jdbcType="VARCHAR" property="phone"/>
  303. <result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/>
  304. <result column="education" jdbcType="VARCHAR" property="education"/>
  305. <result column="sex" jdbcType="INTEGER" property="sex"/>
  306. <result column="height" jdbcType="VARCHAR" property="height"/>
  307. <result column="weight" jdbcType="VARCHAR" property="weight"/>
  308. <result column="id_card" jdbcType="VARCHAR" property="idCard"/>
  309. <result column="email" jdbcType="VARCHAR" property="email"/>
  310. <result column="address" jdbcType="VARCHAR" property="address"/>
  311. <result column="poins" jdbcType="INTEGER" property="poins"/>
  312. <result column="tag_id" jdbcType="BIGINT" property="tagId"/>
  313. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  314. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  315. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  316. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  317. <result column="final_tenant_id" jdbcType="VARCHAR" property="finalTenantId"/>
  318. <result column="name" jdbcType="VARCHAR" property="name"/>
  319. <result column="level" jdbcType="VARCHAR" property="level"/>
  320. <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
  321. <result column="credit" jdbcType="INTEGER" property="credit"/>
  322. <result column="tags" jdbcType="VARCHAR" property="tags"/>
  323. <result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/>
  324. </resultMap>
  325. <sql id="dynamicVoWhereConditions">
  326. where wcubi.`final_tenant_id` = #{finalTenantId}
  327. <if test=" null != id ">
  328. and wcubi.`id` = #{id}
  329. </if>
  330. <if test=" null != tenantId and '' != tenantId">
  331. and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
  332. </if>
  333. <if test=" null != phone and '' != phone">
  334. and wcubi.`phone` like concat('%', #{phone},'%')
  335. </if>
  336. <if test=" null != birthdate ">
  337. and wcubi.`birthdate` = #{birthdate}
  338. </if>
  339. <if test=" null != education and '' != education">
  340. and wcubi.`education` like concat('%', #{education},'%')
  341. </if>
  342. <if test=" null != sex ">
  343. and wcubi.`sex` = #{sex}
  344. </if>
  345. <if test=" null != email and '' != email">
  346. and wcubi.`email` like concat('%', #{email},'%')
  347. </if>
  348. <if test=" null != address and '' != address">
  349. and wcubi.`address` like concat('%', #{address},'%')
  350. </if>
  351. <if test=" null != poins ">
  352. and wcubi.`poins` = #{poins}
  353. </if>
  354. <if test=" null != tagId ">
  355. and wcubi.`tag_id` = #{tagId}
  356. </if>
  357. <if test=" null != createDate ">
  358. and wcubi.`create_date` = #{createDate}
  359. </if>
  360. <if test=" null != updateDate ">
  361. and wcubi.`update_date` = #{updateDate}
  362. </if>
  363. <if test=" null != actRecord ">
  364. and wcubi.`act_record` = #{actRecord}
  365. </if>
  366. <if test=" null != name and '' != name">
  367. and wcubi.`name` like concat('%', #{name},'%')
  368. </if>
  369. <if test=" null != startTime and null!=endTime">
  370. and wcubi.`create_date` between #{startTime} and #{endTime}
  371. </if>
  372. <if test=" null != activeStartTime and null!=activeEndTime">
  373. and wcubi.`active_time` between #{activeStartTime} and #{activeEndTime}
  374. </if>
  375. <if test=" null != ids ">
  376. and wcubi.id in
  377. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  378. #{idItem}
  379. </foreach>
  380. </if>
  381. order by wcubi.`active_time` DESC
  382. <!--<if test=" null != sortColumns">order by ${sortColumns}</if>-->
  383. </sql>
  384. <select id="findVoList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="VoBaseResultMap">
  385. select
  386. wcubi.`id`,wcubi.`name`,wcubi.`sex`,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.`phone`,wcubi.`nick_name`,wcubi.`education`,wcubi.`birthdate`,wcubi.`address`,
  387. wcubi.`active_time`,wcubi.`create_date`,wcubi.`poins`,wcubi.`credit`,wcubi.`tag_id`
  388. from wx_c_user_basic_info wcubi
  389. <include refid="dynamicVoWhereConditions"/>
  390. <if test=" null != begin ">
  391. limit #{begin}, #{limit}
  392. </if>
  393. </select>
  394. <select id="countVoList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultType="java.lang.Integer">
  395. select
  396. count(wcubi.id)
  397. from wx_c_user_basic_info wcubi
  398. <include refid="dynamicVoWhereConditions"/>
  399. </select>
  400. <sql id="filterWhereConditions">
  401. where wcubi.`final_tenant_id` = #{finalTenantId}
  402. <if test=" null != tenantId and '' != tenantId">
  403. and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
  404. </if>
  405. <if test=" null != startTime ">
  406. and wcubi.create_date &gt;= #{startTime}
  407. </if>
  408. <if test=" null != endTime">
  409. and wcubi.create_date &lt;= #{endTime}
  410. </if>
  411. <if test=" null != birthStartTime ">
  412. and wcubi.birthdate &gt;= #{birthStartTime}
  413. </if>
  414. <if test=" null != birthEndTime">
  415. and wcubi.birthdate &lt; #{birthEndTime}
  416. </if>
  417. <if test=" null != loginStartTime ">
  418. and wcubi.active_time &gt;= #{loginStartTime}
  419. </if>
  420. <if test=" null != loginEndTime">
  421. and wcubi.active_time &lt;= #{loginEndTime}
  422. </if>
  423. <if test=" null != phones">
  424. and wcubi.phone in (${phones})
  425. </if>
  426. <if test=" null != levelStartScore and (0 != levelStartScore and '' != levelStartScore)">
  427. and wcubi.poins &gt;= #{levelStartScore}
  428. <if test=" null != levelEndScore">
  429. and wcubi.poins &lt; #{levelEndScore}
  430. </if>
  431. </if>
  432. <if test=" null != levelStartScore and (0 == levelStartScore or '' == levelStartScore)">
  433. and (wcubi.poins is null or
  434. (wcubi.poins &gt;= #{levelStartScore}
  435. <if test=" null != levelEndScore">
  436. and wcubi.poins &lt; #{levelEndScore}
  437. </if>
  438. ))
  439. </if>
  440. <if test=" null != ids ">
  441. and wcubi.id in
  442. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  443. #{idItem}
  444. </foreach>
  445. </if>
  446. <if test=" null != tagIds ">
  447. and wcubi.`tag_id` in
  448. <foreach collection="tagIds" index="index" item="tagIdItem" open="(" separator="," close=")">
  449. #{tagIdItem}
  450. </foreach>
  451. </if>
  452. <if test=" null != sortColumns">order by ${sortColumns}</if>
  453. </sql>
  454. <select id="findCountByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  455. select count(distinct wcubi.id)
  456. from wx_c_user_basic_info wcubi
  457. <include refid="filterWhereConditions"/>
  458. </select>
  459. <select id="findListByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap">
  460. select wcubi.`id`,wcubi.`phone`,wcubi.`email`
  461. from wx_c_user_basic_info wcubi
  462. <include refid="filterWhereConditions"/>
  463. </select>
  464. <select id="findIdByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  465. select id
  466. from wx_c_user_basic_info wcubi
  467. <include refid="filterWhereConditions"/>
  468. </select>
  469. <select id="findGrowUserCount" resultType="java.lang.Long">
  470. SELECT count(wcubi.id)
  471. FROM wx_c_user_basic_info wcubi
  472. where wcubi.`final_tenant_id` = #{finalTenantId}
  473. <if test=" null != tenantId and '' != tenantId">
  474. and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
  475. </if>
  476. </select>
  477. <select id="getTotalCreditAmount" resultType="java.lang.Long">
  478. SELECT IFNULL(SUM(wcubi.credit),0)
  479. FROM wx_c_user_basic_info wcubi
  480. where wcubi.`final_tenant_id` = #{finalTenantId}
  481. <if test=" null != tenantId and '' != tenantId">
  482. and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
  483. </if>
  484. </select>
  485. <select id="countUserByGender" resultType="com.iformall.domain.dto.cockpit.CountUserByGenderDTO">
  486. SELECT sex AS gender, COUNT(id) AS userCount
  487. FROM wx_c_user_basic_info
  488. WHERE final_tenant_id = #{finalTenantId}
  489. GROUP BY sex;
  490. </select>
  491. <select id="countUserByMonth" resultType="java.lang.Integer">
  492. SELECT COUNT(id) AS `count`
  493. FROM wx_c_user_basic_info
  494. WHERE final_tenant_id = #{finalTenantId} AND DATE_FORMAT(create_date, '%Y') = #{year} AND DATE_FORMAT(create_date, '%m') = #{month}
  495. </select>
  496. <update id="incActRecordById" parameterType="java.util.HashMap">
  497. UPDATE wx_c_user_basic_info set act_record = act_record +1 where id = #{id} and final_tenant_id = #{finalTenantId}
  498. </update>
  499. <!--<select id="selectNotCUserList" resultMap="BaseResultMap">
  500. select id,credit from wx_c_user_basic_info cub where not exists (select * from wx_c_user c where c.user_id=cub.id) and cub.credit is null
  501. </select>-->
  502. <update id="cuserOldToNew" statementType="CALLABLE" >
  503. {call cuser_old_to_new(#{oldCuserId},#{newCuserId},#{tableIndex},#{finalTableIndex})}
  504. </update>
  505. </mapper>