<?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" /> <result column="org_code" property="orgCode" /> <result column="ordernum" property="ordernum" /> <result column="totals" property="totals" /> </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, org_code, ordernum, totals </sql> <select id="HolidayDetails" resultMap="BaseResultMap"> select su.* from kqgl_asso_relation_summary su where su.approval_type = 2 and su.org_code = #{orgcode} and su.ordernum = 1 and SUBSTR(su.app_time,1,7) = #{apptime} and su.leave_type_id = (select ru.id from kqgl_asso_leave_rules ru where ru.org_code = #{orgcode} and ru.rules_type = #{rules_type}) and su.user_id = #{userid} </select> <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} and res.org_code = #{orgcode} </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.org_code = #{orgcode} and res.approval_type = #{approvaltype} and SUBSTR(res.app_time,1,7) = #{apptime} GROUP BY res.start_time,res.end_time; </select> <select id="leaveinvesti" resultMap="BaseResultMap"> select res.start_time, res.end_time from kqgl_asso_relation_summary res where res.user_id = #{userid} and res.org_code = #{orgcode} and res.approval_type = #{approvaltype} and res.app_time = #{apptime} GROUP BY res.start_time,res.end_time DESC LIMIT 1 </select> <select id="selectTabledata" resultMap="BaseResultMap"> select SUM(res.duration) as duration 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="Businessdayclockin" resultMap="BaseResultMap"> select IFNULL(SUM(res.duration),0) as duration from kqgl_asso_relation_summary res where res.user_id = #{userid} and res.approval_type = #{approvaltype} and res.app_time = #{apptime} and res.org_code = #{orgcode} </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>