v1.0.13
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
-- 历史标签统一归入迁移时创建的默认门店。
|
||||
SET @gao_default_store_id = '00000000-0000-0000-0000-000000000001';
|
||||
|
||||
ALTER TABLE `tag`
|
||||
ADD COLUMN `owner_type` VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '归属类型' AFTER `id`,
|
||||
ADD COLUMN `owner_id` VARCHAR(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '归属门店 ID' AFTER `owner_type`;
|
||||
|
||||
UPDATE `tag`
|
||||
SET
|
||||
`owner_type` = 'GAO_STORE',
|
||||
`owner_id` = @gao_default_store_id
|
||||
WHERE `owner_type` IS NULL
|
||||
OR `owner_id` IS NULL;
|
||||
|
||||
ALTER TABLE `tag`
|
||||
MODIFY COLUMN `owner_type` VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '归属类型',
|
||||
MODIFY COLUMN `owner_id` VARCHAR(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '归属门店 ID',
|
||||
ADD KEY `idx_tag_owner` (`owner_type`, `owner_id`, `deleted_at`);
|
||||
@@ -18,4 +18,18 @@
|
||||
</if>
|
||||
AND `deleted_at` IS NULL
|
||||
</select>
|
||||
<select id="selectByOwnerAndZhCN" resultType="com.imyeyu.api.modules.common.entity.Tag">
|
||||
SELECT
|
||||
`t`.*
|
||||
FROM `tag` `t`
|
||||
INNER JOIN `multilingual` `m`
|
||||
ON `m`.`id` = `t`.`name_lang_id`
|
||||
AND `m`.`deleted_at` IS NULL
|
||||
WHERE
|
||||
`t`.`owner_type` = #{ownerType}
|
||||
AND `t`.`owner_id` = #{ownerId}
|
||||
AND `m`.`zh_cn` = #{zhCN}
|
||||
AND `t`.`deleted_at` IS NULL
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -19,6 +19,52 @@
|
||||
AND `deleted_at` IS NULL
|
||||
</select>
|
||||
|
||||
<sql id="queryWhere">
|
||||
`c`.`deleted_at` IS NULL
|
||||
<if test="storeId != null and storeId != ''">
|
||||
AND `c`.`store_id` = #{storeId}
|
||||
</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (
|
||||
`c`.`code` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR `c`.`name` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR `c`.`telephone` LIKE CONCAT('%', #{keyword}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="tagIdList != null and !tagIdList.isEmpty()">
|
||||
<bind name="tagCount" value="tagIdList.size()"/>
|
||||
AND `c`.`id` IN (
|
||||
SELECT `ta`.`biz_id`
|
||||
FROM `tag_apply` `ta`
|
||||
WHERE
|
||||
`ta`.`biz_type` = 'GAO_CUSTOMER'
|
||||
AND `ta`.`tag_id` IN
|
||||
<foreach collection="tagIdList" item="tagId" separator="," open="(" close=")">
|
||||
#{tagId}
|
||||
</foreach>
|
||||
AND `ta`.`deleted_at` IS NULL
|
||||
GROUP BY `ta`.`biz_id`
|
||||
HAVING COUNT(DISTINCT `ta`.`tag_id`) = #{tagCount}
|
||||
)
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="countByQuery" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM `gao_customer` `c`
|
||||
WHERE
|
||||
<include refid="queryWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="selectByQuery" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomer">
|
||||
SELECT `c`.*
|
||||
FROM `gao_customer` `c`
|
||||
WHERE
|
||||
<include refid="queryWhere"/>
|
||||
ORDER BY `c`.`created_at` DESC, `c`.`id` DESC
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
<select id="stateDailyNewCustomer" resultType="com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView">
|
||||
SELECT
|
||||
CAST(DATE_FORMAT(FROM_UNIXTIME(`created_at` / 1000), '%Y%m%d') AS UNSIGNED) AS `dateValue`,
|
||||
|
||||
Reference in New Issue
Block a user