add customer age and disease chart
This commit is contained in:
@@ -112,4 +112,31 @@
|
||||
AND `deleted_at` IS NULL
|
||||
GROUP BY IFNULL(CAST(`gender` AS CHAR), 'UNKNOWN')
|
||||
</select>
|
||||
|
||||
<select id="stateAge" resultType="com.imyeyu.api.modules.gao.vo.GaoCustomerAgeStatView">
|
||||
SELECT
|
||||
COALESCE(`age`, TIMESTAMPDIFF(YEAR, `birthdate`, CURDATE())) AS `age`,
|
||||
COUNT(1) AS `count`
|
||||
FROM `gao_customer`
|
||||
WHERE
|
||||
`store_id` = #{storeId}
|
||||
AND `deleted_at` IS NULL
|
||||
AND (`age` IS NOT NULL OR `birthdate` IS NOT NULL)
|
||||
GROUP BY COALESCE(`age`, TIMESTAMPDIFF(YEAR, `birthdate`, CURDATE()))
|
||||
ORDER BY COALESCE(`age`, TIMESTAMPDIFF(YEAR, `birthdate`, CURDATE())) ASC
|
||||
</select>
|
||||
|
||||
<select id="selectDiseaseTextByStoreId" resultType="com.imyeyu.api.modules.gao.vo.GaoCustomerDiseaseTextView">
|
||||
SELECT
|
||||
`remark`,
|
||||
`disease`
|
||||
FROM `gao_customer`
|
||||
WHERE
|
||||
`store_id` = #{storeId}
|
||||
AND `deleted_at` IS NULL
|
||||
AND (
|
||||
(`remark` IS NOT NULL AND `remark` != '')
|
||||
OR (`disease` IS NOT NULL AND `disease` != '')
|
||||
)
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user