<?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.timer.api.dao.kqmk.KqglAssoRelationSummaryMapper"> <resultMap id="BaseResultMap" type="cn.timer.api.bean.kqmk.KqglAssoRelationSummary" > <id column="id" property="id" /> <result column="user_id" property="userId" /> <result column="app_time" property="appTime" /> <result column="approval_id" property="approvalId" /> <result column="approval_type" property="approvalType" /> <result column="duration" property="duration" /> <result column="leave_type_id" property="leaveTypeId" /> <result column="overtime_type_id" property="overtimeTypeId" /> <result column="compensate_id" property="compensateId" /> <result column="start_time" property="startTime" /> <result column="end_time" property="endTime" /> </resultMap> <sql id="Base_Column_List"> id, user_id, app_time, approval_id, approval_type, duration, leave_type_id, overtime_type_id, compensate_id, start_time, end_time </sql> <sql id="Base_Column_List_Alias"> id KqglAssoRelationSummary_id, user_id KqglAssoRelationSummary_user_id, app_time KqglAssoRelationSummary_app_time, approval_id KqglAssoRelationSummary_approval_id, approval_type KqglAssoRelationSummary_approval_type, duration KqglAssoRelationSummary_duration, leave_type_id KqglAssoRelationSummary_leave_type_id, overtime_type_id KqglAssoRelationSummary_overtime_type_id, compensate_id KqglAssoRelationSummary_compensate_id, start_time KqglAssoRelationSummary_start_time, end_time KqglAssoRelationSummary_end_time </sql> <select id="SecondaryValue" resultMap="BaseResultMap"> select a.user_id, SUM(a.duration) as duration from (select res.user_id,res.duration from kqgl_asso_relation_summary res where res.user_id = #{userid} and res.approval_type = #{approvaltype} and SUBSTR(res.app_time,1,7) = #{time} GROUP BY res.approval_id) as a GROUP BY a.user_id </select> <select id="SpecificLeave" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from kqgl_asso_relation_summary res where res.user_id = #{userid} and res.approval_type = #{approvaltype} and SUBSTR(res.app_time,1,7) = #{apptime} </select> <select id="LeaveInvestigation" resultMap="BaseResultMap"> select res.start_time, res.end_time from kqgl_asso_relation_summary res where res.user_id = #{userid} and res.approval_type = #{approvaltype} and SUBSTR(res.app_time,1,7) = #{apptime} GROUP BY res.start_time,res.end_time; </select> <!-- <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoRelationSummary"> INSERT INTO kqgl_asso_relation_summary <trim prefix="(" suffix=")" suffixOverrides=","> <if test ='null != userId'> user_id, </if> <if test ='null != appTime'> app_time, </if> <if test ='null != approvalId'> approval_id, </if> <if test ='null != approvalType'> approval_type, </if> <if test ='null != duration'> duration, </if> <if test ='null != leaveTypeId'> leave_type_id, </if> <if test ='null != overtimeTypeId'> overtime_type_id, </if> <if test ='null != compensateId'> compensate_id, </if> <if test ='null != startTime'> start_time, </if> <if test ='null != endTime'> end_time </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test ='null != userId'> #{userId}, </if> <if test ='null != appTime'> #{appTime}, </if> <if test ='null != approvalId'> #{approvalId}, </if> <if test ='null != approvalType'> #{approvalType}, </if> <if test ='null != duration'> #{duration}, </if> <if test ='null != leaveTypeId'> #{leaveTypeId}, </if> <if test ='null != overtimeTypeId'> #{overtimeTypeId}, </if> <if test ='null != compensateId'> #{compensateId}, </if> <if test ='null != startTime'> #{startTime}, </if> <if test ='null != endTime'> #{endTime} </if> </trim> </insert> <delete id="delete" > DELETE FROM kqgl_asso_relation_summary WHERE id = #{id} </delete> <update id="update" parameterType="cn.timer.api.bean.kqmk.KqglAssoRelationSummary"> UPDATE kqgl_asso_relation_summary <set> <if test ='null != userId'>user_id = #{userId},</if> <if test ='null != appTime'>app_time = #{appTime},</if> <if test ='null != approvalId'>approval_id = #{approvalId},</if> <if test ='null != approvalType'>approval_type = #{approvalType},</if> <if test ='null != duration'>duration = #{duration},</if> <if test ='null != leaveTypeId'>leave_type_id = #{leaveTypeId},</if> <if test ='null != overtimeTypeId'>overtime_type_id = #{overtimeTypeId},</if> <if test ='null != compensateId'>compensate_id = #{compensateId},</if> <if test ='null != startTime'>start_time = #{startTime},</if> <if test ='null != endTime'>end_time = #{endTime}</if> </set> WHERE id = #{id} </update> <select id="load" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" /> FROM kqgl_asso_relation_summary WHERE id = #{id} </select> <select id="pageList" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" /> FROM kqgl_asso_relation_summary LIMIT #{offset}, #{pageSize} </select> <select id="pageListCount" resultType="java.lang.Integer"> SELECT count(1) FROM kqgl_asso_relation_summary </select> --> </mapper>