MemberInfoMapper.xml
3.33 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?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.example.mapper.api.MemberInfoMapper">
<insert id="create" parameterType="com.example.models.api.MemberInfo" useGeneratedKeys="true" keyProperty="id">
INSERT INTO t_hpai_member_info (
source,
`timestamp`,
barcode,
channel_id,
manager_id,
`name`,
gender,
birthday_str,
mobile_number,
sampling_date,
recipients,
address,
family_disease,
existing_disease,
weight,
height,
remarks,
member_number,
create_at,
status
)
VALUES (
#{source},
#{timestamp},
#{barcode},
#{channelId},
#{managerId},
#{name},
#{gender},
#{birthdayStr},
#{mobileNumber},
#{samplingDate},
#{recipients},
#{address},
#{familyDisease},
#{existingDisease},
#{weight},
#{height},
#{remarks},
#{memberNumber},
#{createAt},
#{status}
);
</insert>
<select id="getByMobileNumber" resultType="com.example.models.api.MemberInfo">
select * from t_hpai_member_info where mobile_number = #{mobileNumber} limit 1;
</select>
<update id="genereport">
update t_hpai_member_info set
is_genereport = #{isGenereport},
genereport_at = #{genereportAt},
pack_name = #{packName},
pdf_name = #{pdfName},
url = #{url},
genereport_name = #{genereportName} where mobile_number = #{mobileNumber};
</update>
<select id="list" resultType="com.example.models.api.MemberInfo">
select * from t_hpai_member_info where 1 = 1
<if test="keyWord != null and keyWord != ''">
and `name` LIKE CONCAT('%', #{keyWord}, '%')
</if>
<if test="status != -1">
and is_genereport = #{status}
</if>
</select>
<select id="count" resultType="int">
select count(*) c from t_hpai_member_info where 1 = 1
<if test="keyWord != null and keyWord != ''">
and `name` LIKE CONCAT('%', #{keyWord}, '%')
</if>
<if test="status != -1">
and is_genereport = #{status}
</if>
</select>
<select id="registerByDay" resultType="map">
select count(*) c,DATE_FORMAT(create_at,'%Y-%m-%d') d from t_hpai_member_info
where create_at BETWEEN #{startTime} and #{endTime}
group by DATE_FORMAT(create_at,'%Y-%m-%d')
</select>
<select id="genereportByDay" resultType="map">
select count(*) c,DATE_FORMAT(genereport_at,'%Y-%m-%d') d from t_hpai_member_info
where is_genereport = 1 and create_at BETWEEN #{startTime} and #{endTime} group by DATE_FORMAT(genereport_at,'%Y-%m-%d')
</select>
<select id="registerByMonth" resultType="map">
select count(*) c,DATE_FORMAT(create_at,'%Y-%m') d from t_hpai_member_info
where create_at BETWEEN #{startTime} and #{endTime}
group by DATE_FORMAT(create_at,'%Y-%m')
</select>
<select id="genereportByMonth" resultType="map">
select count(*) c,DATE_FORMAT(genereport_at,'%Y-%m') d from t_hpai_member_info
where is_genereport = 1 and create_at BETWEEN #{startTime} and #{endTime} group by DATE_FORMAT(genereport_at,'%Y-%m')
</select>
</mapper>