1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?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.AccessTaskTimeMapper">
- <resultMap id="BaseResultMap" type="com.zhgd.scs.domain.AccessTaskTime">
- <id property="id" column="id" jdbcType="BIGINT"/>
- <result property="idcard" column="idcard" jdbcType="VARCHAR"/>
- <result property="inTime" column="in_time" jdbcType="TIMESTAMP"/>
- <result property="outTime" column="out_time" jdbcType="TIMESTAMP"/>
- <result property="workingHours" column="working_hours" jdbcType="DECIMAL"/>
- <result property="personId" column="person_id" jdbcType="BIGINT"/>
- <result property="projectId" column="project_id" jdbcType="BIGINT"/>
- </resultMap>
- <select id="pagelist" resultType="com.zhgd.scs.domain.vo.AccessTaskTimeVo">
- select p.*,
- tw.name workerTypeName,
- u.abbr_name unitName,
- a.total_hours
- from labor_person p
- LEFT JOIN sys_worker_type tw ON tw.id=p.worker_type_id
- LEFT JOIN labor_unit u ON u.id = p.unit_id
- LEFT JOIN (
- SELECT t.idcard, SUM(COALESCE(t.working_hours, 0)) total_hours FROM access_task_time t
- WHERE 1=1
- <if test="startDate != null and endDate != null">
- AND t.in_time >= #{startDate} and t.out_time <= #{endDate}
- </if>
- GROUP BY t.idcard
- ) a ON p.id_card = a.idcard
- WHERE p.project_id=#{projectId}
- <if test="name!=null and name!= ''">
- AND p.name like concat('%',#{name},'%')
- </if>
- <if test="unitId!=null ">
- AND p.unit_id = #{unitId}
- </if>
- <if test="workerTypeId!=null">
- AND p.worker_type_id = #{workerTypeId}
- </if>
- ORDER BY
- a.total_hours DESC
- </select>
- </mapper>
|