12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?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.zhgd.scs.mapper.AccessNumberTrendMapper">
- <resultMap id="BaseResultMap" type="com.zhgd.scs.domain.AccessNumberTrend">
- <id property="id" column="id" jdbcType="BIGINT"/>
- <result property="time" column="time" jdbcType="TIMESTAMP"/>
- <result property="number" column="number" jdbcType="INTEGER"/>
- <result property="unitId" column="unit_name" jdbcType="VARCHAR"/>
- <result property="projectId" column="project_id" jdbcType="BIGINT"/>
- </resultMap>
- <select id="getTrend" resultType="com.zhgd.scs.domain.AccessNumberTrend">
- SELECT time,number
- FROM `access_number_trend`
- where project_id=#{projectId} AND DATE_FORMAT(time,'%Y-%m-%d')=#{date}
- <choose>
- <when test="unitId != null and unitId != ''">
- and unit_id = #{unitId}
- </when>
- <otherwise>
- and unit_id = -1
- </otherwise>
- </choose>
- ORDER BY time DESC
- </select>
- <select id="getTrendByDate" resultType="com.zhgd.scs.domain.vo.NameCountDate">
- SELECT
- date( in_time ) `date`, count( DISTINCT idcard ) count
- FROM
- access_task_time
- where project_id = #{projectId}
- <if test="unitId != null and unitId != ''">
- and unit_id = #{unitId}
- </if>
- <if test="start != null and end != null">
- and in_time between date(#{start}) and #{end}
- or date(in_time) = date(now())
- </if>
- GROUP BY
- date( in_time )
- </select>
- </mapper>
|