Bonus-AI-Cloud/bonus-modules/bonus-ai/src/main/resources/mapper/ai/AiIdcardrecognizeMapper.xml

78 lines
3.6 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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.bonus.ai.mapper.AiIdcardrecognizeMapper">
<insert id="insert" parameterType="com.bonus.ai.domain.po.AiIdcardrecognizeResult">
INSERT INTO ai_idcardrecognize_result
(service_id, name, sex, enthnic, birthday, address, idcard_number,
issuing_authority, idcard_validity, if_complete, frontImge_address,
backImg_address, recognize_time, response_long, invoke_ip,
update_by, update_time)
VALUES
(#{serviceId}, #{name}, #{sex}, #{enthnic}, #{birthday}, #{address}, #{idcardNumber},
#{issuingAuthority}, #{idcardValidity}, #{ifComplete}, #{frontImageAddress},
#{backImageAddress}, #{recognizeTime}, #{responseLong}, #{invokeIp},
#{updateBy}, #{updateTime})
</insert>
<select id="ResultDetails" resultType="com.bonus.ai.domain.po.AiIdcardrecognizeResult">
select result_id, service_id, name, sex, enthnic, birthday, address,
INSERT(idcard_number,7,8,'********')idcard_number,
issuing_authority, idcard_validity, if_complete, frontImge_address,
backImg_address, recognize_time, response_long, invoke_ip,
update_by, update_time, del_flag
from ai_idcardrecognize_result
ORDER BY update_time DESC
LIMIT 20
</select>
<select id="Result" resultType="com.bonus.ai.domain.vo.ResultCountVo">
SELECT
COUNT(*) AS totalNu,
SUM(CASE WHEN if_complete = '是' THEN 1 ELSE 0 END) AS correctNu,
SUM(CASE WHEN if_complete = '否' THEN 1 ELSE 0 END) AS incorrectNU
FROM
ai_idcardrecognize_result
</select>
<select id="last7Days" resultType="com.bonus.ai.domain.vo.ResultCountVo">
SELECT
date_seq.day AS day,
COALESCE(totalNu, 0) AS totalNu,
COALESCE(correctNu, 0) AS correctNu,
COALESCE(incorrectNu, 0) AS incorrectNu
FROM
(
-- 生成日期序列包括最近7天的日期
SELECT CURDATE() - INTERVAL (a.a + (10 * b.a) + (100 * c.a)) DAY AS day
FROM
(SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) AS a
CROSS JOIN
(SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) AS b
CROSS JOIN
(SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) AS c
) AS date_seq
LEFT JOIN (
SELECT
DATE(update_time) AS day,
COUNT(*) AS totalNu,
SUM(CASE WHEN if_complete = '是' THEN 1 ELSE 0 END) AS correctNu,
SUM(CASE WHEN if_complete = '否' THEN 1 ELSE 0 END) AS incorrectNu
FROM
ai_idcardrecognize_result
WHERE
update_time >= CURDATE() - INTERVAL 6 DAY
GROUP BY
DATE(update_time)
) AS data ON date_seq.day = data.day
WHERE
date_seq.day >= CURDATE() - INTERVAL 6 DAY
ORDER BY
day DESC;
</select>
</mapper>