nnnjjj123
2021-01-28 71b6b716361c52af290493d365a328fc1a3467e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?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="org.springblade.modules.healthcode.mapper.healthcodeMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="healthcodeResultMap" type="org.springblade.modules.healthcode.entity.healthcode">
        <id column="id" property="id"/>
        <result column="type" property="type"/>
        <result column="sex" property="sex"/>
        <result column="province" property="province"/>
        <result column="city" property="city"/>
        <result column="district" property="district"/>
        <result column="dtime" property="dtime"/>
    </resultMap>
 
    <sql id="key">
        <trim suffixOverrides=",">
            <if test="type!=null and type!=''">
                type,
            </if>
            <if test="sex!=null and sex!=''">
                sex,
            </if>
            <if test="province!=null and province!=''">
                province,
            </if>
            <if test="city!=null and city!=''">
                city,
            </if>
            <if test="district!=null and district!=''">
                district,
            </if>
            <if test="dtime!=null and dtime!=''">
                dtime,
            </if>
        </trim>
    </sql>
    <sql id="value">
        <trim suffixOverrides=",">
            <if test="type!=null and type!=''">
                #{type},
            </if>
            <if test="sex!=null and sex!=''">
                #{sex},
            </if>
            <if test="province!=null and province!=''">
                #{province},
            </if>
            <if test="city!=null and city!=''">
                #{city},
            </if>
            <if test="district!=null and district!=''">
                #{district},
            </if>
            <if test="dtime!=null and dtime!=''">
                #{dtime},
            </if>
        </trim>
    </sql>
    <insert id="insert">
        insert into healthcode(<include refid="key"/>) values(<include refid="value"/>)
    </insert>
 
    <select id="selectCountr" resultType="java.util.HashMap">
     SELECT
    COUNT( * ) AS num,
    type
FROM
    healthcode
WHERE
DATE_FORMAT(dtime,'%Y-%m-%d')=#{time} GROUP BY type
    </select>
 
    <select id="selectCountz" resultType="java.util.HashMap">
        SELECT
        COUNT( * ) AS num,
        type
        FROM
        healthcode
        WHERE
        DATE_FORMAT(dtime,'%Y-%m-%d')&gt;=#{beginTime} and DATE_FORMAT(dtime,'%Y-%m-%d')&lt;=#{endTime} GROUP BY type
    </select>
 
</mapper>