v1.0.5
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
ALTER TABLE `gao_customer`
|
||||
ADD COLUMN `invited_count` BIGINT NOT NULL DEFAULT 0 COMMENT '邀请客户数' AFTER `introducer_customer_id`;
|
||||
|
||||
UPDATE `gao_customer` AS `customer`
|
||||
SET `invited_count` = (
|
||||
SELECT COUNT(1)
|
||||
FROM `gao_customer` AS `invitee`
|
||||
WHERE
|
||||
`invitee`.`introducer_customer_id` = `customer`.`id`
|
||||
AND `invitee`.`deleted_at` IS NULL
|
||||
)
|
||||
WHERE `customer`.`deleted_at` IS NULL;
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.imyeyu.api.modules.common.mapper.AttachmentMapper">
|
||||
<select id="selectByBizIdList" resultType="com.imyeyu.api.modules.common.entity.Attachment">
|
||||
SELECT
|
||||
*
|
||||
FROM `attachment`
|
||||
WHERE
|
||||
`biz_type` = #{bizType}
|
||||
<if test="bizIdList != null and !bizIdList.isEmpty()">
|
||||
AND `biz_id` IN
|
||||
<foreach collection="bizIdList" item="bizId" separator="," open="(" close=")">
|
||||
#{bizId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="bizIdList == null or bizIdList.isEmpty()">
|
||||
AND 1 = 0
|
||||
</if>
|
||||
AND `deleted_at` IS NULL
|
||||
AND (`destroy_at` IS NULL OR UNIX_TIMESTAMP() < `destroy_at`)
|
||||
<if test="attachTypes != null and !attachTypes.isEmpty()">
|
||||
AND `attach_type` IN
|
||||
<foreach collection="attachTypes" item="attachType" separator="," open="(" close=")">
|
||||
#{attachType}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY `created_at` ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -28,6 +28,18 @@
|
||||
ORDER BY `created_at` DESC
|
||||
</select>
|
||||
|
||||
<select id="selectByIdList" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomer">
|
||||
SELECT
|
||||
*
|
||||
FROM `gao_customer`
|
||||
WHERE
|
||||
`id` IN
|
||||
<foreach collection="idList" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND `deleted_at` IS NULL
|
||||
</select>
|
||||
|
||||
<select id="countSearch" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
@@ -65,6 +77,16 @@
|
||||
AND `deleted_at` IS NULL
|
||||
</select>
|
||||
|
||||
<update id="updateInvitedCountDelta">
|
||||
UPDATE `gao_customer`
|
||||
SET
|
||||
`invited_count` = GREATEST(IFNULL(`invited_count`, 0) + #{delta}, 0),
|
||||
`updated_at` = UNIX_TIMESTAMP() * 1000
|
||||
WHERE
|
||||
`id` = #{customerId}
|
||||
AND `deleted_at` IS NULL
|
||||
</update>
|
||||
|
||||
<select id="statDailyNewCustomer" resultType="com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStatView">
|
||||
SELECT
|
||||
CAST(DATE_FORMAT(FROM_UNIXTIME(`created_at` / 1000), '%Y%m%d') AS UNSIGNED) AS `dateValue`,
|
||||
@@ -86,4 +108,14 @@
|
||||
`created_at` < #{beginCreatedAt}
|
||||
AND `deleted_at` IS NULL
|
||||
</select>
|
||||
|
||||
<select id="statGender" resultType="com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView">
|
||||
SELECT
|
||||
IFNULL(CAST(`gender` AS CHAR), 'UNKNOWN') AS `genderCode`,
|
||||
COUNT(1) AS `count`
|
||||
FROM `gao_customer`
|
||||
WHERE
|
||||
`deleted_at` IS NULL
|
||||
GROUP BY IFNULL(CAST(`gender` AS CHAR), 'UNKNOWN')
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.imyeyu.api.modules.gao.mapper.GaoRegistrationEventMapper">
|
||||
<select id="selectByIdList" resultType="com.imyeyu.api.modules.gao.entity.GaoRegistrationEvent">
|
||||
SELECT
|
||||
*
|
||||
FROM `gao_registration_event`
|
||||
WHERE
|
||||
1 = 1
|
||||
<if test="idList != null and !idList.isEmpty()">
|
||||
AND `id` IN
|
||||
<foreach collection="idList" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="idList == null or idList.isEmpty()">
|
||||
AND 1 = 0
|
||||
</if>
|
||||
AND `deleted_at` IS NULL
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -259,6 +259,20 @@
|
||||
ORDER BY r.`registered_at` DESC, r.`created_at` DESC
|
||||
</select>
|
||||
|
||||
<select id="selectCalendarByRange" resultType="com.imyeyu.api.modules.gao.vo.GaoRegistrationEventRecordCalendarView">
|
||||
SELECT
|
||||
r.`id` AS `id`,
|
||||
r.`customer_id` AS `customerId`,
|
||||
c.`code` AS `customerCode`,
|
||||
c.`name` AS `customerName`,
|
||||
r.`registration_event_id` AS `registrationEventId`,
|
||||
r.`registered_at` AS `registeredAt`
|
||||
<include refid="rangeFrom"/>
|
||||
WHERE
|
||||
<include refid="rangeWhere"/>
|
||||
ORDER BY r.`registered_at` DESC, r.`created_at` DESC
|
||||
</select>
|
||||
|
||||
<select id="countByRange" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
@@ -267,9 +281,26 @@
|
||||
<include refid="rangeWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="selectPageByRange" resultType="com.imyeyu.api.modules.gao.entity.GaoRegistrationEventRecord">
|
||||
<select id="selectPageByRange" resultType="com.imyeyu.api.modules.gao.vo.GaoRegistrationEventRecordListItemView">
|
||||
SELECT
|
||||
r.*
|
||||
r.`id` AS `id`,
|
||||
r.`customer_id` AS `customerId`,
|
||||
c.`name` AS `customerName`,
|
||||
(
|
||||
SELECT a.`id`
|
||||
FROM `attachment` a
|
||||
WHERE
|
||||
a.`biz_type` = 'GAO_CUSTOMER'
|
||||
AND a.`biz_id` = c.`id`
|
||||
AND a.`attach_type` = 'PHOTO'
|
||||
AND a.`deleted_at` IS NULL
|
||||
AND (a.`destroy_at` IS NULL OR UNIX_TIMESTAMP() < a.`destroy_at`)
|
||||
ORDER BY a.`created_at` ASC
|
||||
LIMIT 1
|
||||
) AS `customerPhotoAttachmentId`,
|
||||
r.`registration_event_id` AS `registrationEventId`,
|
||||
e.`name` AS `registrationEventName`,
|
||||
r.`registered_at` AS `registeredAt`
|
||||
<include refid="rangeFrom"/>
|
||||
WHERE
|
||||
<include refid="rangeWhere"/>
|
||||
|
||||
Reference in New Issue
Block a user