StatisticsDriveMapper.xml
2.01 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
<?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="cn.com.glsx.admin.modules.mapper.StatisticsDriveMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.admin.modules.entity.StatisticsDrive">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="sn" column="sn" jdbcType="VARCHAR"/>
<result property="driveNum" column="drive_num" jdbcType="INTEGER"/>
<result property="driveTime" column="drive_time" jdbcType="VARCHAR"/>
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
<result property="updatedTime" column="updated_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,sn,drive_num,
drive_time,created_time,updated_time
</sql>
<select id="getTestDriveData" parameterType="cn.com.glsx.admin.modules.model.param.TrialDriveReportSearch"
resultType="cn.com.glsx.admin.modules.model.export.TrialDriveReportExport">
select tsfd.drive_num as cnttotal,
left(tsfd.drive_time,7) as statDate,
day(str_to_date(tsfd.drive_time, '%Y-%m-%d')) as dayCount
from t_statistics_fence_drive tsfd
<where>
<choose>
<when test="year != null and year != '' and month != null and month != '' ">
left(tsfd.drive_time,7) = CONCAT(#{year},'-',#{month})
</when>
<otherwise>
<if test="year != null and year != '' ">
left(tsfd.drive_time,4) = #{year}
</if>
<if test="month != null and month != '' ">
right(left(tsfd.drive_time,7),2) = #{month}
</if>
</otherwise>
</choose>
<if test="sn != null and sn !=''">
and tsfd.sn = #{sn}
</if>
</where>
</select>
</mapper>