feat:增加月经日期统计

This commit is contained in:
2025-10-30 15:00:00 +08:00
parent 67c72779ad
commit c8d2bd1df0
20 changed files with 213 additions and 104 deletions

View File

@@ -1,15 +0,0 @@
<?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.cxx.home.dao.KpiDao">
<select id="queryKpi" resultType="com.cxx.home.dto.kpi.KpiDto">
SELECT id AS id,
date AS date,
patient_name AS patientName,
project AS project,
price AS price
FROM kpi AS a
WHERE a.date <![CDATA[ >=]]> STR_TO_DATE(#{query.startDate}, '%Y-%m-%d')
AND a.date <![CDATA[ <=]]> STR_TO_DATE(#{query.endDate}, '%Y-%m-%d')
ORDER BY a.date DESC
</select>
</mapper>

View File

@@ -3,16 +3,16 @@
<mapper namespace="com.cxx.home.dao.PasswordDao">
<select id="query" resultType="com.cxx.home.dto.password.PasswordDto">
SELECT
id AS id,
title AS title,
website AS website,
username AS username,
password AS password,
category AS category,
owner AS owner,
remark AS remark
id AS id,
title AS title,
website AS website,
username AS username,
password AS password,
category AS category,
owner AS owner,
remark AS remark
FROM
password
password
<where>
<if test="query.category != null and query.category != ''">
category = #{query.category}

View File

@@ -1,36 +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.cxx.home.dao.ProductDao">
<select id="queryProduct" resultType="com.cxx.home.dto.product.ProductDto">
SELECT id AS id,
name AS name,
purchase_date AS purchaseDate,
expiry_date AS expiryDate,
price AS price,
category AS category,
purchaser AS purchaser,
channel AS channel,
image_url As imageUrl
FROM product
WHERE id = #{id}
ORDER BY purchase_date DESC
</select>
<select id="queryProductList" resultType="com.cxx.home.dto.product.ProductDto">
SELECT
id AS id,
name AS name,
purchase_date AS purchaseDate,
expiry_date AS expiryDate,
@totalDay := (DATEDIFF(CURDATE(), purchase_date) + 1) AS totalDay,
price AS price,
ROUND(price / @totalDay, 2) AS averagePrice,
category AS category,
purchaser AS purchaser,
channel AS channel,
image_url AS imageUrl
id AS id,
name AS name,
purchase_date AS purchaseDate,
expiry_date AS expiryDate,
@totalDay := (DATEDIFF(CURDATE(), purchase_date) + 1) AS totalDay,
price AS price,
ROUND(price / @totalDay, 2) AS averagePrice,
category AS category,
purchaser AS purchaser,
channel AS channel,
image_url AS imageUrl
FROM
product
product
<where>
<if test="query.category != null and query.category != ''">
category = #{query.category}
@@ -46,10 +31,4 @@
ORDER BY averagePrice
</if>
</select>
<select id="queryProductCategory" resultType="string">
SELECT DISTINCT category
FROM product
WHERE category IS NOT NULL AND category != '';
</select>
</mapper>