12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?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.management.platform.mapper.TimeCalculationMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.management.platform.entity.TimeCalculation">
- <id column="id" property="id" />
- <result column="user_id" property="userId" />
- <result column="action_type" property="actionType" />
- <result column="date" property="date" />
- <result column="start_time" property="startTime" />
- <result column="end_time" property="endTime" />
- <result column="duration" property="duration" />
- <result column="pic_url" property="picUrl" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, user_id, action_type, date, start_time, end_time, duration, pic_url
- </sql>
- <!--分页获取异常记录-->
- <select id="getDevianceList" resultType="java.util.Map">
- SELECT a.start_time AS time, b.name, a.action_type AS type, a.date, a.pic_url AS picUrl
- FROM time_calculation AS a
- LEFT JOIN user AS b ON a.user_id = b.id
- WHERE 1=1
- <if test="companyId != null and companyId != ''">
- AND b.company_id=#{companyId}
- </if>
- <if test="userId != null and userId != ''">
- AND a.user_id = #{userId}
- </if>
- <if test="actionCode != null and actionCode != ''">
- AND a.action_type = #{actionCode}
- </if>
- <if test="actionCode == null">
- AND a.action_type IN (6,7,8)
- </if>
- <if test="date != null and date != ''">
- AND a.date = #{date}
- </if>
- ORDER BY a.id DESC
- </select>
- <!--分页获取异常记录的总数量-->
- <select id="countDeviance" resultType="java.lang.Integer">
- SELECT COUNT(a.id) AS count
- FROM time_calculation AS a
- LEFT JOIN user AS b ON a.user_id = b.id
- WHERE 1=1
- <if test="companyId != null and companyId != ''">
- AND b.company_id=#{companyId}
- </if>
- <if test="userId != null and userId != ''">
- AND a.user_id = #{userId}
- </if>
- <if test="actionCode != null and actionCode != ''">
- AND a.action_type = #{actionCode}
- </if>
- <if test="actionCode == null">
- AND a.action_type IN (6,7,8)
- </if>
- <if test="date != null and date != ''">
- AND a.date = #{date}
- </if>
- </select>
- <!--获取某日所有有记录的用户id-->
- <select id="getTodayStatisticsUser" resultType="java.util.Map">
- SELECT DISTINCT b.id, b.name, b.phone
- FROM time_calculation AS a
- LEFT JOIN user AS b
- ON a.user_id = b.id
- WHERE 1=1
- <if test="companyId != null and companyId != ''">
- AND b.company_id=#{companyId}
- </if>
- <if test="date != null and date != ''">
- AND a.date = #{date}
- </if>
- </select>
- <!--根据日期和id获取所有统计信息-->
- <select id="getTodayStatistics" resultType="java.util.Map">
- SELECT action_type AS type, duration
- FROM time_calculation
- WHERE 1=1
- <if test="date != null and date != ''">
- AND date = #{date}
- </if>
- <if test="userId != null and userId != ''">
- AND user_id = #{userId}
- </if>
- </select>
- </mapper>
|