This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceAIMapper">
|
||||
<!-- 查询打卡记录列表 -->
|
||||
<select id="getClockRecordList" resultType="jnpf.model.attendance.vo.attendance.ClockRecordVo">
|
||||
SELECT
|
||||
dr.F_Id AS ruleId,
|
||||
dr.F_InPoint inPoint,
|
||||
dr.F_OutPoint outPoint,
|
||||
MAX(CASE WHEN ir.F_ClockInType = 1 THEN ir.F_ClockInId END) AS inClockInId,
|
||||
MAX(CASE WHEN ir.F_ClockInType = 1 THEN i.F_ClockInTime END) AS onWorkDateTime,
|
||||
MAX(CASE WHEN ir.F_ClockInType = 1 THEN i.F_Address END) AS onWorkAddress,
|
||||
CASE
|
||||
WHEN COUNT(CASE WHEN ir.F_ClockInType = 1 THEN 1 END) <![CDATA[ > ]]> 1 THEN '异常'
|
||||
WHEN COUNT(CASE WHEN ir.F_ClockInType = 1 THEN 1 END) <![CDATA[ < ]]> 1 THEN '未打卡'
|
||||
WHEN ir.F_Absence IS NOT NULL AND ir.F_Absence = 1 THEN '旷工'
|
||||
ELSE MAX(
|
||||
CASE WHEN ir.F_ClockInType = 1
|
||||
THEN CASE ir.F_ClockInStatus
|
||||
WHEN -2 THEN '无需打卡'
|
||||
WHEN -1 THEN '缺卡'
|
||||
WHEN 1 THEN '正常'
|
||||
WHEN 2 THEN '迟到'
|
||||
ELSE '异常'
|
||||
END
|
||||
END
|
||||
)
|
||||
END AS onWorkStatus,
|
||||
MAX(CASE WHEN ir.F_ClockInType = 2 THEN ir.F_ClockInId END) AS outClockInId,
|
||||
MAX(CASE WHEN ir.F_ClockInType = 2 THEN i.F_ClockInTime END) AS offWorkDateTime,
|
||||
MAX(CASE WHEN ir.F_ClockInType = 2 THEN i.F_Address END) AS offWorkAddress,
|
||||
CASE
|
||||
WHEN COUNT(CASE WHEN ir.F_ClockInType = 2 THEN 1 END) <![CDATA[ > ]]> 1 THEN '异常'
|
||||
WHEN COUNT(CASE WHEN ir.F_ClockInType = 2 THEN 1 END) <![CDATA[ < ]]> 1 THEN '未打卡'
|
||||
WHEN ir.F_Absence IS NOT NULL AND ir.F_Absence = 1 THEN '旷工'
|
||||
ELSE MAX(
|
||||
CASE WHEN ir.F_ClockInType = 2
|
||||
THEN CASE ir.F_ClockInStatus
|
||||
WHEN -2 THEN '无需打卡'
|
||||
WHEN -1 THEN '缺卡'
|
||||
WHEN 1 THEN '正常'
|
||||
WHEN 3 THEN '早退'
|
||||
ELSE '异常'
|
||||
END
|
||||
END
|
||||
)
|
||||
END AS offWorkStatus
|
||||
FROM ftb_attendance_daily_rule dr
|
||||
LEFT JOIN ftb_attendance_clock_in_result ir ON dr.F_Id = ir.F_RuleId AND ir.F_DeleteMark = 0
|
||||
LEFT JOIN ftb_attendance_clock_in i ON i.F_Id = ir.F_ClockInId
|
||||
WHERE dr.F_Day = #{queryDate} AND dr.F_UserId = #{userId}
|
||||
AND dr.F_AttendanceType IN (-1,1,2,4) AND dr.F_DeleteMark = 0
|
||||
GROUP BY dr.F_Id, dr.F_InPoint, dr.F_OutPoint
|
||||
ORDER BY dr.F_InPoint ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceApproveMapper" >
|
||||
<!-- 查前天的加班出勤规则找这些出勤规则对应的加班结果表数据-->
|
||||
<select id="getOvertimeVouchersList" resultType="jnpf.model.attendance.vo.OvertimeVouchersVo">
|
||||
SELECT r.F_RuleId ruleId, r.F_EffectiveTime effectiveTime ,r.F_ClockInType clockInType, r.F_RestMinute restMinute,dr.F_GroupId groupId ,r.F_UserId userId
|
||||
FROM ftb_attendance_clock_in_result r
|
||||
LEFT JOIN ftb_attendance_daily_rule dr ON r.F_RuleId = dr.F_Id
|
||||
WHERE r.F_RuleId IN (
|
||||
SELECT F_Id
|
||||
FROM ftb_attendance_daily_rule
|
||||
WHERE
|
||||
<![CDATA[
|
||||
DATE_FORMAT(F_Day, '%Y-%m-%d') <= DATE_FORMAT(#{date}, '%Y-%m-%d') AND F_AttendanceType = 4 AND F_ApplyViewEnable IN(1,9,10) AND F_DeleteMark = 0
|
||||
]]>
|
||||
) AND r.F_ClockInStatus IN (1,-2) AND r.F_DeleteMark = 0
|
||||
|
||||
</select>
|
||||
<!-- 校验是否重复发放加班劵-->
|
||||
<select id="getOvertimeByRuleId" resultType="java.lang.Integer">
|
||||
SELECT COUNT(0) from ftb_attendance_balance_record
|
||||
where F_Type = #{code} and F_Object_Id = #{ruleId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,457 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceBalanceRecordMapper" >
|
||||
|
||||
<sql id="Base_Column_List" >
|
||||
F_Id, F_Name, F_User_Id, F_Balance, F_Total, F_Unit, F_Expire_Time, F_Grant_Way,
|
||||
F_State, F_Over, F_Paid, F_CreatorUserId, F_CreatorTime, F_LastModifyUserId, F_LastModifyTime,
|
||||
F_DeleteMark, F_DeleteTime, F_DeleteUserId, F_TenantId
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
<!-- 余额管理列表-->
|
||||
<!-- <select id="getBalanceList" resultType="jnpf.model.attendance.vo.UserBalanceVo">-->
|
||||
<!-- SELECT * FROM (-->
|
||||
<!-- SELECT u.F_UserId userId ,(SELECT IFNULL(SUM(F_Balance),0) FROM ftb_attendance_balance_record r WHERE r.F_User_Id = userId AND r.F_DeleteMark = 0 AND r.F_State = 0) balance ,-->
|
||||
<!-- (SELECT IFNULL(SUM(r.F_Balance),0) FROM ftb_attendance_balance_record r WHERE r.F_User_Id = userId AND r.F_Paid = 1 AND F_DeleteMark = 0 AND F_State = 0) paidBalance ,-->
|
||||
<!-- (SELECT IFNULL(SUM(r.F_Balance),0) FROM ftb_attendance_balance_record r WHERE r.F_User_Id = userId AND r.F_Paid = 2 AND r.F_DeleteMark = 0 AND r.F_State = 0) unpaidBalance ,-->
|
||||
<!-- (SELECT IFNULL(SUM(r.F_Balance),0) FROM ftb_attendance_balance_record r WHERE r.F_User_Id = userId AND r.F_DeleteMark = 0 AND r.F_State = 0-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND r.F_Expire_Time <= DATE_ADD(now(),INTERVAL 7 DAY)-->
|
||||
<!-- ]]>-->
|
||||
<!-- ) adventBalance-->
|
||||
<!-- FROM ftb_attendance_group_user u-->
|
||||
<!-- LEFT JOIN ftb_attendance_balance_record r ON u.F_UserId = r.F_User_Id-->
|
||||
<!-- WHERE u.F_GroupId = #{balanceQueryDto.groupId} AND u.F_Type = 1 AND u.F_DeleteMark = 0-->
|
||||
<!-- <if test="null != balanceQueryDto.userIds and balanceQueryDto.userIds.size > 0">-->
|
||||
<!-- AND F_UserId in-->
|
||||
<!-- <foreach collection="balanceQueryDto.userIds" index="index" item="item" open="(" separator="," close=")">-->
|
||||
<!-- #{item}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
<!-- GROUP BY userId-->
|
||||
<!-- ) a-->
|
||||
<!-- WHERE 1 = 1-->
|
||||
<!-- <if test="balanceQueryDto.minBalance != null">-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND #{balanceQueryDto.minBalance} <= a.balance-->
|
||||
<!-- ]]>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="balanceQueryDto.maxBalance != null">-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND a.balance <= #{balanceQueryDto.maxBalance}-->
|
||||
<!-- ]]>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="balanceQueryDto.minAdventBalance != null">-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND #{balanceQueryDto.minAdventBalance} <= a.adventBalance-->
|
||||
<!-- ]]>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="balanceQueryDto.maxAdventBalance != null">-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND a.adventBalance <= #{balanceQueryDto.maxAdventBalance}-->
|
||||
<!-- ]]>-->
|
||||
<!-- </if>-->
|
||||
<!-- ORDER BY balance <if test="null != balanceSort"> ${balanceSort} </if> ,-->
|
||||
<!-- paidBalance <if test="null != paidBalanceSort"> ${paidBalanceSort} </if> ,-->
|
||||
<!-- unpaidBalance <if test="null != unpaidBalanceSort == 1"> ${unpaidBalanceSort} </if>,-->
|
||||
<!-- adventBalance <if test="null != adventBalance "> ${adventBalance} </if>-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- 新增假期节假日劵-->
|
||||
<!-- <insert id="grantBalance">-->
|
||||
<!-- insert into ftb_attendance_balance_record (F_Id, F_Name, F_User_Id,-->
|
||||
<!-- F_Balance, F_Total, F_Unit,-->
|
||||
<!-- F_Expire_Time, F_Grant_Way, F_State,-->
|
||||
<!-- F_Paid, F_CreatorUserId,F_CreatorTime,F_Type,F_Object_Id)-->
|
||||
<!-- values (#{id}, #{holidayName}, #{userId},-->
|
||||
<!-- #{dayNum}, #{dayNum}, #{unit},-->
|
||||
<!-- #{expiresTime}, #{grantWay}, 0,-->
|
||||
<!-- #{paid}, #{createUserId},now(),#{type},#{objectId})-->
|
||||
<!-- </insert>-->
|
||||
<!-- 余额记录列表-->
|
||||
<!-- <select id="getUserBalance" resultType="jnpf.model.attendance.vo.AttendanceBalanceRecordVo">-->
|
||||
<!-- select F_Id id, F_Name `name`, F_User_Id userId, F_Balance balance, F_Total total, F_Unit unit, F_Expire_Time expireTime, F_Grant_Way grantWay,-->
|
||||
<!-- F_State `state`, F_Over `over`, F_Paid paid, F_CreatorUserId creatoruserid, F_CreatorTime creatortime-->
|
||||
<!-- from ftb_attendance_balance_record-->
|
||||
<!-- where F_User_Id IN (-->
|
||||
<!-- SELECT F_UserId FROM ftb_attendance_group_user WHERE F_GroupId = #{balanceQueryDto.groupId} AND F_Type = 1-->
|
||||
<!-- AND F_DeleteMark = 0-->
|
||||
<!-- ) AND F_DeleteMark = 0-->
|
||||
<!-- <if test="null != balanceQueryDto.iText and '' != balanceQueryDto.iText">-->
|
||||
<!-- AND INSTR(F_Name ,#{balanceQueryDto.iText})> 0-->
|
||||
<!-- <if test="null != balanceQueryDto.userIds and balanceQueryDto.userIds.size > 0">-->
|
||||
<!-- OR F_User_Id in-->
|
||||
<!-- <foreach collection="balanceQueryDto.userIds" index="index" item="item" open="(" separator="," close=")">-->
|
||||
<!-- #{item}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != balanceQueryDto.minGrantTime and '' != balanceQueryDto.minGrantTime">-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND DATE_FORMAT(#{balanceQueryDto.minGrantTime},'%Y-%m-%d') <= DATE_FORMAT(F_CreatorTime,'%Y-%m-%d')-->
|
||||
<!-- ]]>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != balanceQueryDto.maxGrantTime and '' != balanceQueryDto.maxGrantTime">-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND DATE_FORMAT(F_CreatorTime,'%Y-%m-%d') <= DATE_FORMAT(#{balanceQueryDto.maxGrantTime},'%Y-%m-%d')-->
|
||||
<!-- ]]>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != balanceQueryDto.minExpireTime and '' != balanceQueryDto.minExpireTime">-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND DATE_FORMAT(#{balanceQueryDto.minExpireTime},'%Y-%m-%d') <= DATE_FORMAT(F_Expire_Time,'%Y-%m-%d')-->
|
||||
<!-- ]]>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != balanceQueryDto.maxExpireTime and '' != balanceQueryDto.maxExpireTime">-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND DATE_FORMAT(F_Expire_Time,'%Y-%m-%d') <= DATE_FORMAT(#{balanceQueryDto.maxExpireTime},'%Y-%m-%d')-->
|
||||
<!-- ]]>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != balanceQueryDto.state">-->
|
||||
<!-- AND F_State = #{balanceQueryDto.state}-->
|
||||
<!-- </if>-->
|
||||
<!-- </select>-->
|
||||
<!-- 成员余额记录列表-->
|
||||
<!-- <select id="getUserBalanceDetail" resultType="jnpf.model.attendance.vo.AttendanceBalanceRecordVo">-->
|
||||
<!-- select F_Id id, F_Name `name`, F_User_Id userId, F_Balance balance, F_Total total, F_Unit unit, F_Expire_Time expireTime, F_Grant_Way grantWay,-->
|
||||
<!-- F_State `state`, F_Over `over`, F_Paid paid, F_CreatorUserId creatoruserid, F_CreatorTime creatortime-->
|
||||
<!-- from ftb_attendance_balance_record-->
|
||||
<!-- where F_User_Id = #{balanceQueryDto.userId} AND F_DeleteMark = 0-->
|
||||
<!-- <if test="null != balanceQueryDto.iText and '' != balanceQueryDto.iText">-->
|
||||
<!-- AND INSTR(F_Name ,#{balanceQueryDto.iText})> 0-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != balanceQueryDto.minGrantTime and '' != balanceQueryDto.minGrantTime">-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND DATE_FORMAT(#{balanceQueryDto.minGrantTime},'%Y-%m-%d') <= DATE_FORMAT(F_CreatorTime,'%Y-%m-%d')-->
|
||||
<!-- ]]>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != balanceQueryDto.maxGrantTime and '' != balanceQueryDto.maxGrantTime">-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND DATE_FORMAT(F_CreatorTime,'%Y-%m-%d') <= DATE_FORMAT(#{balanceQueryDto.maxGrantTime},'%Y-%m-%d')-->
|
||||
<!-- ]]>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != balanceQueryDto.minExpireTime and '' != balanceQueryDto.minExpireTime">-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND DATE_FORMAT(#{balanceQueryDto.minExpireTime},'%Y-%m-%d') <= DATE_FORMAT(F_Expire_Time,'%Y-%m-%d')-->
|
||||
<!-- ]]>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != balanceQueryDto.maxExpireTime and '' != balanceQueryDto.maxExpireTime">-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND DATE_FORMAT(F_Expire_Time,'%Y-%m-%d') <= DATE_FORMAT(#{balanceQueryDto.maxExpireTime},'%Y-%m-%d')-->
|
||||
<!-- ]]>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != balanceQueryDto.state">-->
|
||||
<!-- AND F_State = #{balanceQueryDto.state}-->
|
||||
<!-- </if>-->
|
||||
<!-- </select>-->
|
||||
<!-- 修改指定劵的状态-->
|
||||
<!-- <update id="updateBalanceState">-->
|
||||
<!-- update ftb_attendance_balance_record-->
|
||||
<!-- set-->
|
||||
<!-- F_State = #{state},-->
|
||||
<!-- F_LastModifyUserId = #{userId},-->
|
||||
<!-- F_LastModifyTime = now()-->
|
||||
<!-- where F_Id = #{id}-->
|
||||
<!-- </update>-->
|
||||
<!-- 获取用户余额-->
|
||||
<select id="getBalanceByUserId" resultType="jnpf.model.attendance.vo.UserBalanceVo">
|
||||
SELECT F_User_Id userId, IFNULL(SUM(F_Balance),0) balance ,
|
||||
(SELECT IFNULL(SUM(r.F_Balance),0) FROM ftb_attendance_balance_record r WHERE r.F_User_Id = userId AND r.F_Paid = 1 AND F_State = 0 ) paidBalance ,
|
||||
(SELECT IFNULL(SUM(r.F_Balance),0) FROM ftb_attendance_balance_record r WHERE r.F_User_Id = userId AND r.F_Paid = 2 AND F_State = 0) unpaidBalance ,
|
||||
(SELECT IFNULL(SUM(r.F_Balance),0) FROM ftb_attendance_balance_record r WHERE r.F_User_Id = userId AND F_State = 0
|
||||
<![CDATA[
|
||||
AND r.F_Expire_Time <= DATE_ADD(now(),INTERVAL 7 DAY)
|
||||
]]>
|
||||
) adventBalance
|
||||
FROM ftb_attendance_balance_record
|
||||
WHERE F_User_Id = #{userId} AND F_DeleteMark = 0 AND F_State = 0
|
||||
GROUP BY userId ,F_Unit
|
||||
</select>
|
||||
<!-- 过期劵-->
|
||||
<update id="invalidationCoupons">
|
||||
UPDATE ftb_attendance_balance_record
|
||||
SET F_State = 1
|
||||
WHERE F_Id IN
|
||||
<foreach collection="ids"
|
||||
item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
<!-- 获取节日信息-->
|
||||
<select id="getFestivalSetting" resultType="jnpf.model.attendance.vo.VacationVo">
|
||||
SELECT F_Day dayNum , F_ExpiresType expiresType ,F_ExpiresDayNumber expiresDayNumber , F_ExpiresMonth expiresMonth ,F_ExpiresDay expiresDay ,F_PaidSalaryEnable paid ,F_Name holidayName ,F_Id id
|
||||
FROM ftb_attendance_festival_setting
|
||||
WHERE F_Id = #{balanceId}
|
||||
</select>
|
||||
<!-- 获取假日配置信息-->
|
||||
<select id="getHolidaySetting" resultType="jnpf.model.attendance.vo.VacationVo">
|
||||
SELECT F_DayType dayType,F_DayNumber dayNumber ,F_YoeMultiple yoeMultiple ,F_YosMultiple yosMultiple , F_ExpiresType expiresType ,F_ExpiresDayNumber expiresDayNumber , F_ExpiresMonth expiresMonth ,F_ExpiresDay expiresDay ,F_PaidSalaryEnable paid ,F_Name holidayName
|
||||
FROM ftb_attendance_holiday_setting
|
||||
WHERE F_Id = #{balanceId}
|
||||
</select>
|
||||
|
||||
<select id="getBalanceRecordByUserId" resultType="jnpf.model.attendance.vo.AttendanceBalanceRecordVo">
|
||||
SELECT t.* FROM (
|
||||
SELECT F_Id id, F_Name `name`, F_User_Id userId, F_Balance balance, F_Total total, F_Unit unit, IFNULL(F_Expire_Time,DATE_FORMAT('2999-1-1','%Y-%m-%d')) expireTime, F_Grant_Way grantWay,
|
||||
F_State `state`, F_Over `over`, F_Paid paid, F_CreatorUserId creatoruserid, F_CreatorTime creatortime
|
||||
FROM ftb_attendance_balance_record
|
||||
WHERE F_User_Id = #{userId} AND F_State = 0 AND F_Over = 0 AND F_DeleteMark = 0 AND F_Paid IN
|
||||
<foreach collection="paid"
|
||||
item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
) t
|
||||
ORDER BY t.expireTime ,paid ASC
|
||||
</select>
|
||||
<!-- 修改劵的使用情况-->
|
||||
<update id="updateBalance">
|
||||
UPDATE ftb_attendance_balance_record
|
||||
SET F_Balance = #{balance},
|
||||
F_Over = #{over},
|
||||
F_LastModifyTime = now()
|
||||
WHERE F_Id = #{id}
|
||||
</update>
|
||||
<!-- 获取用户指定类型假的余额总数-->
|
||||
<!-- <select id="getBalanceRecordCountByUserId" resultType="java.math.BigDecimal">-->
|
||||
<!-- SELECT IFNULL(SUM(F_Balance),0)-->
|
||||
<!-- FROM ftb_attendance_balance_record-->
|
||||
<!-- WHERE F_User_Id = #{userId} AND F_State = 0 AND F_Over = 0 AND F_DeleteMark = 0 AND F_Paid = #{paid}-->
|
||||
<!-- </select>-->
|
||||
<!-- 通过劵的id获取劵的详情-->
|
||||
<select id="getBalanceDetailList" resultType="jnpf.model.attendance.vo.AttendanceBalanceRecordVo">
|
||||
SELECT F_Id id, F_Balance balance
|
||||
FROM ftb_attendance_balance_record
|
||||
WHERE F_Id IN
|
||||
<foreach collection="balanceIds" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- 验证出勤规则id有无发加班劵-->
|
||||
<select id="getBalanceByRuleId" resultType="java.lang.Integer">
|
||||
SELECT count(0)
|
||||
FROM ftb_attendance_balance_record
|
||||
WHERE F_Type = 3 and F_Object_Id = #{ruleId}
|
||||
</select>
|
||||
<!-- 批量获取用户余额-->
|
||||
<select id="getBalanceByUserIds" resultType="jnpf.model.attendance.vo.UserBalanceVo">
|
||||
SELECT F_User_Id userId, IFNULL(SUM(F_Balance),0) balance ,
|
||||
(SELECT IFNULL(SUM(r.F_Balance),0) FROM ftb_attendance_balance_record r WHERE r.F_User_Id = userId AND r.F_Paid = 1 AND F_State = 0 ) paidBalance ,
|
||||
(SELECT IFNULL(SUM(r.F_Balance),0) FROM ftb_attendance_balance_record r WHERE r.F_User_Id = userId AND r.F_Paid = 2 AND F_State = 0) unpaidBalance ,
|
||||
(SELECT IFNULL(SUM(r.F_Balance),0) FROM ftb_attendance_balance_record r WHERE r.F_User_Id = userId AND F_State = 0
|
||||
<![CDATA[
|
||||
AND r.F_Expire_Time <= DATE_ADD(now(),INTERVAL 7 DAY)
|
||||
]]>
|
||||
) adventBalance
|
||||
FROM ftb_attendance_balance_record
|
||||
WHERE F_DeleteMark = 0 AND F_State = 0
|
||||
AND F_User_Id IN
|
||||
<foreach collection="userIds"
|
||||
item="id" index="index" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
GROUP BY userId ,F_Unit
|
||||
</select>
|
||||
|
||||
|
||||
<!-- <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >-->
|
||||
<!-- delete from ftb_attendance_balance_record-->
|
||||
<!-- where F_Id = #{fId,jdbcType=VARCHAR}-->
|
||||
<!-- </delete>-->
|
||||
<!-- <insert id="insert" parameterType="com.shs.cts.util.domain.po.experience.AttendanceBalanceRecord" >-->
|
||||
<!-- insert into ftb_attendance_balance_record (F_Id, F_Name, F_User_Id, -->
|
||||
<!-- F_Balance, F_Total, F_Unit, -->
|
||||
<!-- F_Expire_Time, F_Grant_Way, F_State, -->
|
||||
<!-- F_Over, F_Paid, F_CreatorUserId, -->
|
||||
<!-- F_CreatorTime, F_LastModifyUserId, F_LastModifyTime, -->
|
||||
<!-- F_DeleteMark, F_DeleteTime, F_DeleteUserId, -->
|
||||
<!-- F_TenantId)-->
|
||||
<!-- values (#{fId,jdbcType=VARCHAR}, #{fName,jdbcType=VARCHAR}, #{fUserId,jdbcType=VARCHAR}, -->
|
||||
<!-- #{fBalance,jdbcType=DECIMAL}, #{fTotal,jdbcType=DECIMAL}, #{fUnit,jdbcType=BIT}, -->
|
||||
<!-- #{fExpireTime,jdbcType=TIMESTAMP}, #{fGrantWay,jdbcType=BIT}, #{fState,jdbcType=BIT}, -->
|
||||
<!-- #{fOver,jdbcType=BIT}, #{fPaid,jdbcType=BIT}, #{fCreatoruserid,jdbcType=VARCHAR}, -->
|
||||
<!-- #{fCreatortime,jdbcType=TIMESTAMP}, #{fLastmodifyuserid,jdbcType=VARCHAR}, #{fLastmodifytime,jdbcType=TIMESTAMP}, -->
|
||||
<!-- #{fDeletemark,jdbcType=INTEGER}, #{fDeletetime,jdbcType=TIMESTAMP}, #{fDeleteuserid,jdbcType=VARCHAR}, -->
|
||||
<!-- #{fTenantid,jdbcType=VARCHAR})-->
|
||||
<!-- </insert>-->
|
||||
<!-- -->
|
||||
<!-- -->
|
||||
<!-- <update id="updateByPrimaryKey" parameterType="com.shs.cts.util.domain.po.experience.AttendanceBalanceRecord" >-->
|
||||
<!-- update ftb_attendance_balance_record-->
|
||||
<!-- set F_Name = #{fName,jdbcType=VARCHAR},-->
|
||||
<!-- F_User_Id = #{fUserId,jdbcType=VARCHAR},-->
|
||||
<!-- F_Balance = #{fBalance,jdbcType=DECIMAL},-->
|
||||
<!-- F_Total = #{fTotal,jdbcType=DECIMAL},-->
|
||||
<!-- F_Unit = #{fUnit,jdbcType=BIT},-->
|
||||
<!-- F_Expire_Time = #{fExpireTime,jdbcType=TIMESTAMP},-->
|
||||
<!-- F_Grant_Way = #{fGrantWay,jdbcType=BIT},-->
|
||||
<!-- F_State = #{fState,jdbcType=BIT},-->
|
||||
<!-- F_Over = #{fOver,jdbcType=BIT},-->
|
||||
<!-- F_Paid = #{fPaid,jdbcType=BIT},-->
|
||||
<!-- F_CreatorUserId = #{fCreatoruserid,jdbcType=VARCHAR},-->
|
||||
<!-- F_CreatorTime = #{fCreatortime,jdbcType=TIMESTAMP},-->
|
||||
<!-- F_LastModifyUserId = #{fLastmodifyuserid,jdbcType=VARCHAR},-->
|
||||
<!-- F_LastModifyTime = #{fLastmodifytime,jdbcType=TIMESTAMP},-->
|
||||
<!-- F_DeleteMark = #{fDeletemark,jdbcType=INTEGER},-->
|
||||
<!-- F_DeleteTime = #{fDeletetime,jdbcType=TIMESTAMP},-->
|
||||
<!-- F_DeleteUserId = #{fDeleteuserid,jdbcType=VARCHAR},-->
|
||||
<!-- F_TenantId = #{fTenantid,jdbcType=VARCHAR}-->
|
||||
<!-- where F_Id = #{fId,jdbcType=VARCHAR}-->
|
||||
<!-- </update>-->
|
||||
|
||||
<select id="getBalanceByApplyIds" resultType="jnpf.model.attendance.model.BalanceRecord">
|
||||
SELECT
|
||||
fabur.F_Unit b_F_Unit,
|
||||
fabur.F_Quota b_F_Quota,
|
||||
fabr.F_Paid b_F_Paid,
|
||||
fabur.F_Object_Id id
|
||||
FROM ftb_attendance_balance_use_record fabur
|
||||
LEFT JOIN ftb_attendance_balance_record fabr ON fabr.F_Id = fabur.F_Balance_Id
|
||||
WHERE F_DeleteMark = 0 AND fabur.F_Use_Type = 0
|
||||
AND fabur.F_Object_Id IN
|
||||
<foreach collection="applyIds"
|
||||
item="id" index="index" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
GROUP BY fabr.F_User_Id ,fabur.F_Unit
|
||||
</select>
|
||||
<!-- 获取用户余额-->
|
||||
<select id="getStraightBalanceList" resultType="jnpf.entity.attendance.AttendanceStorageRest">
|
||||
SELECT F_User_Id userId,SUM(F_Balance) num
|
||||
FROM ftb_attendance_balance_record
|
||||
WHERE F_State = 0 AND F_Type = 3 AND F_State = 0 AND F_Over = 0 AND F_DeleteMark = 0
|
||||
GROUP BY F_User_Id
|
||||
</select>
|
||||
<select id="getOvertimeBalanceInfo" resultType="jnpf.model.attendance.model.OvertimeBalanceModel">
|
||||
SELECT
|
||||
fabr.F_User_Id userId,
|
||||
SUM(CASE WHEN fabr.F_OverTime = 1 THEN fabr.F_Total ELSE 0 END) weekdayOvertimeDays,
|
||||
SUM(CASE WHEN fabr.F_OverTime = 1 THEN fabr.F_Balance ELSE 0 END) weekdayOvertimeResidueDays,
|
||||
SUM(CASE WHEN fabr.F_OverTime = 3 THEN fabr.F_Total ELSE 0 END) holidaysOvertimeDays,
|
||||
SUM(CASE WHEN fabr.F_OverTime = 3 THEN fabr.F_Balance ELSE 0 END) holidaysOvertimeResidueDays,
|
||||
SUM(CASE WHEN fabr.F_OverTime = 2 THEN fabr.F_Total ELSE 0 END) publicHolidaysOvertimeDays,
|
||||
SUM(CASE WHEN fabr.F_OverTime = 2 THEN fabr.F_Balance ELSE 0 END) publicHolidaysOvertimeResidueDays
|
||||
FROM ftb_attendance_balance_record fabr
|
||||
WHERE fabr.F_State = 0
|
||||
AND fabr.F_Type = 3
|
||||
AND fabr.F_DeleteMark = 0
|
||||
AND fabr.F_Object_Id IS NOT NULL
|
||||
AND fabr.F_OverTimeDay between #{startDate} and #{endDate}
|
||||
AND fabr.F_User_Id IN
|
||||
<foreach collection="userIds"
|
||||
item="id" index="index" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
GROUP BY fabr.F_User_Id
|
||||
</select>
|
||||
<select id="getSurplusDaysInfo" resultType="jnpf.model.attendance.model.SurplusDaysModel">
|
||||
SELECT
|
||||
fabr.F_User_Id userId,
|
||||
SUM(fabr.F_Balance) surplusDays
|
||||
FROM ftb_attendance_balance_record fabr
|
||||
WHERE fabr.F_State = 0
|
||||
AND fabr.F_Type = 3
|
||||
AND fabr.F_DeleteMark = 0
|
||||
AND fabr.F_User_Id IN
|
||||
<foreach collection="userIds"
|
||||
item="id" index="index" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
GROUP BY fabr.F_User_Id
|
||||
</select>
|
||||
|
||||
<select id="getOvertimeHolidaysInfo" resultType="jnpf.model.attendance.model.OvertimeHolidaysInfoModel">
|
||||
SELECT
|
||||
fabr.F_User_Id userId,
|
||||
fabr.F_FestivalStr holidayNameList,
|
||||
fabr.F_Total holidaysOvertimeDays
|
||||
FROM ftb_attendance_balance_record fabr
|
||||
WHERE fabr.F_State = 0
|
||||
AND fabr.F_Type = 3
|
||||
AND fabr.F_OverTime = 3
|
||||
AND fabr.F_FestivalStr is not null
|
||||
AND fabr.F_DeleteMark = 0
|
||||
AND fabr.F_OverTimeDay between #{startDate} and #{endDate}
|
||||
AND fabr.F_User_Id IN
|
||||
<foreach collection="userIds"
|
||||
item="id" index="index" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getLeaveBalanceInfo" resultType="jnpf.model.attendance.model.LeaveBalanceInfoModel">
|
||||
SELECT
|
||||
fabr.F_User_Id userId,
|
||||
fabr.F_Object_Id leaveTypeId,
|
||||
SUM(F_Balance) value
|
||||
FROM ftb_attendance_balance_record fabr
|
||||
WHERE fabr.F_Type = 2
|
||||
AND fabr.F_DeleteMark = 0
|
||||
AND fabr.F_State = 0
|
||||
AND (fabr.F_Expire_Time >= #{startDate} or fabr.F_Expire_Time is null)
|
||||
AND fabr.F_Object_Id is not null
|
||||
AND fabr.F_User_Id IN
|
||||
<foreach collection="userIds"
|
||||
item="id" index="index" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
GROUP BY fabr.F_User_Id,fabr.F_Object_Id
|
||||
</select>
|
||||
|
||||
<select id="getLeaveApprovalInfo" resultType="jnpf.model.attendance.model.LeaveApprovalModel">
|
||||
SELECT
|
||||
F_GroupId groupId,
|
||||
F_User_Id userId,
|
||||
F_Type_Id leaveTypeId,
|
||||
F_StartTime startTime,
|
||||
F_EndTime endTime,
|
||||
F_BalanceJsonNew balanceJson,
|
||||
F_ShiftInvolved shiftInvolved
|
||||
FROM ftb_attendance_leave_approve
|
||||
WHERE
|
||||
F_DeleteMark = 0
|
||||
AND F_Status = 1
|
||||
and F_BalanceJsonNew is not null
|
||||
AND F_User_Id IN
|
||||
<foreach collection="userIds"
|
||||
item="id" index="index" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND F_Id IN
|
||||
<foreach collection="leaveIds"
|
||||
item="id" index="index" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectInvalidationCoupons" resultType="jnpf.entity.attendance.AttendanceBalanceRecordEntity">
|
||||
SELECT F_Id id,
|
||||
F_Name name,
|
||||
F_Type type,
|
||||
F_Object_Id objectId,
|
||||
F_OverTime overTime,
|
||||
F_OverTimeDay overTimeDay,
|
||||
F_User_Id userId,
|
||||
F_Balance balance,
|
||||
F_Total total,
|
||||
F_Unit unit,
|
||||
F_Expire_Time expireTime,
|
||||
F_Grant_Way grantWay,
|
||||
F_State state,
|
||||
F_Over isOver,
|
||||
F_Paid paid
|
||||
FROM ftb_attendance_balance_record
|
||||
WHERE
|
||||
F_Expire_Time <![CDATA[ <= ]]> now()
|
||||
AND F_DeleteMark = 0 AND F_State = 0
|
||||
</select>
|
||||
|
||||
<!-- 删除当月存休-->
|
||||
<delete id="deleteByYearMonth">
|
||||
delete FROM ftb_attendance_storage_rest
|
||||
WHERE F_YearMonth = #{lastMonthDate}
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceBalanceUseRecordMapper" >
|
||||
|
||||
<sql id="Base_Column_List" >
|
||||
F_Id, F_Balance_Id, F_Quota, F_Unit, F_Use_Type, F_Object_Id ,F_Start_Time, F_End_Time, F_Lock,
|
||||
F_CreatorUserId, F_CreatorTime, F_TenantId
|
||||
</sql>
|
||||
<!-- 获取用户劵的使用劵详情-->
|
||||
<select id="getUserBalanceDetail" resultType="jnpf.model.doclibrary.vo.UseDetailVo">
|
||||
select F_Id id, F_Quota quota, F_Unit unit, F_Use_Type useType, F_Object_Id objectId, DATE_FORMAT(F_Start_Time,'%Y-%m-%d') startTime, DATE_FORMAT(F_End_Time,'%Y-%m-%d') endTime, F_CreatorTime createTime
|
||||
FROM ftb_attendance_balance_use_record
|
||||
where F_Balance_Id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="addOne">
|
||||
insert into ftb_attendance_balance_use_record (F_Id, F_Balance_Id, F_Quota,
|
||||
F_Unit, F_Use_Type,F_Object_Id, F_Start_Time, F_End_Time, F_Lock,F_CreatorTime)
|
||||
values (#{id}, #{balanceId}, #{quota},
|
||||
#{unit}, #{userType}, #{objectId}, #{startTime}, #{endTime}, #{lock}, now())
|
||||
</insert>
|
||||
<insert id="addBatch">
|
||||
insert into ftb_attendance_balance_use_record (F_Id, F_Balance_Id, F_Quota,
|
||||
F_Unit, F_Use_Type,F_Object_Id, F_Start_Time, F_End_Time, F_Lock,F_CreatorTime)
|
||||
values
|
||||
<foreach collection="useRecordList" item="item" index="index" separator="," >
|
||||
(#{item.id}, #{item.balanceId}, #{item.quota},
|
||||
#{item.unit}, #{item.useType}, #{item.objectId}, #{item.startTime}, #{item.endTime}, #{item.lock}, now())
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 查出本次排班相关的所有消费记录-->
|
||||
<select id="getUserBalanceListByObjectId" resultType="jnpf.model.doclibrary.vo.UseDetailVo">
|
||||
select F_Id id, F_Quota quota,F_Balance_Id balanceId
|
||||
FROM ftb_attendance_balance_use_record
|
||||
where F_Use_Type = #{userType} AND F_Object_Id = #{id}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByIds">
|
||||
delete from ftb_attendance_balance_use_record
|
||||
where F_Id in
|
||||
<foreach collection="userBalanceList" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<!-- <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >-->
|
||||
<!-- delete from ftb_attendance_balance_use_record-->
|
||||
<!-- where F_Id = #{fId,jdbcType=VARCHAR}-->
|
||||
<!-- </delete>-->
|
||||
<!-- <insert id="insert" parameterType="com.shs.cts.util.domain.po.experience.AttendanceBalanceUseRecord" >-->
|
||||
<!-- insert into ftb_attendance_balance_use_record (F_Id, F_Balance_Id, F_Quota, -->
|
||||
<!-- F_Unit, F_Approve_Id, F_Start_Time, -->
|
||||
<!-- F_End_Time, F_Lock, F_CreatorUserId, -->
|
||||
<!-- F_CreatorTime, F_TenantId)-->
|
||||
<!-- values (#{fId,jdbcType=VARCHAR}, #{fBalanceId,jdbcType=VARCHAR}, #{fQuota,jdbcType=DECIMAL}, -->
|
||||
<!-- #{fUnit,jdbcType=BIT}, #{fApproveId,jdbcType=VARCHAR}, #{fStartTime,jdbcType=TIMESTAMP}, -->
|
||||
<!-- #{fEndTime,jdbcType=TIMESTAMP}, #{fLock,jdbcType=BIT}, #{fCreatoruserid,jdbcType=VARCHAR}, -->
|
||||
<!-- #{fCreatortime,jdbcType=TIMESTAMP}, #{fTenantid,jdbcType=VARCHAR})-->
|
||||
<!-- </insert>-->
|
||||
<!-- -->
|
||||
<!-- <update id="updateByPrimaryKey" parameterType="com.shs.cts.util.domain.po.experience.AttendanceBalanceUseRecord" >-->
|
||||
<!-- update ftb_attendance_balance_use_record-->
|
||||
<!-- set F_Balance_Id = #{fBalanceId,jdbcType=VARCHAR},-->
|
||||
<!-- F_Quota = #{fQuota,jdbcType=DECIMAL},-->
|
||||
<!-- F_Unit = #{fUnit,jdbcType=BIT},-->
|
||||
<!-- F_Approve_Id = #{fApproveId,jdbcType=VARCHAR},-->
|
||||
<!-- F_Start_Time = #{fStartTime,jdbcType=TIMESTAMP},-->
|
||||
<!-- F_End_Time = #{fEndTime,jdbcType=TIMESTAMP},-->
|
||||
<!-- F_Lock = #{fLock,jdbcType=BIT},-->
|
||||
<!-- F_CreatorUserId = #{fCreatoruserid,jdbcType=VARCHAR},-->
|
||||
<!-- F_CreatorTime = #{fCreatortime,jdbcType=TIMESTAMP},-->
|
||||
<!-- F_TenantId = #{fTenantid,jdbcType=VARCHAR}-->
|
||||
<!-- where F_Id = #{fId,jdbcType=VARCHAR}-->
|
||||
<!-- </update>-->
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceBaseSettingMapper" >
|
||||
<!-- 获取出勤换算-->
|
||||
<select id="getAttendanceRatio" resultType="java.lang.Integer">
|
||||
SELECT F_AttendanceRatio FROM ftb_attendance_base_setting WHERE F_GroupId = (
|
||||
SELECT F_GroupId FROM ftb_attendance_group_user WHERE F_UserId = #{userId} AND F_Type = 1
|
||||
)
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceCardReplacementApproveMapper" >
|
||||
|
||||
|
||||
<sql id="Base_Column_List" >
|
||||
F_Id, F_User_Id, F_Object_Id, F_Reason, f_flowtaskid, f_flowid, F_UniqueId, F_TenantId
|
||||
</sql>
|
||||
<sql id="Blob_Column_List" >
|
||||
F_Picture
|
||||
</sql>
|
||||
|
||||
<!-- <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >-->
|
||||
<!-- delete from ftb_attendance_card_replacement_approve-->
|
||||
<!-- where F_Id = #{fId,jdbcType=VARCHAR}-->
|
||||
<!-- </delete>-->
|
||||
<!-- <insert id="insert" parameterType="com.shs.cts.util.domain.po.experience.AttendanceCardReplacementApprove" >-->
|
||||
<!-- insert into ftb_attendance_card_replacement_approve (F_Id, F_User_Id, F_Object_Id, -->
|
||||
<!-- F_Reason, f_flowtaskid, f_flowid, -->
|
||||
<!-- F_UniqueId, F_TenantId, F_Picture-->
|
||||
<!-- )-->
|
||||
<!-- values (#{fId,jdbcType=VARCHAR}, #{fUserId,jdbcType=VARCHAR}, #{fObjectId,jdbcType=VARCHAR}, -->
|
||||
<!-- #{fReason,jdbcType=VARCHAR}, #{fFlowtaskid,jdbcType=VARCHAR}, #{fFlowid,jdbcType=VARCHAR}, -->
|
||||
<!-- #{fUniqueid,jdbcType=VARCHAR}, #{fTenantid,jdbcType=VARCHAR}, #{fPicture,jdbcType=LONGVARCHAR}-->
|
||||
<!-- )-->
|
||||
<!-- </insert>-->
|
||||
<!-- -->
|
||||
<!-- -->
|
||||
<!-- <update id="updateByPrimaryKey" parameterType="com.shs.cts.util.domain.po.experience.AttendanceCardReplacementApprove" >-->
|
||||
<!-- update ftb_attendance_card_replacement_approve-->
|
||||
<!-- set F_User_Id = #{fUserId,jdbcType=VARCHAR},-->
|
||||
<!-- F_Object_Id = #{fObjectId,jdbcType=VARCHAR},-->
|
||||
<!-- F_Reason = #{fReason,jdbcType=VARCHAR},-->
|
||||
<!-- f_flowtaskid = #{fFlowtaskid,jdbcType=VARCHAR},-->
|
||||
<!-- f_flowid = #{fFlowid,jdbcType=VARCHAR},-->
|
||||
<!-- F_UniqueId = #{fUniqueid,jdbcType=VARCHAR},-->
|
||||
<!-- F_TenantId = #{fTenantid,jdbcType=VARCHAR}-->
|
||||
<!-- where F_Id = #{fId,jdbcType=VARCHAR}-->
|
||||
<!-- </update>-->
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,228 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceClockInMapper" >
|
||||
|
||||
<!-- 更新为缺勤 -->
|
||||
<update id="updateToAbsence">
|
||||
update ftb_attendance_clock_in_result
|
||||
set
|
||||
F_Absence = 1,
|
||||
F_LastAbsenceLeader = #{handleUser},
|
||||
F_LastModifyTime = now()
|
||||
where F_RuleId = #{ruleId} and F_UserId = #{userId} and F_DeleteMark = 0
|
||||
</update>
|
||||
<!-- 更新为不缺勤 -->
|
||||
<update id="updateToUnAbsence">
|
||||
update ftb_attendance_clock_in_result
|
||||
set
|
||||
F_Absence = 0,
|
||||
F_LastAbsenceLeader = #{handleUser},
|
||||
F_LastModifyTime = now()
|
||||
where F_RuleId = #{ruleId} and F_UserId = #{userId} and F_DeleteMark = 0
|
||||
</update>
|
||||
<!-- 删除审批中的打卡记录 -->
|
||||
<delete id="deleteBatchByUserDay">
|
||||
DELETE FROM ftb_attendance_clock_in a
|
||||
WHERE EXISTS (
|
||||
SELECT 1
|
||||
FROM (
|
||||
<foreach collection="list" item="item" separator=" UNION ALL ">
|
||||
SELECT #{item.dayStr} AS dayStr, #{item.userId} AS userId
|
||||
</foreach>
|
||||
) t
|
||||
WHERE a.F_Day = t.dayStr
|
||||
AND a.F_UserId = t.userId
|
||||
) AND a.F_ApprovalStatus = #{passApproval}
|
||||
</delete>
|
||||
<!-- 查询用户出勤结果 -->
|
||||
<select id="getClockInResultByRule" resultType="jnpf.model.attendance.vo.ClockInVo">
|
||||
select acis.F_Id id,acis.F_RuleId ruleId, acis.F_UserId userId, acis.F_ClockInId clockInId, aci.F_ClockInTime clockInTime, aci.F_ApprovalStatus approvalStatus,
|
||||
acis.F_EffectiveTime effectiveTime, acis.F_ClockInType clockInType, acis.F_ClockInStatus clockInStatus, acis.F_ClockInKind clockInKind,
|
||||
acis.F_Absence absence, acis.F_AbsenceLeader absenceLeader, acis.F_AbnormalMinute abnormalMinute, aci.F_Address address, aci.F_Lng lng, aci.F_Lat lat,
|
||||
aci.F_DeviceType deviceType, aci.F_DeviceId deviceId, aci.F_DeviceName deviceName, acis.F_ApplyType applyType, acis.F_ApplyId applyId, acis.F_Repaired repaired
|
||||
,aci.F_Remark remark
|
||||
from ftb_attendance_clock_in_result acis
|
||||
left join ftb_attendance_clock_in aci on acis.F_ClockInId = aci.F_Id
|
||||
JOIN (
|
||||
<foreach collection="list" item="item" separator=" UNION ALL ">
|
||||
SELECT #{item.ruleId} AS ruleId, #{item.userId} AS userId
|
||||
</foreach>
|
||||
) AS tmp ON acis.F_RuleId = tmp.ruleId AND acis.F_UserId = tmp.userId
|
||||
WHERE acis.F_DeleteMark = 0
|
||||
AND (aci.F_Id IS NULL OR aci.F_ApprovalStatus != 2)
|
||||
</select>
|
||||
<!-- 查询用户出勤结果 -->
|
||||
<select id="getClockInResultByRuleList" resultType="jnpf.model.attendance.vo.ClockInVo">
|
||||
select acis.F_Id id, acis.F_RuleId ruleId, acis.F_UserId userId, acis.F_ClockInId clockInId, aci.F_ClockInTime clockInTime, aci.F_ApprovalStatus approvalStatus,
|
||||
acis.F_EffectiveTime effectiveTime, acis.F_ClockInType clockInType, acis.F_ClockInStatus clockInStatus, acis.F_ClockInKind clockInKind, acis.F_Repaired repaired,
|
||||
acis.F_Absence absence, acis.F_AbsenceLeader absenceLeader, acis.F_AbnormalMinute abnormalMinute, acis.F_ApplyId applyId, aci.F_Address address, aci.F_Lng lng, aci.F_Lat lat,
|
||||
aci.F_DeviceType deviceType, aci.F_DeviceId deviceId, aci.F_DeviceName deviceName , aci.F_Remark remark, r.F_ApplyId AS associationApplyId, r.F_GroupId groupId
|
||||
from ftb_attendance_clock_in_result acis
|
||||
left join ftb_attendance_clock_in aci on acis.F_ClockInId = aci.F_Id
|
||||
LEFT JOIN ftb_attendance_daily_rule r ON r.F_Id = acis.F_RuleId
|
||||
where acis.F_DeleteMark = 0 and (aci.F_Id is null or aci.F_ApprovalStatus != 2)
|
||||
and acis.F_RuleId in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- 查询时间段内的补卡次数 -->
|
||||
<select id="getRepairCount" resultType="java.lang.Integer">
|
||||
select count(*) from (
|
||||
select acis.F_Repaired repaired, case acis.F_ClockInType when 1 then adr.F_InPoint when 2 then adr.F_OutPoint else '' end workTime
|
||||
from ftb_attendance_clock_in_result acis
|
||||
left join ftb_attendance_clock_in aci on acis.F_ClockInId = aci.F_Id
|
||||
left join ftb_attendance_daily_rule adr on acis.F_RuleId = adr.F_Id
|
||||
where acis.F_DeleteMark = 0 and acis.F_RuleId in (
|
||||
select F_Id from ftb_attendance_daily_rule where F_GroupId = #{groupId} and F_ApplyViewEnable = 1 and F_DeleteMark = 0
|
||||
) and acis.F_UserId = #{userId} and (aci.F_DeleteMark is null or aci.F_DeleteMark = 0)
|
||||
) t where repaired = 1
|
||||
<![CDATA[
|
||||
and DATE_FORMAT(workTime, '%Y-%m-%d') >= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
|
||||
and DATE_FORMAT(workTime, '%Y-%m-%d') < DATE_FORMAT(#{endTime}, '%Y-%m-%d')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 查询考勤组本月异常打卡记录 -->
|
||||
<select id="getAbnormalClockInList" resultType="jnpf.model.attendance.vo.AbnormalClockInVo">
|
||||
select id, clockInType, ruleId, clockInId, `day`, workTime, clockInTime, clockInStatus, absence from (
|
||||
select acir.F_Id id, acir.F_ClockInType clockInType, acir.F_RuleId ruleId, acir.F_ClockInId clockInId, adr.F_Day `day`,
|
||||
case acir.F_ClockInType when 1 then adr.F_InPoint when 2 then adr.F_OutPoint else '' end workTime,
|
||||
aci.F_ClockInTime clockInTime, acir.F_ClockInStatus clockInStatus, acir.F_Absence absence, acir.F_AbsenceLeader absenceLeader
|
||||
from ftb_attendance_clock_in_result acir
|
||||
left join ftb_attendance_clock_in aci on acir.F_ClockInId = aci.F_Id
|
||||
left join ftb_attendance_daily_rule adr on acir.F_RuleId = adr.F_Id
|
||||
where acir.F_UserId = #{userId} and acir.F_DeleteMark = 0 and (aci.F_DeleteMark is null or aci.F_DeleteMark = 0)
|
||||
and ifnull(length(acir.F_ApplyId), 0) = 0
|
||||
<if test="absenceType == 0">
|
||||
and acir.F_Absence = 0 and acir.F_ClockInStatus in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="absenceType == 1">
|
||||
and (acir.F_Absence = 1 or acir.F_ClockInStatus in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
and acir.F_RuleId in (
|
||||
select F_Id from ftb_attendance_daily_rule where F_GroupId = #{groupId} and F_ApplyViewEnable in (1, 10) and F_DeleteMark = 0
|
||||
) and adr.F_Id is not null
|
||||
) t where
|
||||
<![CDATA[
|
||||
DATE_FORMAT(workTime, '%Y-%m-%d') >= DATE_FORMAT(#{monthBeginDate}, '%Y-%m-%d')
|
||||
and DATE_FORMAT(workTime, '%Y-%m-%d') <= DATE_FORMAT(#{monthEndDate}, '%Y-%m-%d')
|
||||
]]>
|
||||
order by t.day desc, t.clockInType asc
|
||||
</select>
|
||||
<!-- 查询当日所有打卡记录 -->
|
||||
<select id="getListByRuleAndDate" resultType="jnpf.model.attendance.vo.DailyClockInVo">
|
||||
select ci.F_Id clockInId, ci.F_ClockInTime clockInTime, ci.F_Address clockInPlace, F_DeviceType clockInMethod, t.F_RuleId ruleId, ifnull(t.F_DeleteMark, 1) deleteMark
|
||||
from ftb_attendance_clock_in ci
|
||||
left join (
|
||||
select F_ClockInId, F_RuleId, F_DeleteMark from ftb_attendance_clock_in_result cir
|
||||
where cir.F_RuleId in (
|
||||
select F_Id from ftb_attendance_daily_rule where F_UserId = #{userId} and F_Day = #{queryDate} and F_DeleteMark = 0
|
||||
)
|
||||
) t on t.F_ClockInId = ci.F_Id
|
||||
where ci.F_DeleteMark = 0 and ci.F_ApprovalStatus = 0 and ci.F_Day = #{queryDate} and ci.F_UserId = #{userId}
|
||||
order by ci.F_CreatorTime asc
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 查询用户出勤打卡记录 -->
|
||||
<select id="getClockInByStatistics" resultType="jnpf.model.attendance.model.ClockClassRecord">
|
||||
SELECT
|
||||
acis.F_DeleteMark,
|
||||
aci.F_Day AS `day`,
|
||||
acis.F_Id AS id,
|
||||
acis.F_RuleId AS ruleId,
|
||||
acis.F_UserId AS userId,
|
||||
aci.F_Id AS clockInId,
|
||||
aci.F_ClockInTime AS clockInTime,
|
||||
aci.F_ApprovalStatus AS approvalStatus,
|
||||
acis.F_EffectiveTime AS effectiveTime,
|
||||
acis.F_ClockInType AS clockInType,
|
||||
acis.F_ClockInStatus AS clockInStatus,
|
||||
acis.F_ClockInKind AS clockInKind,
|
||||
acis.F_Repaired AS repaired,
|
||||
acis.F_Absence AS absence,
|
||||
acis.F_AbsenceLeader AS absenceLeader,
|
||||
acis.F_AbnormalMinute AS abnormalMinute,
|
||||
acis.F_ApplyId AS applyId,
|
||||
aci.F_Address AS address,
|
||||
aci.F_Lng AS lng,
|
||||
aci.F_Lat AS lat,
|
||||
aci.F_DeviceType AS deviceType,
|
||||
aci.F_DeviceId AS deviceId,
|
||||
aci.F_DeviceName AS deviceName
|
||||
FROM
|
||||
ftb_attendance_clock_in aci
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
r.*
|
||||
FROM
|
||||
ftb_attendance_clock_in_result r
|
||||
LEFT JOIN ftb_attendance_daily_rule dr ON dr.F_Id = r.F_RuleId
|
||||
WHERE
|
||||
r.F_UserId = #{userId}
|
||||
AND dr.F_Day = #{queryDate}
|
||||
AND r.F_DeleteMark = 0
|
||||
) acis ON acis.F_ClockInId = aci.F_Id
|
||||
WHERE
|
||||
aci.F_Day = #{queryDate}
|
||||
AND aci.F_UserId = #{userId}
|
||||
AND aci.F_DeleteMark = 0
|
||||
AND aci.F_ApprovalStatus = 0
|
||||
ORDER BY
|
||||
aci.F_CreatorTime
|
||||
</select>
|
||||
<!-- 批量查询当日所有打卡记录-->
|
||||
<select id="getClockInList" resultType="jnpf.model.attendance.model.ClockClassRecord">
|
||||
select aci.F_Day `day`, acis.F_Id id, acis.F_RuleId ruleId, aci.F_UserId userId, aci.F_Id clockInId, aci.F_ClockInTime clockInTime, aci.F_ApprovalStatus approvalStatus,
|
||||
acis.F_EffectiveTime effectiveTime, acis.F_ClockInType clockInType, acis.F_ClockInStatus clockInStatus, acis.F_ClockInKind clockInKind, acis.F_Repaired repaired,
|
||||
acis.F_Absence absence, acis.F_AbsenceLeader absenceLeader, acis.F_AbnormalMinute abnormalMinute, acis.F_ApplyId applyId, aci.F_Address address, aci.F_Lng lng, aci.F_Lat lat,
|
||||
|
||||
aci.F_DeviceType deviceType, aci.F_DeviceId deviceId, aci.F_DeviceName deviceName
|
||||
from ftb_attendance_clock_in aci
|
||||
left join ftb_attendance_clock_in_result acis on acis.F_ClockInId = aci.F_Id
|
||||
where ifnull(acis.F_DeleteMark, 0) = 0 and aci.F_DeleteMark = 0 and aci.F_ApprovalStatus = 0
|
||||
<![CDATA[ and DATE_FORMAT(aci.F_Day, '%Y-%m-%d') >= DATE_FORMAT(#{start}, '%Y-%m-%d') ]]>
|
||||
<![CDATA[ and DATE_FORMAT(aci.F_Day, '%Y-%m-%d') <= DATE_FORMAT(#{end}, '%Y-%m-%d') ]]>
|
||||
and aci.F_UserId in
|
||||
<foreach collection="userIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
order by aci.F_CreatorTime asc
|
||||
</select>
|
||||
<!-- 查询打卡记录[批量] -->
|
||||
<select id="selectListBatch" resultType="jnpf.entity.attendance.FtbAttendanceClockIn">
|
||||
select
|
||||
ac.F_Id AS id,
|
||||
ac.F_Day AS `day`,
|
||||
ac.F_UserId AS userId,
|
||||
ac.F_ClockInTime AS clockInTime,
|
||||
ac.F_ApprovalCode AS approvalCode,
|
||||
ac.F_ApprovalStatus AS approvalStatus,
|
||||
ac.F_RelationId AS relationId,
|
||||
ac.F_Address AS address,
|
||||
ac.F_Lng AS lng,
|
||||
ac.F_Lat AS lat,
|
||||
ac.F_ClockInKind AS clockInKind,
|
||||
ac.F_DeviceType AS deviceType,
|
||||
ac.F_DeviceId AS deviceId,
|
||||
ac.F_DeviceName AS deviceName,
|
||||
ac.F_Remark AS remark
|
||||
from ftb_attendance_clock_in ac
|
||||
join (
|
||||
<foreach collection="list" item="ud" separator="," open="values" close="">
|
||||
row(#{ud.userId}, #{ud.dayStr})
|
||||
</foreach>
|
||||
) v(userId, `day`)
|
||||
on ac.F_UserId = v.userId and ac.F_Day = v.`day`
|
||||
where ac.F_DeleteMark = 0
|
||||
and ac.F_ApprovalStatus = #{approvalStatus}
|
||||
order by ac.F_ClockInTime asc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,289 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceClockInResultMapper" >
|
||||
|
||||
<!-- 批量更新记录为删除 -->
|
||||
<update id="updateBatchToDel">
|
||||
update ftb_attendance_clock_in_result
|
||||
set
|
||||
F_DeleteMark = 1,
|
||||
F_DeleteTime = now()
|
||||
where F_Id in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
<!-- 更新申请信息为空 -->
|
||||
<update id="updateReplyToNull">
|
||||
update ftb_attendance_clock_in_result
|
||||
set
|
||||
F_ApplyId = null,
|
||||
F_ApplyType = null
|
||||
where F_ClockInId = #{clockInId} and F_ApplyId = #{applyId}
|
||||
</update>
|
||||
<!-- 更新审批为空 -->
|
||||
<update id="updateResultReplyToNull">
|
||||
update ftb_attendance_clock_in_result
|
||||
set
|
||||
F_ApplyId = null,
|
||||
F_ApplyType = null,
|
||||
F_AbsenceLeader = #{dealUser}
|
||||
where F_Id = #{id}
|
||||
</update>
|
||||
<!-- 根据出勤规则删除打卡结果 -->
|
||||
<update id="updateToDelByRule">
|
||||
update ftb_attendance_clock_in_result
|
||||
set
|
||||
F_DeleteMark = 1,
|
||||
F_DeleteUserId = #{updateUserId},
|
||||
F_DeleteTime = now()
|
||||
where F_RuleId in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
<!-- 更新缺勤为正常 -->
|
||||
<update id="updateAbsenceToNormal">
|
||||
update ftb_attendance_clock_in_result set F_Absence = 0 where F_Id = #{id}
|
||||
</update>
|
||||
<!-- 更新为缺勤 -->
|
||||
<update id="updateToAbsence">
|
||||
update ftb_attendance_clock_in_result set F_Absence = 1 where F_Id = #{id}
|
||||
</update>
|
||||
<!-- 根据出勤规则删除打卡结果 -->
|
||||
<update id="removeClockInResultByRule">
|
||||
update ftb_attendance_clock_in_result set F_DeleteMark = 1, F_LastModifyTime = now() where F_RuleId in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
<!-- 变更打卡结果绑定的rule -->
|
||||
<update id="updateResultRelation">
|
||||
update ftb_attendance_clock_in_result set F_RuleId = #{ruleId} where F_Id = #{resultId}
|
||||
</update>
|
||||
<!-- 更新为缺勤[批量] -->
|
||||
<update id="updateToAbsenceBatch">
|
||||
update ftb_attendance_clock_in_result set F_Absence = 1
|
||||
where F_Id in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
<!-- 根据出勤规则删除用户的打卡结果 -->
|
||||
<delete id="deleteRecordByRule">
|
||||
update ftb_attendance_clock_in_result
|
||||
set
|
||||
F_DeleteMark = 1,
|
||||
F_DeleteUserId = #{updateUserId},
|
||||
F_DeleteTime = now()
|
||||
where F_UserId = #{userId} and F_RuleId in (
|
||||
select t.ruleId from (
|
||||
select distinct acir.F_RuleId ruleId from ftb_attendance_clock_in_result acir
|
||||
left join ftb_attendance_daily_rule adr on acir.F_RuleId = adr.F_Id
|
||||
where acir.F_UserId = #{userId} and adr.F_Id is null and acir.F_DeleteMark = 0
|
||||
) t
|
||||
)
|
||||
</delete>
|
||||
<!-- 根据出勤规则删除用户的打卡结果[批量] -->
|
||||
<delete id="deleteRecordByRuleBatch">
|
||||
UPDATE ftb_attendance_clock_in_result acir
|
||||
LEFT JOIN ftb_attendance_daily_rule adr ON acir.F_RuleId = adr.F_Id
|
||||
SET
|
||||
acir.F_DeleteMark = 1,
|
||||
acir.F_DeleteUserId = #{updateUserId},
|
||||
acir.F_DeleteTime = NOW()
|
||||
WHERE acir.F_UserId IN
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND acir.F_DeleteMark = 0
|
||||
AND adr.F_Id IS NULL
|
||||
</delete>
|
||||
<!-- 根据条件查询用户打卡记录 -->
|
||||
<select id="selectUserClockInHistory" resultType="jnpf.entity.attendance.AttendanceClockInResult">
|
||||
select acis.F_Id id, acis.F_RuleId ruleId, acis.F_UserId userId, acis.F_ClockInId clockInId, acis.F_ClockInType clockInType, acis.F_DeleteMark deleteMark, ifnull(aci.F_ApprovalStatus, 0) approvalStatus
|
||||
from ftb_attendance_daily_rule r
|
||||
left join ftb_attendance_clock_in_result acis on r.F_Id = acis.F_RuleId
|
||||
left join ftb_attendance_clock_in aci on acis.F_ClockInId = aci.F_Id
|
||||
where date_format(r.F_Day,'%Y-%m-%d') = date_format(date_sub(#{dateStr}, interval 1 day),'%Y-%m-%d')
|
||||
and r.F_DeleteMark = 0 and r.F_ApplyViewEnable in (1, 3, 9, 10) and acis.F_ClockInId is not null
|
||||
and (date_format(r.F_InLackPoint,'%Y-%m-%d') = date_format(#{dateStr},'%Y-%m-%d') or date_format(r.F_OutLackPoint,'%Y-%m-%d') = date_format(#{dateStr},'%Y-%m-%d'))
|
||||
union all
|
||||
select acis.F_Id id, acis.F_RuleId ruleId, acis.F_UserId userId, acis.F_ClockInId clockInId, acis.F_ClockInType clockInType, acis.F_DeleteMark deleteMark, ifnull(aci.F_ApprovalStatus, 0) approvalStatus
|
||||
from ftb_attendance_clock_in_result acis
|
||||
left join ftb_attendance_clock_in aci on acis.F_ClockInId = aci.F_Id
|
||||
where date_format(F_ClockInTime,'%Y-%m-%d') = date_format(#{dateStr},'%Y-%m-%d')
|
||||
</select>
|
||||
<!-- 判断是否缺勤 -->
|
||||
<select id="countAbsence" resultType="java.lang.Integer">
|
||||
select count(*) from ftb_attendance_clock_in_result
|
||||
where F_RuleId = #{ruleId} and F_UserId = #{userId} and F_DeleteMark = 0 and F_Absence = 1 and length(ifnull(F_AbsenceLeader, '')) > 0
|
||||
</select>
|
||||
<!-- 查询已存在的打卡结果 -->
|
||||
<select id="selectExistRecord" resultType="jnpf.entity.attendance.AttendanceClockInResult">
|
||||
SELECT F_Id id, F_RuleId ruleId, F_UserId userId, F_ClockInType clockInType
|
||||
FROM ftb_attendance_clock_in_result
|
||||
WHERE F_DeleteMark = 0
|
||||
<choose>
|
||||
<when test="containsType == 1">
|
||||
AND (F_RuleId, F_UserId, F_ClockInType) IN
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")">
|
||||
(#{item.ruleId}, #{item.userId}, #{item.clockInType})
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
AND (F_RuleId, F_UserId) IN
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")">
|
||||
(#{item.ruleId}, #{item.userId})
|
||||
</foreach>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<!-- 查询跨天的打卡id -->
|
||||
<select id="getCrossDayClockInIdList" resultType="java.lang.String">
|
||||
select F_Id from ftb_attendance_clock_in where F_Id in (
|
||||
select F_ClockInId from ftb_attendance_clock_in_result where F_ApprovalStatus = 0 and F_DeleteMark = 0 and F_RuleId in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
<![CDATA[
|
||||
and DATE_FORMAT(F_Day,'%Y-%m-%d') > DATE_FORMAT(#{day},'%Y-%m-%d')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 查询跨天的打卡id[批量] -->
|
||||
<select id="getCrossDayClockInIdListBatch" resultType="string">
|
||||
select ac.F_Id
|
||||
from ftb_attendance_clock_in ac
|
||||
join (
|
||||
<foreach collection="list" item="item" separator="," open="values" close="">
|
||||
row(#{item.ruleId}, #{item.day})
|
||||
</foreach>
|
||||
) v(ruleId, `day`)
|
||||
on exists (
|
||||
select 1
|
||||
from ftb_attendance_clock_in_result r
|
||||
where r.F_RuleId = v.ruleId
|
||||
and r.F_ClockInId = ac.F_Id
|
||||
and ac.F_ApprovalStatus = 0
|
||||
and r.F_DeleteMark = 0
|
||||
)
|
||||
where ac.F_Day > v.`day`
|
||||
</select>
|
||||
<!-- 查询打卡结果是否在审批中 -->
|
||||
<select id="getReplyingCount" resultType="java.lang.Integer">
|
||||
select count(*) from ftb_attendance_clock_in_result where F_Id = #{clockInResultId} and F_DeleteMark = 0 and F_ApplyId is not null
|
||||
</select>
|
||||
<select id="selectUserClockInResult" resultType="jnpf.model.attendance.vo.ChangeInfoVo">
|
||||
select result.F_ClockInType clockInType,
|
||||
if(result.F_ClockInType = 1, rule.F_InPoint, rule.F_OutPoint) shiftTime,
|
||||
result.F_Id clockInResultId,
|
||||
DATE_FORMAT(rule.F_Day, '%Y-%m-%d') `day`,
|
||||
if(result.F_Absence = 1, 4, result.F_ClockInStatus) clockInStatus,
|
||||
clock.F_ClockInTime clockInTime
|
||||
from ftb_attendance_clock_in_result result
|
||||
inner join
|
||||
(select F_Id
|
||||
, F_InStepOutType
|
||||
, F_OutStepOutType
|
||||
, F_InPoint
|
||||
, F_OutPoint
|
||||
, F_Day
|
||||
from ftb_attendance_daily_rule rule
|
||||
where rule.F_DeleteMark = 0
|
||||
and rule.F_UserId = #{userId}
|
||||
and rule.F_GroupId = #{groupId}
|
||||
and rule.F_AttendanceType = 1
|
||||
and rule.F_ApplyViewEnable in (1, 3, 9, 10)
|
||||
and rule.F_Day BETWEEN #{start} and #{end}) rule
|
||||
on result.F_RuleId = rule.F_Id
|
||||
left join ftb_attendance_clock_in clock on result.F_ClockInId = clock.F_Id
|
||||
where result.F_ClockInStatus != -2 and result.F_ClockInKind = 1 and result.F_DeleteMark = 0 and if (result.F_ClockInType = 1, rule.F_InStepOutType, rule.F_OutStepOutType) = 0
|
||||
order by rule.F_Day DESC, result.F_ClockInType asc
|
||||
</select>
|
||||
<!-- 根据用户和日期查询打卡结果 -->
|
||||
<select id="getByUserAndDay" resultType="java.lang.String">
|
||||
select distinct F_RuleId ruleId from ftb_attendance_clock_in_result
|
||||
where F_UserId = #{userId}
|
||||
and DATE_FORMAT(F_CreatorTime,'%Y-%m-%d') = DATE_FORMAT(#{date},'%Y-%m-%d')
|
||||
and F_DeleteMark = 0
|
||||
</select>
|
||||
<!-- 获取用户打卡天数-->
|
||||
<select id="getClockInDayNum" resultType="java.lang.Integer">
|
||||
SELECT COUNT(DISTINCT(dr.F_Day))
|
||||
FROM ftb_attendance_daily_rule dr
|
||||
LEFT JOIN ftb_attendance_clock_in_result r ON r.F_RuleId = dr.F_Id
|
||||
WHERE r.F_UserId = #{userId} AND r.F_ClockInStatus IN (1,2,3)
|
||||
AND r.F_DeleteMark = 0 AND dr.F_DeleteMark = 0
|
||||
</select>
|
||||
<!-- 获取用户迟到次数-->
|
||||
<select id="getLateClockInNum" resultType="java.lang.Integer">
|
||||
SELECT COUNT(DISTINCT (F_UserId))
|
||||
FROM ftb_attendance_clock_in_result
|
||||
WHERE F_DeleteMark = 0 AND F_ClockInStatus = 2
|
||||
AND F_RuleId IN
|
||||
<foreach collection="dayRuleIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- 查询补卡审批中次数 -->
|
||||
<select id="selectRepairApplyCount" resultType="java.lang.Integer">
|
||||
select count(*) from ftb_attendance_clock_in_result ir
|
||||
left join ftb_attendance_daily_rule dr on ir.F_RuleId = dr.F_Id
|
||||
left join ftb_apply_attendance_repair r on r.F_Id = ir.F_ApplyId
|
||||
where ir.F_UserId = #{userId} and ir.F_DeleteMark = 0 and ir.F_ApplyId is not null and ir.F_ApplyType = 1
|
||||
and dr.F_GroupId = #{groupId}
|
||||
<![CDATA[
|
||||
and DATE_FORMAT(r.F_ApplyDate,'%Y-%m-%d') >= #{beginDate}
|
||||
and DATE_FORMAT(r.F_ApplyDate,'%Y-%m-%d') <= #{endDate}
|
||||
]]>
|
||||
</select>
|
||||
<!-- 根据打卡ids查询打卡结果 -->
|
||||
<select id="selectBatchByClockInIds" resultType="jnpf.entity.attendance.AttendanceClockInResult">
|
||||
SELECT
|
||||
x.F_Id AS id,
|
||||
x.F_RuleId AS ruleId,
|
||||
x.F_UserId AS userId,
|
||||
x.F_ClockInId AS clockInId,
|
||||
x.F_EffectiveTime AS effectiveTime,
|
||||
x.F_ClockInType AS clockInType,
|
||||
x.F_ClockInStatus AS clockInStatus,
|
||||
x.F_ClockInKind AS clockInKind,
|
||||
x.F_Repaired AS repaired,
|
||||
x.F_ApplyType AS applyType,
|
||||
x.F_ApplyId AS applyId,
|
||||
x.F_Absence AS absence,
|
||||
x.F_AbsenceLeader AS absenceLeader,
|
||||
x.F_LastAbsenceLeader AS lastAbsenceLeader,
|
||||
x.F_RestMinute AS restMinute,
|
||||
x.F_AbnormalMinute AS abnormalMinute
|
||||
FROM (
|
||||
SELECT
|
||||
t.F_Id, t.F_RuleId, t.F_UserId, t.F_ClockInId, t.F_EffectiveTime, t.F_ClockInType, t.F_ClockInStatus, t.F_ClockInKind,
|
||||
t.F_Repaired, t.F_ApplyType, t.F_ApplyId, t.F_Absence, t.F_AbsenceLeader, t.F_LastAbsenceLeader, t.F_RestMinute, t.F_AbnormalMinute,
|
||||
ROW_NUMBER() OVER (PARTITION BY F_ClockInId ORDER BY F_CreatorTime DESC) rn
|
||||
FROM ftb_attendance_clock_in_result t
|
||||
WHERE t.F_DeleteMark = 0 and t.F_ClockInId IN
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
) x
|
||||
WHERE x.rn = 1
|
||||
</select>
|
||||
<!-- 查询需要更新为缺勤的打卡结果 -->
|
||||
<select id="selectRuleIdsForAbsence" resultType="jnpf.model.attendance.vo.ConditionVo">
|
||||
SELECT DISTINCT r.F_Id resultId, r.F_RuleId ruleId
|
||||
FROM ftb_attendance_clock_in_result r
|
||||
LEFT JOIN ftb_attendance_daily_rule dr on r.F_RuleId = dr.F_Id
|
||||
WHERE
|
||||
r.F_ClockInStatus = -1
|
||||
AND r.F_DeleteMark = 0
|
||||
AND dr.F_AttendanceType != 4
|
||||
<if test="list != null and list.size() > 0">
|
||||
AND (F_RuleId, F_ClockInType) IN
|
||||
<foreach collection="list" item="c" separator="," open="(" close=")">
|
||||
(#{c.ruleId}, #{c.workType})
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,68 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceConfirmMapper">
|
||||
<sql id="staticsWhere">
|
||||
<where>
|
||||
<if test=" year!= null">
|
||||
AND fac.F_Year = #{year}
|
||||
</if>
|
||||
<if test=" month!= null">
|
||||
AND fac.F_Month = #{month}
|
||||
</if>
|
||||
<if test="userIds!= null and userIds.size()>0">
|
||||
and fac.F_UserId in
|
||||
<foreach collection="userIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="type!= null">
|
||||
<choose>
|
||||
<when test="type == 1">
|
||||
AND fac.F_Status = 2
|
||||
</when>
|
||||
<when test="type == 2">
|
||||
AND fac.F_Status in(0,1)
|
||||
</when>
|
||||
<when test="type == 3">
|
||||
AND fac.F_Status = 0
|
||||
</when>
|
||||
<when test="type == 4">
|
||||
AND fac.F_Status = 1
|
||||
</when>
|
||||
<otherwise>
|
||||
and 1=1
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
<select id="getStatistics" resultType="jnpf.model.attendance.vo.attendance.ConfirmStatisticsVo">
|
||||
SELECT
|
||||
COUNT(fac.F_Id) total,
|
||||
COALESCE(SUM(IF(fac.F_Status = 2, 1, 0)),0) confirmed,
|
||||
COALESCE(SUM(IF(fac.F_Status = 0 or fac.F_Status = 1, 1, 0)),0) toDoConfirm,
|
||||
COALESCE(SUM(IF(fac.F_Status = 0 , 1, 0)),0) noViewed,
|
||||
COALESCE(SUM(IF(fac.F_Status = 1, 1, 0)),0) yesViewed
|
||||
FROM ftb_attendance_confirm fac
|
||||
<include refid="staticsWhere"/>
|
||||
</select>
|
||||
<select id="getPageList" resultType="jnpf.model.attendance.vo.attendance.ConfirmListQueryVo">
|
||||
SELECT
|
||||
fac.F_Id id,
|
||||
fac.F_UserId userId,
|
||||
fac.F_Year `year`,
|
||||
fac.F_Month `month`,
|
||||
fac.F_Status `status`
|
||||
FROM ftb_attendance_confirm fac
|
||||
left JOIN (
|
||||
SELECT
|
||||
fagu.F_UserId,
|
||||
fagu.F_GroupId
|
||||
FROM
|
||||
ftb_attendance_group_user fagu where fagu.F_DeleteMark = 0 and fagu.F_Type = 1
|
||||
GROUP BY fagu.F_UserId
|
||||
) fag ON fac.F_UserId = fag.F_UserId
|
||||
<include refid="staticsWhere"/>
|
||||
order by fag.F_GroupId desc,fac.F_Status
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,319 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceDailyRuleMapper" >
|
||||
|
||||
<!-- 查询昨天和今天的出勤规则 -->
|
||||
<select id="getRuleClockTimeContainsToday" resultType="jnpf.entity.attendance.FtbAttendanceDailyRule">
|
||||
select adr.F_Id id, F_GroupId groupId, F_SelfGroup selfGroup, F_ShiftId periodId, F_PeriodInfo periodInfo, F_Day `day`, F_UserId userId, F_LateEnable lateEnable, F_EarlyEnable earlyEnable,
|
||||
F_BreakEnable breakEnable, F_NextDayEnable nextDayEnable, F_ClockStartPoint clockStartPoint, F_InPoint inPoint, F_LatePoint latePoint, F_InLackPoint inLackPoint,
|
||||
F_BreakStartPoint breakStartPoint, F_BreakEndPoint breakEndPoint, F_EarlyPoint earlyPoint, F_OutPoint outPoint, F_OutLackPoint outLackPoint, F_InStepOutType inStepOutType, F_OutStepOutType outStepOutType,
|
||||
F_AttendanceType attendanceType, F_ApplyStart applyStart, F_ApplyEnd applyEnd, F_ApplyViewEnable applyViewEnable, F_InUnbounded inUnbounded, F_OutUnbounded outUnbounded,
|
||||
F_IsLateOutLateIn isLateOutLateIn,
|
||||
<choose>
|
||||
<when test="null != userId and '' != userId">
|
||||
ROW_NUMBER() OVER (ORDER BY F_InPoint DESC) AS rn
|
||||
</when>
|
||||
<otherwise>
|
||||
ROW_NUMBER() OVER (PARTITION BY F_UserId ORDER BY F_InPoint DESC) AS rn
|
||||
</otherwise>
|
||||
</choose>
|
||||
from ftb_attendance_daily_rule adr
|
||||
left join ftb_attendance_group ag on F_GroupId = ag.F_Id
|
||||
where adr.F_DeleteMark = 0 and ag.F_DeleteMark = 0 and F_ApplyViewEnable in (1, 3, 9, 10)
|
||||
<if test="null != userId and '' != userId">
|
||||
and adr.F_UserId = #{userId}
|
||||
</if>
|
||||
and F_Day between DATE_FORMAT(DATE_SUB(#{currentDate}, interval 1 day), '%Y-%m-%d') AND DATE_FORMAT(#{currentDate}, '%Y-%m-%d')
|
||||
order by F_Day desc, F_InPoint desc
|
||||
</select>
|
||||
<!-- 查询指定日期的最后一个出勤规则 -->
|
||||
<select id="getLastDailyRule" resultType="jnpf.entity.attendance.FtbAttendanceDailyRule">
|
||||
select adr.F_Id id, F_GroupId groupId, F_SelfGroup selfGroup, F_ShiftId periodId, F_Day `day`, F_UserId userId, F_LateEnable lateEnable, F_EarlyEnable earlyEnable,
|
||||
F_BreakEnable breakEnable, F_NextDayEnable nextDayEnable, F_ClockStartPoint clockStartPoint, F_InPoint inPoint, F_LatePoint latePoint, F_InLackPoint inLackPoint,
|
||||
F_BreakStartPoint breakStartPoint, F_BreakEndPoint breakEndPoint, F_EarlyPoint earlyPoint, F_OutPoint outPoint, F_OutLackPoint outLackPoint,
|
||||
F_AttendanceType attendanceType, F_ApplyStart applyStart, F_ApplyEnd applyEnd, F_ApplyViewEnable applyViewEnable/*, F_WithSalary withSalary*/
|
||||
from ftb_attendance_daily_rule adr
|
||||
left join ftb_attendance_group ag on F_GroupId = ag.F_Id
|
||||
where DATE_FORMAT(F_Day, '%Y-%m-%d') = DATE_FORMAT(#{currentDate}, '%Y-%m-%d') and F_UserId = #{userId} and adr.F_DeleteMark = 0 and ag.F_DeleteMark = 0
|
||||
and F_ApplyViewEnable in (1, 3, 9, 10)
|
||||
order by F_InPoint desc limit 1
|
||||
</select>
|
||||
<!-- 查询ruleId的上/下一个(班/加班)出勤 -->
|
||||
<select id="getPreviousOrNextRule" resultType="jnpf.entity.attendance.FtbAttendanceDailyRule">
|
||||
select adr.F_Id id, F_GroupId groupId, F_SelfGroup selfGroup, F_ShiftId periodId, F_Day `day`, F_UserId userId, F_LateEnable lateEnable, F_EarlyEnable earlyEnable,
|
||||
F_BreakEnable breakEnable, F_NextDayEnable nextDayEnable, F_ClockStartPoint clockStartPoint, F_InPoint inPoint, F_LatePoint latePoint, F_InLackPoint inLackPoint,
|
||||
F_BreakStartPoint breakStartPoint, F_BreakEndPoint breakEndPoint, F_EarlyPoint earlyPoint, F_OutPoint outPoint, F_OutLackPoint outLackPoint,
|
||||
F_AttendanceType attendanceType, F_ApplyStart applyStart, F_ApplyEnd applyEnd, /*F_WithSalary withSalary, */F_Sort sort
|
||||
from ftb_attendance_daily_rule adr
|
||||
left join ftb_attendance_group ag on F_GroupId = ag.F_Id
|
||||
where adr.F_ApplyViewEnable in (1, 3, 9, 10) and adr.F_Id != #{ruleId} and adr.F_UserId = #{userId} and adr.F_DeleteMark = 0 and adr.F_AttendanceType in (1, 4) and ag.F_DeleteMark = 0
|
||||
<![CDATA[
|
||||
and DATE_FORMAT(adr.F_InPoint, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{startTime}, '%Y-%m-%d %H:%i:%S')
|
||||
and DATE_FORMAT(adr.F_InPoint, '%Y-%m-%d %H:%i:%S') <= DATE_FORMAT(#{endTime}, '%Y-%m-%d %H:%i:%S')
|
||||
]]>
|
||||
<if test="'previous' == queryType">
|
||||
order by adr.F_Day desc, adr.F_InPoint desc
|
||||
</if>
|
||||
<if test="'next' == queryType">
|
||||
order by adr.F_Day asc, adr.F_InPoint asc
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
<!-- 获取指定日期的排班-->
|
||||
<select id="getShiftByDay" resultType="jnpf.model.attendance.vo.ClassesDetailVo">
|
||||
SELECT F_InPoint inPointDate ,F_BreakStartPoint breakStartPointDate ,F_BreakEndPoint breakEndPointDate ,F_OutPoint outPointDate
|
||||
FROM ftb_attendance_daily_rule
|
||||
WHERE DATE_FORMAT(F_Day,'%Y-%m-%d') = DATE_FORMAT(#{startDay},'%Y-%m-%d') and F_UserId = #{userId} and F_AttendanceType in (1, 4)
|
||||
</select>
|
||||
<!-- 2024-1-12-->
|
||||
<!-- <select id="getShiftByDay" resultType="jnpf.model.attendance.vo.ClassesDetailVo">-->
|
||||
<!-- SELECT DATE_FORMAT(F_InPoint,'%H:%i') inPoint ,DATE_FORMAT(F_BreakStartPoint,'%H:%i') breakStartPoint ,DATE_FORMAT(F_BreakEndPoint,'%H:%i') breakEndPoint ,DATE_FORMAT(F_OutPoint,'%H:%i') outPoint-->
|
||||
<!-- FROM ftb_attendance_daily_rule-->
|
||||
<!-- WHERE DATE_FORMAT(F_Day,'%Y-%m-%d') = DATE_FORMAT(#{startDay},'%Y-%m-%d') and F_UserId = #{userId} and F_AttendanceType in (1, 4)-->
|
||||
<!-- </select>-->
|
||||
<!-- 查询所有下班缺卡时间是今天的出勤规则 -->
|
||||
<select id="getRuleListByDate" resultType="jnpf.entity.attendance.FtbAttendanceDailyRule">
|
||||
select F_Id id, F_GroupId groupId, F_SelfGroup selfGroup, F_ShiftId periodId, F_Day `day`, F_UserId userId, F_LateEnable lateEnable, F_EarlyEnable earlyEnable,
|
||||
F_BreakEnable breakEnable, F_NextDayEnable nextDayEnable, F_ClockStartPoint clockStartPoint, F_InPoint inPoint, F_LatePoint latePoint, F_InLackPoint inLackPoint,
|
||||
F_BreakStartPoint breakStartPoint, F_BreakEndPoint breakEndPoint, F_EarlyPoint earlyPoint, F_OutPoint outPoint, F_OutLackPoint outLackPoint,
|
||||
F_AttendanceType attendanceType, F_ApplyStart applyStart, F_ApplyEnd applyEnd, F_Sort sort
|
||||
from ftb_attendance_daily_rule
|
||||
where F_DeleteMark = 0 and F_AttendanceType = 1 and F_ApplyViewEnable in (1, 3, 9, 10)
|
||||
<![CDATA[
|
||||
and DATE_FORMAT(F_Day, '%Y-%m-%d') = DATE_FORMAT(#{yesterday}, '%Y-%m-%d')
|
||||
and DATE_FORMAT(F_OutLackPoint, '%Y-%m-%d') = DATE_FORMAT(#{today}, '%Y-%m-%d')
|
||||
]]>
|
||||
<if test="null != userId and '' != userId">
|
||||
and F_UserId = #{userId}
|
||||
</if>
|
||||
order by F_OutLackPoint asc
|
||||
</select>
|
||||
<!-- 查询指定日期最后一个班次是加班的出勤记录 -->
|
||||
<select id="getOverTimeRuleListByDate" resultType="jnpf.entity.attendance.FtbAttendanceDailyRule">
|
||||
select F_Id id, F_GroupId groupId, F_SelfGroup selfGroup, F_ShiftId periodId, F_Day `day`, F_UserId userId, F_LateEnable lateEnable, F_EarlyEnable earlyEnable,
|
||||
F_BreakEnable breakEnable, F_NextDayEnable nextDayEnable, F_ClockStartPoint clockStartPoint, F_InPoint inPoint, F_LatePoint latePoint, F_InLackPoint inLackPoint,
|
||||
F_BreakStartPoint breakStartPoint, F_BreakEndPoint breakEndPoint, F_EarlyPoint earlyPoint, F_OutPoint outPoint, F_OutLackPoint outLackPoint,
|
||||
F_AttendanceType attendanceType, F_ApplyStart applyStart, F_ApplyEnd applyEnd, F_Sort sort
|
||||
from ftb_attendance_daily_rule adr
|
||||
inner join (
|
||||
select F_UserId userId, max(F_InPoint) inPoint
|
||||
from ftb_attendance_daily_rule
|
||||
where F_DeleteMark = 0 and F_AttendanceType in (4) and F_ApplyViewEnable in (1, 3, 9, 10)
|
||||
and DATE_FORMAT(F_InPoint, '%Y-%m-%d') = DATE_FORMAT(#{date}, '%Y-%m-%d')
|
||||
and DATE_FORMAT(F_Day, '%Y-%m-%d') = DATE_FORMAT(#{date}, '%Y-%m-%d')
|
||||
group by F_UserId
|
||||
) t on adr.F_UserId = t.userId and adr.F_InPoint = t.inPoint
|
||||
where adr.F_DeleteMark = 0 and adr.F_ApplyViewEnable in (1, 3, 9, 10)
|
||||
and DATE_FORMAT(adr.F_Day, '%Y-%m-%d') = DATE_FORMAT(#{date}, '%Y-%m-%d')
|
||||
<if test="null != userId and '' != userId">
|
||||
and adr.F_UserId = #{userId}
|
||||
</if>
|
||||
</select>
|
||||
<!-- 获取用户时间段内排班信息-->
|
||||
<select id="getUserShift" resultType="java.lang.Integer">
|
||||
SELECT count(0)
|
||||
FROM ftb_attendance_daily_rule
|
||||
WHERE F_UserId = #{userId} AND F_AttendanceType in (1, 4)
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(F_InPoint,'%Y-%m-%d %H:%i') < DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')
|
||||
AND DATE_FORMAT(F_OutPoint,'%Y-%m-%d %H:%i') > DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 查询所有工作时间是queryDate的出勤规则 -->
|
||||
<select id="getListWorkTimeInToday" resultType="jnpf.entity.attendance.FtbAttendanceDailyRule">
|
||||
select F_Id id, F_GroupId groupId, F_SelfGroup selfGroup, F_ShiftId periodId, F_Day `day`, F_UserId userId, F_LateEnable lateEnable, F_EarlyEnable earlyEnable,
|
||||
F_BreakEnable breakEnable, F_NextDayEnable nextDayEnable, F_ClockStartPoint clockStartPoint, F_InPoint inPoint, F_LatePoint latePoint, F_InLackPoint inLackPoint,
|
||||
F_BreakStartPoint breakStartPoint, F_BreakEndPoint breakEndPoint, F_EarlyPoint earlyPoint, F_OutPoint outPoint, F_OutLackPoint outLackPoint,
|
||||
F_AttendanceType attendanceType, F_ApplyStart applyStart, F_ApplyEnd applyEnd, F_Sort sort
|
||||
from ftb_attendance_daily_rule
|
||||
where F_DeleteMark = 0 and F_AttendanceType = 1 and F_ApplyViewEnable in (1, 3, 9, 10)
|
||||
<![CDATA[
|
||||
and (
|
||||
DATE_FORMAT(F_InPoint, '%Y-%m-%d') = DATE_FORMAT(#{queryDate}, '%Y-%m-%d') or DATE_FORMAT(F_OutPoint, '%Y-%m-%d') = DATE_FORMAT(#{queryDate}, '%Y-%m-%d')
|
||||
)
|
||||
]]>
|
||||
order by F_InPoint asc
|
||||
</select>
|
||||
<!-- 查询上班/下班时间在时间范围内的出勤规则 -->
|
||||
<select id="getListByWorkTime" resultType="jnpf.entity.attendance.FtbAttendanceDailyRule">
|
||||
select F_Id id, F_GroupId groupId, F_SelfGroup selfGroup, F_ShiftId periodId, F_Day `day`, F_UserId userId, F_LateEnable lateEnable, F_EarlyEnable earlyEnable,
|
||||
F_BreakEnable breakEnable, F_NextDayEnable nextDayEnable, F_ClockStartPoint clockStartPoint, F_InPoint inPoint, F_LatePoint latePoint, F_InLackPoint inLackPoint,
|
||||
F_BreakStartPoint breakStartPoint, F_BreakEndPoint breakEndPoint, F_EarlyPoint earlyPoint, F_OutPoint outPoint, F_OutLackPoint outLackPoint,
|
||||
F_AttendanceType attendanceType, F_ApplyStart applyStart, F_ApplyEnd applyEnd, F_Sort sort
|
||||
from ftb_attendance_daily_rule
|
||||
where F_DeleteMark = 0 and F_AttendanceType = 1 and F_ApplyViewEnable in (1, 3, 9, 10)
|
||||
<![CDATA[
|
||||
and (
|
||||
(DATE_FORMAT(F_InPoint, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{beginDate}, '%Y-%m-%d %H:%i:%S') and DATE_FORMAT(F_InPoint, '%Y-%m-%d %H:%i:%S') < DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S'))
|
||||
or
|
||||
(DATE_FORMAT(F_OutPoint, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{beginDate}, '%Y-%m-%d %H:%i:%S') and DATE_FORMAT(F_OutPoint, '%Y-%m-%d %H:%i:%S') < DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S'))
|
||||
)
|
||||
]]>
|
||||
order by F_InPoint asc
|
||||
</select>
|
||||
<!-- 查询一个月的打卡记录(缺勤次数统计) -->
|
||||
<select id="selectMonthRecord" resultType="jnpf.model.attendance.vo.MonthRecordVo">
|
||||
select dr.F_GroupId groupId, date_format(dr.F_Day, '%Y-%m-%d') `day`, acir.F_UserId userId, acir.F_RuleId ruleId, sum(acir.F_Absence = 1) absenceCount,
|
||||
sn.F_ShortName rule, concat_ws('至', date_format(dr.F_InPoint, '%H:%i'), date_format(dr.F_OutPoint, '%H:%i')) ruleTime
|
||||
from ftb_attendance_clock_in_result acir
|
||||
left join ftb_attendance_daily_rule dr on dr.F_Id = acir.F_RuleId
|
||||
left join ftb_attendance_shift_name sn on dr.F_ShiftId = sn.F_Id
|
||||
join (
|
||||
select adr.F_Id
|
||||
from ftb_attendance_daily_rule adr
|
||||
where adr.F_DeleteMark = 0 and F_AttendanceType in (1, 4)
|
||||
and adr.F_Day in (
|
||||
select F_Day
|
||||
from (
|
||||
select F_Day
|
||||
from ftb_attendance_daily_rule
|
||||
where F_AttendanceType in (1, 4)
|
||||
and F_DeleteMark = 0 and date_format(F_Day, '%Y-%m-%d') <![CDATA[<]]> date_format(now(), '%Y-%m-%d')
|
||||
group by F_Day
|
||||
order by F_Day desc
|
||||
limit 30
|
||||
) as recent_days
|
||||
)
|
||||
) as filtered_rules on acir.F_RuleId = filtered_rules.F_Id
|
||||
where acir.F_DeleteMark = 0
|
||||
group by dr.F_GroupId, dr.F_Day, acir.F_UserId, acir.F_RuleId, acir.F_Absence
|
||||
order by dr.F_GroupId, acir.F_UserId, dr.F_Day desc
|
||||
</select>
|
||||
<!-- 查询存在的出勤规则 -->
|
||||
<select id="getExistRuleId" resultType="java.lang.String">
|
||||
select F_Id from ftb_attendance_daily_rule where F_DeleteMark = 0 and F_Id in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- 获取排班用户数-->
|
||||
<select id="getGroupUserNum" resultType="java.lang.Integer">
|
||||
SELECT COUNT(DISTINCT(F_UserId))
|
||||
FROM ftb_attendance_daily_rule
|
||||
WHERE F_Day = DATE_FORMAT(NOW(), '%Y-%m-%d') AND F_DeleteMark = 0 AND F_AttendanceType IN (1,2)
|
||||
AND F_GroupId IN
|
||||
<foreach collection="groupIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getYesterdayRule" resultType="jnpf.model.attendance.vo.attendance.YesterdayRuleVo">
|
||||
select *,count(1) clockCount from
|
||||
(SELECT
|
||||
r.F_Id id,
|
||||
r.F_Day `day`,
|
||||
r.F_InPoint inPoint,
|
||||
r.F_OutPoint outPoint,
|
||||
r.F_AttendanceType attendanceType
|
||||
FROM
|
||||
ftb_attendance_daily_rule r
|
||||
left JOIN ftb_attendance_clock_in_result c ON r.F_Id = c.F_RuleId
|
||||
WHERE
|
||||
r.F_ApplyViewEnable IN ( 1, 3, 9, 10 )
|
||||
AND r.F_AttendanceType IN ( 1, 4 )
|
||||
AND r.F_UserId = #{userId}
|
||||
AND r.F_Day BETWEEN #{startDate} and #{endDate}) info
|
||||
GROUP BY id having clockCount <![CDATA[<]]> 2
|
||||
order by inPoint asc
|
||||
</select>
|
||||
|
||||
<select id="getDayRule" resultType="java.lang.String">
|
||||
SELECT F_Id
|
||||
FROM ftb_attendance_daily_rule
|
||||
WHERE F_Day = DATE_FORMAT(NOW(), '%Y-%m-%d') AND F_DeleteMark = 0 AND F_AttendanceType = 1
|
||||
AND F_GroupId IN
|
||||
<foreach collection="groupIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND F_UserId IN
|
||||
<foreach collection="groupUserIds" index="index" item="item1" open="(" separator="," close=")">
|
||||
#{item1}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- 批量查询出勤规则 -->
|
||||
<select id="getDailyRuleListBatch" resultType="jnpf.entity.attendance.FtbAttendanceDailyRule">
|
||||
SELECT
|
||||
adr.F_Id AS id,
|
||||
adr.F_GroupId AS groupId,
|
||||
adr.F_SelfGroup AS selfGroup,
|
||||
adr.F_ShiftId AS periodId,
|
||||
adr.F_PeriodInfo AS periodInfo,
|
||||
adr.F_Day AS `day`,
|
||||
adr.F_UserId AS userId,
|
||||
adr.F_LateEnable AS lateEnable,
|
||||
adr.F_EarlyEnable AS earlyEnable,
|
||||
adr.F_BreakEnable AS breakEnable,
|
||||
adr.F_NextDayEnable AS nextDayEnable,
|
||||
adr.F_ClockStartPoint AS clockStartPoint,
|
||||
adr.F_InPoint AS inPoint,
|
||||
adr.F_LatePoint AS latePoint,
|
||||
adr.F_InLackPoint AS inLackPoint,
|
||||
adr.F_BreakStartPoint AS breakStartPoint,
|
||||
adr.F_BreakEndPoint AS breakEndPoint,
|
||||
adr.F_EarlyPoint AS earlyPoint,
|
||||
adr.F_OutPoint AS outPoint,
|
||||
adr.F_OutLackPoint AS outLackPoint,
|
||||
adr.F_InStepOutType AS inStepOutType,
|
||||
adr.F_OutStepOutType AS outStepOutType,
|
||||
adr.F_AttendanceType AS attendanceType,
|
||||
adr.F_ApplyStart AS applyStart,
|
||||
adr.F_ApplyEnd AS applyEnd,
|
||||
adr.F_ApplyViewEnable AS applyViewEnable,
|
||||
adr.F_InUnbounded AS inUnbounded,
|
||||
adr.F_OutUnbounded AS outUnbounded,
|
||||
adr.F_IsLateOutLateIn AS isLateOutLateIn,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY p.userId, p.targetDate ORDER BY adr.F_InPoint DESC
|
||||
) AS rn,
|
||||
p.targetDate,
|
||||
p.queryDate
|
||||
FROM ftb_attendance_daily_rule adr
|
||||
LEFT JOIN ftb_attendance_group ag ON adr.F_GroupId = ag.F_Id
|
||||
JOIN (
|
||||
VALUES
|
||||
<foreach collection="list" item="it" separator=",">
|
||||
ROW(#{it.userId}, #{it.dayStr}, #{it.dayStr})
|
||||
</foreach>
|
||||
) AS p(userId, targetDate, queryDate) ON adr.F_UserId = p.userId AND adr.F_Day = p.queryDate
|
||||
WHERE adr.F_DeleteMark = 0
|
||||
AND ag.F_DeleteMark = 0
|
||||
AND adr.F_ApplyViewEnable IN (1,3,9,10)
|
||||
ORDER BY p.userId, p.targetDate, p.queryDate, adr.F_InPoint DESC
|
||||
</select>
|
||||
<select id="getUserPublicHoliday" resultType="jnpf.model.attendance.vo.KeyValueVo">
|
||||
SELECT
|
||||
F_UserId as userId ,
|
||||
IFNULL(SUM(F_PeriodWorkDay),0) as value
|
||||
FROM ftb_attendance_daily_rule
|
||||
WHERE F_AttendanceType = 2 AND DATE_FORMAT(F_Day,'%Y-%m') = #{yearMonth} AND F_UserId IN
|
||||
<foreach collection="userIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND F_ApplyViewEnable IN (1,3,9,10) AND F_DeleteMark = 0
|
||||
GROUP BY F_UserId
|
||||
</select>
|
||||
<!-- 查询每个出勤规则的下一个出勤规则 -->
|
||||
<select id="getNextRulePartInfo" resultType="jnpf.model.attendance.vo.NextRuleVo">
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
F_Id AS ruleId,
|
||||
LEAD(F_Id) OVER (PARTITION BY F_Day, F_UserId ORDER BY F_InPoint) AS nextRuleId,
|
||||
LEAD(F_AttendanceType) OVER (PARTITION BY F_Day, F_UserId ORDER BY F_InPoint) AS nextAttendanceType
|
||||
FROM ftb_attendance_daily_rule
|
||||
WHERE F_Day = #{dayStr} AND F_DeleteMark = 0
|
||||
) t
|
||||
WHERE t.ruleId IN
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getDayRuleByMonth" resultType="jnpf.model.attendance.vo.CreateDayStatistics">
|
||||
SELECT
|
||||
F_GroupId AS groupId,
|
||||
F_UserId AS userId,
|
||||
F_Day AS day
|
||||
FROM ftb_attendance_daily_rule
|
||||
WHERE F_Day BETWEEN #{startDate} AND #{endDate}
|
||||
AND F_DeleteMark = 0
|
||||
GROUP BY F_GroupId, F_UserId, F_Day;
|
||||
</select>
|
||||
</mapper>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceFestivalRulesMapper" >
|
||||
<update id="updateState">
|
||||
UPDATE ftb_attendance_festival_rules
|
||||
SET F_State = #{state},
|
||||
F_LastModifyTime = now(),
|
||||
F_LastModifyUserId = #{userId}
|
||||
WHERE F_Id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getPageList" resultType="jnpf.model.attendance.vo.attendance.AttendanceFestivalRulesVo">
|
||||
SELECT
|
||||
F_Id AS id,
|
||||
F_Name AS `name`,
|
||||
F_FestivalDate AS festivalDate,
|
||||
F_CompensateInDate AS compensateInDate,
|
||||
F_ScopeOfAdaptation AS scopeOfAdaptation,
|
||||
F_StartDate as startDate,
|
||||
F_EndDate as endDate,
|
||||
F_State AS state
|
||||
FROM ftb_attendance_festival_rules
|
||||
WHERE F_DeleteMark = 0
|
||||
<if test="queryDto.iText != null and queryDto.iText != ''">
|
||||
AND F_Name LIKE concat('%',#{queryDto.iText},'%')
|
||||
</if>
|
||||
<if test="queryDto.year != null and queryDto.year != ''">
|
||||
AND F_Year = #{queryDto.year}
|
||||
</if>
|
||||
order by F_LastModifyTime desc,F_StartDate asc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceFieldPersonnelMapper" >
|
||||
<insert id="insertList">
|
||||
insert into ftb_attendance_field_personnel (F_Id, F_GroupId ,F_UserId )
|
||||
values
|
||||
<foreach collection="fieldPersonnelList" item="item" separator=",">
|
||||
(#{item.id},#{item.groupId},#{item.userId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 根据考勤组Id删除绑定的外勤人员-->
|
||||
<delete id="deleteByGroupId">
|
||||
DELETE FROM ftb_attendance_field_personnel
|
||||
WHERE F_GroupId = #{groupId}
|
||||
</delete>
|
||||
<!-- 根据考勤组Id获取外勤人员Id列表-->
|
||||
<select id="getUserIdsByGroupId" resultType="java.lang.String">
|
||||
SELECT F_UserId
|
||||
FROM ftb_attendance_field_personnel
|
||||
where F_GroupId = #{groupId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceFieldpersonnelApproveMapper" >
|
||||
|
||||
|
||||
<sql id="Base_Column_List" >
|
||||
F_Id, F_Address, F_Remark, f_flowtaskid, f_flowid, F_UniqueId, F_TenantId, F_lng,
|
||||
F_lat, F_deviceType, F_deviceId, F_deviceName
|
||||
</sql>
|
||||
<sql id="Blob_Column_List" >
|
||||
F_Picture
|
||||
</sql>
|
||||
|
||||
<!-- <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >-->
|
||||
<!-- delete from ftb_attendance_fieldpersonnel_approve-->
|
||||
<!-- where F_Id = #{fId,jdbcType=VARCHAR}-->
|
||||
<!-- </delete>-->
|
||||
<!-- <insert id="insert" parameterType="com.shs.cts.util.domain.po.experience.AttendanceFieldpersonnelApprove" >-->
|
||||
<!-- insert into ftb_attendance_fieldpersonnel_approve (F_Id, F_Address, F_Remark, -->
|
||||
<!-- f_flowtaskid, f_flowid, F_UniqueId, -->
|
||||
<!-- F_TenantId, F_lng, F_lat, -->
|
||||
<!-- F_deviceType, F_deviceId, F_deviceName, -->
|
||||
<!-- F_Picture)-->
|
||||
<!-- values (#{fId,jdbcType=VARCHAR}, #{fAddress,jdbcType=VARCHAR}, #{fRemark,jdbcType=VARCHAR}, -->
|
||||
<!-- #{fFlowtaskid,jdbcType=VARCHAR}, #{fFlowid,jdbcType=VARCHAR}, #{fUniqueid,jdbcType=VARCHAR}, -->
|
||||
<!-- #{fTenantid,jdbcType=VARCHAR}, #{fLng,jdbcType=VARCHAR}, #{fLat,jdbcType=VARCHAR}, -->
|
||||
<!-- #{fDevicetype,jdbcType=TINYINT}, #{fDeviceid,jdbcType=VARCHAR}, #{fDevicename,jdbcType=VARCHAR}, -->
|
||||
<!-- #{fPicture,jdbcType=LONGVARCHAR})-->
|
||||
<!-- </insert>-->
|
||||
<!-- -->
|
||||
<!-- <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.shs.cts.util.domain.po.experience.AttendanceFieldpersonnelApprove" >-->
|
||||
<!-- update ftb_attendance_fieldpersonnel_approve-->
|
||||
<!-- set F_Address = #{fAddress,jdbcType=VARCHAR},-->
|
||||
<!-- F_Remark = #{fRemark,jdbcType=VARCHAR},-->
|
||||
<!-- f_flowtaskid = #{fFlowtaskid,jdbcType=VARCHAR},-->
|
||||
<!-- f_flowid = #{fFlowid,jdbcType=VARCHAR},-->
|
||||
<!-- F_UniqueId = #{fUniqueid,jdbcType=VARCHAR},-->
|
||||
<!-- F_TenantId = #{fTenantid,jdbcType=VARCHAR},-->
|
||||
<!-- F_lng = #{fLng,jdbcType=VARCHAR},-->
|
||||
<!-- F_lat = #{fLat,jdbcType=VARCHAR},-->
|
||||
<!-- F_deviceType = #{fDevicetype,jdbcType=TINYINT},-->
|
||||
<!-- F_deviceId = #{fDeviceid,jdbcType=VARCHAR},-->
|
||||
<!-- F_deviceName = #{fDevicename,jdbcType=VARCHAR},-->
|
||||
<!-- F_Picture = #{fPicture,jdbcType=LONGVARCHAR}-->
|
||||
<!-- where F_Id = #{fId,jdbcType=VARCHAR}-->
|
||||
<!-- </update>-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceFixedClassMapper" >
|
||||
<!-- 校验该班次有无在固定排班使用-->
|
||||
<select id="getUseBYShiftNameId" resultType="java.lang.Integer">
|
||||
SELECT COUNT(0) FROM ftb_attendance_fixed_class
|
||||
WHERE F_ShiftNameId = #{shiftNameId}
|
||||
</select>
|
||||
<!-- 校验该班次有无在排班使用-->
|
||||
<select id="getRuleUseBYShiftNameId" resultType="java.lang.Integer">
|
||||
SELECT COUNT(0) FROM ftb_attendance_daily_rule
|
||||
WHERE F_ShiftId = #{shiftNameId}
|
||||
</select>
|
||||
<!-- 校验该班次有无在快速排班使用-->
|
||||
<select id="getQuickUseBYShiftNameId" resultType="java.lang.Integer">
|
||||
SELECT COUNT(n.F_Id) FROM ftb_attendance_quick_template_item_new n
|
||||
LEFT JOIN ftb_attendance_quick_template t ON n.F_TemplateId = t.F_Id
|
||||
WHERE n.F_ShiftNameId = #{shiftNameId} AND t.F_DeleteMark = 0
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,235 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceGroupMapper" >
|
||||
<!-- 查询用户管理的考勤组列表(考勤组名称模糊搜索)-->
|
||||
<select id="queryManagerGroupList" resultType="jnpf.entity.AttendanceGroup">
|
||||
SELECT
|
||||
fag.F_Id id,
|
||||
fag.F_GroupName groupName,
|
||||
fag.F_ParentId parentId,
|
||||
fag.F_LevelCode levelCode
|
||||
FROM
|
||||
ftb_attendance_group fag
|
||||
INNER JOIN ftb_attendance_manager_permission famp ON famp.F_GroupId = fag.F_Id
|
||||
WHERE
|
||||
fag.F_DeleteMark = 0
|
||||
and
|
||||
famp.F_Type = 1
|
||||
and
|
||||
famp.F_UserId = #{userId}
|
||||
<if test="keyword != null and keyword != ''">
|
||||
and fag.F_GroupName like concat("%",#{keyword},"%")
|
||||
</if>
|
||||
group BY fag.F_Id
|
||||
ORDER BY fag.F_CreatorTime desc
|
||||
</select>
|
||||
<!-- 查询用户管理的考勤组列表-->
|
||||
<select id="queryGroupList" resultType="jnpf.model.attendance.vo.AttendanceGroupVo">
|
||||
SELECT
|
||||
fag.F_Id id,
|
||||
fag.F_GroupName groupName,
|
||||
fag.F_LevelCode levelCode,
|
||||
fag.F_ParentId parentId,
|
||||
famp.F_UserId,
|
||||
GROUP_CONCAT(fpd.F_Name) allPermissions
|
||||
FROM
|
||||
ftb_attendance_group fag
|
||||
LEFT JOIN ftb_attendance_manager_permission famp ON famp.F_GroupId = fag.F_Id
|
||||
LEFT JOIN ftb_permission_dict fpd on fpd.F_Id = famp.F_PermissionId
|
||||
WHERE famp.F_UserId = #{userId}
|
||||
GROUP BY fag.F_Id
|
||||
</select>
|
||||
<!-- 查询考勤组名称 -->
|
||||
<select id="getGroupName" resultType="java.lang.String">
|
||||
select F_GroupName from ftb_attendance_group where F_Id = #{groupId}
|
||||
</select>
|
||||
<!-- 获取考勤组详情-->
|
||||
<select id="getGroupDetail" resultType="jnpf.entity.AttendanceGroup">
|
||||
SELECT F_Id id, F_GroupName groupName, F_ParentId parentId, F_OrgId orgId, F_LevelCode levelCode,F_LeaveSetting leaveSetting ,F_AttendanceClassSetting attendanceClassSetting
|
||||
FROM ftb_attendance_group
|
||||
where F_Id = #{groupId}
|
||||
</select>
|
||||
<!-- 批量获取考勤组信息-->
|
||||
<select id="getGroupDetailList" resultType="jnpf.entity.AttendanceGroup">
|
||||
SELECT F_Id id, F_GroupName groupName, F_ParentId parentId, F_LevelCode levelCode,F_LeaveSetting leaveSetting ,F_AttendanceClassSetting attendanceClassSetting
|
||||
FROM ftb_attendance_group
|
||||
where F_Id in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- 查询被删除的考勤组 -->
|
||||
<select id="selectDelIds" resultType="java.lang.String">
|
||||
select F_Id from ftb_attendance_group where F_DeleteMark = 1 and F_Id in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- 获取所有考勤组-->
|
||||
<select id="getAllGroupList" resultType="jnpf.model.attendance.vo.AttendanceGroupVo">
|
||||
SELECT
|
||||
fag.F_Id id,
|
||||
fag.F_GroupName groupName,
|
||||
fag.F_DetailName detailName,
|
||||
fag.F_ParentId parentId,
|
||||
fag.F_LevelCode levelCode,
|
||||
fag.F_OrgId orgId,
|
||||
fag.F_LockedDate lockedDate,
|
||||
fag.F_DeleteMark deleteMark,
|
||||
fag.F_LastModifyTime endDay
|
||||
FROM
|
||||
ftb_attendance_group fag
|
||||
</select>
|
||||
<!-- 通过组织Id找到组织下的考勤组-->
|
||||
<select id="groupListByOrgId" resultType="jnpf.model.attendance.vo.AttendanceGroupVo">
|
||||
SELECT
|
||||
F_Id id,
|
||||
F_GroupName groupName,
|
||||
F_DetailName detailName,
|
||||
F_ParentId parentId,
|
||||
F_LevelCode levelCode,
|
||||
F_OrgId orgId
|
||||
FROM
|
||||
ftb_attendance_group
|
||||
where F_DeleteMark = 0 and F_OrgId = #{orgId}
|
||||
</select>
|
||||
<!-- 通过考勤组Id获取绑定的组织-->
|
||||
<select id="getGroupBindingOrg" resultType="jnpf.model.attendance.vo.AttendanceGroupVo">
|
||||
SELECT
|
||||
F_Id id,
|
||||
F_GroupName groupName,
|
||||
F_DetailName detailName,
|
||||
F_ParentId parentId,
|
||||
F_LevelCode levelCode,
|
||||
F_OrgId orgId,
|
||||
F_LockedDate lockedDate
|
||||
FROM
|
||||
ftb_attendance_group
|
||||
where F_DeleteMark = 0 and F_Id = #{groupId}
|
||||
</select>
|
||||
<!-- 绑定考勤组的组织-->
|
||||
<update id="updateGroupOrg">
|
||||
update ftb_attendance_group
|
||||
set F_OrgId = #{attendanceGroupOrgDto.orgId}
|
||||
where F_Id = #{attendanceGroupOrgDto.groupId}
|
||||
</update>
|
||||
<!-- 查询用户所在考勤组-->
|
||||
<select id="getAttendanceUserGroup" resultType="jnpf.attendance.dto.AttendanceUserGroupVo">
|
||||
SELECT
|
||||
u.F_UserId userId ,
|
||||
g.F_Id groupId,
|
||||
g.F_GroupName groupName
|
||||
FROM ftb_attendance_group_user u
|
||||
LEFT JOIN ftb_attendance_group g ON g.F_Id = u.F_GroupId
|
||||
WHERE F_Type = 1 and g.F_DeleteMark = 0 and u.F_DeleteMark = 0
|
||||
AND u.F_UserId IN
|
||||
<foreach collection="userIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getGroupLockDate" resultType="java.util.Date">
|
||||
select F_LockedDate from ftb_attendance_group where F_Id = #{groupId}
|
||||
</select>
|
||||
<!-- 查询父级考勤组id -->
|
||||
<select id="getParentGroupId" resultType="java.lang.String">
|
||||
select F_ParentId from ftb_attendance_group where F_Id = #{groupId}
|
||||
</select>
|
||||
<!-- 查询本级及子级考勤组 -->
|
||||
<select id="getSelfAndChildrenGroup" resultType="jnpf.model.attendance.vo.GroupNodeVo">
|
||||
select F_Id id, F_GroupName groupName, F_ParentId pid, F_AttendancePointsSetting attendancePointsSetting, F_LevelCode levelCode,
|
||||
F_AttendanceClassSetting attendanceClassSetting, F_BaseSetting baseSetting
|
||||
from ftb_attendance_group
|
||||
where find_in_set(#{groupId}, replace(F_LevelCode, '#', ',')) and F_DeleteMark = 0
|
||||
</select>
|
||||
<!-- 批量查询用户所在考勤组-->
|
||||
<select id="getAttendanceUserListGroupVO" resultType="jnpf.attendance.dto.AttendanceUserListGroupVO">
|
||||
SELECT g.F_Id groupId, u.F_UserId userId ,g.F_GroupName groupName
|
||||
FROM ftb_attendance_group_user u
|
||||
LEFT JOIN ftb_attendance_group g ON g.F_Id = u.F_GroupId
|
||||
WHERE u.F_Type = 1
|
||||
AND u.F_DeleteMark = 0 AND g.F_DeleteMark = 0
|
||||
AND u.F_UserId IN
|
||||
<foreach collection="userIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- 查询所有考勤组(层级排序) -->
|
||||
<select id="getAllGroupByLevel" resultType="jnpf.model.attendance.vo.attendance.GroupMiniVo">
|
||||
select t.groupId, t.groupName from (
|
||||
select F_Id groupId, F_GroupName groupName, length(F_LevelCode) - length(replace(F_LevelCode, '#', '')) levelNum
|
||||
from ftb_attendance_group
|
||||
where F_DeleteMark = 0
|
||||
<if test="null != list and list.size > 0">
|
||||
and F_Id in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
) t order by t.levelNum asc
|
||||
</select>
|
||||
<!-- 查询用户是否拥有指定考勤组的指定权限-->
|
||||
<select id="appointPermissionByGroupId" resultType="java.lang.Integer">
|
||||
SELECT COUNT(0)
|
||||
FROM ftb_attendance_manager_permission
|
||||
WHERE F_GroupId = #{groupId} AND F_UserId = #{userId} AND F_DeleteMark = 0
|
||||
AND F_PermissionId = (SELECT F_Id FROM ftb_permission_dict WHERE F_PermissionCode = #{permissionCode} AND F_DeleteMark = 0)
|
||||
AND F_Type = #{type}
|
||||
</select>
|
||||
|
||||
<select id="getGroupListByOrgId" resultType="jnpf.model.attendance.vo.AttendanceGroupVo">
|
||||
SELECT
|
||||
fag.F_Id id,
|
||||
fag.F_GroupName groupName,
|
||||
fag.F_DetailName detailName,
|
||||
fag.F_ParentId parentId,
|
||||
fag.F_LevelCode levelCode,
|
||||
fag.F_OrgId orgId,
|
||||
fag.F_LockedDate lockedDate,
|
||||
fag.F_DeleteMark deleteMark,
|
||||
fag.F_LastModifyTime endDay
|
||||
FROM
|
||||
ftb_attendance_group fag
|
||||
where 1 = 1
|
||||
<if test="null != groupQueryDto and null != groupQueryDto.name and '' != groupQueryDto.name">
|
||||
and fag.F_GroupName like concat("%",#{groupQueryDto.name},"%")
|
||||
</if>
|
||||
<if test="null != groupQueryDto and null != groupQueryDto.type and 0 == groupQueryDto.type">
|
||||
and fag.F_DeleteMark = 0
|
||||
</if>
|
||||
<if test="orgIds!=null and orgIds.size()>0">
|
||||
and fag.F_OrgId in
|
||||
<foreach collection="orgIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
fag.F_Id
|
||||
</select>
|
||||
<select id="getGroupListByIds" resultType="jnpf.model.attendance.vo.AttendanceGroupVo">
|
||||
SELECT
|
||||
fag.F_Id id,
|
||||
fag.F_GroupName groupName,
|
||||
fag.F_DetailName detailName,
|
||||
fag.F_ParentId parentId,
|
||||
fag.F_LevelCode levelCode,
|
||||
fag.F_OrgId orgId,
|
||||
fag.F_LockedDate lockedDate,
|
||||
fag.F_DeleteMark deleteMark,
|
||||
fag.F_LastModifyTime endDay
|
||||
FROM
|
||||
ftb_attendance_group fag
|
||||
where
|
||||
<if test="groupIds !=null and groupIds.size()>0">
|
||||
fag.F_Id in
|
||||
<foreach collection="groupIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
fag.F_Id
|
||||
</select>
|
||||
<!-- 查询组织id -->
|
||||
<select id="getOrgId" resultType="java.lang.String">
|
||||
select F_OrgId from ftb_attendance_group where F_Id = #{groupId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,125 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceGroupUserMapper">
|
||||
<!-- 批量修改考勤组用户-->
|
||||
<update id="batchUpdateGroupUser">
|
||||
update ftb_attendance_group_user
|
||||
set F_Type = #{type}
|
||||
where F_Id in
|
||||
<foreach collection="groupUserIds" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<!-- <resultMap id="BaseResultMap" type="com.chehejia.domain.AttendanceGroupUser">-->
|
||||
<!-- <id column="F_Id" property="fId" />-->
|
||||
<!-- <result column="F_UserId" property="fUserid" />-->
|
||||
<!-- <result column="F_GroupId" property="fGroupid" />-->
|
||||
<!-- <result column="F_Type" property="fType" />-->
|
||||
<!-- <result column="F_StartTime" property="fStarttime" />-->
|
||||
<!-- <result column="F_EndTime" property="fEndtime" />-->
|
||||
<!-- <result column="F_CreatorUserId" property="fCreatoruserid" />-->
|
||||
<!-- <result column="F_CreatorTime" property="fCreatortime" />-->
|
||||
<!-- <result column="F_TenantId" property="fTenantid" />-->
|
||||
<!-- </resultMap>-->
|
||||
<!-- 获取考勤组用户生存周期记录-->
|
||||
<select id="viewGroupUserList" resultType="jnpf.model.attendance.vo.AttendanceGroupUserVo">
|
||||
SELECT
|
||||
fagu.F_UserId userId,
|
||||
fagu.F_TimeJson timeJson
|
||||
FROM
|
||||
ftb_attendance_group_user fagu
|
||||
WHERE fagu.F_GroupId = #{groupId} and fagu.F_DeleteMark = 0
|
||||
</select>
|
||||
<!-- 查询系统用户列表-->
|
||||
<select id="querySysUsers" resultType="jnpf.model.attendance.vo.AttendanceGroupUserVo">
|
||||
SELECT
|
||||
bu.F_Id userId,
|
||||
bu.F_RealName realName,
|
||||
fag.F_GroupName groupName,
|
||||
bu.F_HeadIcon headIcon,
|
||||
bu.F_OrganizeId orgId
|
||||
FROM
|
||||
base_user bu
|
||||
LEFT JOIN ftb_attendance_group_user fagu ON fagu.F_UserId = bu.F_Id
|
||||
LEFT JOIN ftb_attendance_group fag on fag.F_Id = fagu.F_GroupId
|
||||
WHERE
|
||||
bu.F_OrganizeId = #{orgId} and fagu.F_DeleteMark = 0
|
||||
<if test="name != null and name != ''">
|
||||
and bu.F_RealName concat('%',#{name},'%')
|
||||
</if>
|
||||
</select>
|
||||
<!-- 获取用户所有产生的考勤组集合-->
|
||||
<select id="getUserGroupList" resultType="jnpf.model.attendance.vo.AttendanceGroupUserVo">
|
||||
SELECT F_GroupId groupId,F_TimeJson timeJson ,F_Type type
|
||||
FROM ftb_attendance_group_user
|
||||
WHERE F_UserId = #{userId} and F_Type != 3 and F_DeleteMark = 0
|
||||
</select>
|
||||
<!-- 查询考勤组用户信息列表 -->
|
||||
<select id="getGroupUserList" resultType="jnpf.model.attendance.vo.MiniGroupVo">
|
||||
select agu.F_GroupId groupId, ag.F_GroupName groupName, agu.F_Type `type`,
|
||||
case aas.F_Permission when 0 then 0 else 1 end needApproval
|
||||
from ftb_attendance_group_user agu
|
||||
left join ftb_attendance_group ag on agu.F_GroupId = ag.F_Id
|
||||
left join ftb_attendance_approval_setting aas on aas.F_GroupId = ag.F_Id and aas.F_type = 2
|
||||
where agu.F_UserId = #{userId} and ag.F_Id in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="delStatus != null and delStatus == 0">
|
||||
and agu.F_DeleteMark = 0
|
||||
</if>
|
||||
</select>
|
||||
<!-- 查询自己的考勤组id -->
|
||||
<select id="getSelfGroup" resultType="java.lang.String">
|
||||
select F_GroupId from ftb_attendance_group_user where F_UserId = #{userId} and F_Type = 1 and F_DeleteMark = 0
|
||||
</select>
|
||||
|
||||
<select id="getGroupInUserIds" resultType="jnpf.model.attendance.vo.AttendanceGroupUserVo">
|
||||
SELECT
|
||||
fag.F_Id groupId,
|
||||
fag.F_GroupName groupName,
|
||||
fagu.F_UserId userId,
|
||||
fagu.F_Type type
|
||||
FROM
|
||||
ftb_attendance_group fag
|
||||
INNER JOIN ftb_attendance_group_user fagu ON fagu.F_GroupId = fag.F_Id
|
||||
where fag.F_DeleteMark = 0 and fagu.F_DeleteMark = 0
|
||||
and fagu.F_UserId in
|
||||
<foreach close=")" collection="userIds" item="id" open="(" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
<if test="type != null">
|
||||
and fagu.F_Type = #{type}
|
||||
</if>
|
||||
</select>
|
||||
<!-- 查询考勤组成员(不含借调) -->
|
||||
<select id="getGroupUserListByIds" resultType="java.lang.String">
|
||||
select F_UserId from ftb_attendance_group_user
|
||||
where F_Type = 1 and F_DeleteMark = 0 and F_GroupId in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- 查询考勤组成员 -->
|
||||
<select id="getUsersByGroupIds" resultType="jnpf.model.attendance.vo.AttendanceGroupUserVo">
|
||||
SELECT gu.F_UserId userId, gu.F_TimeJson timeJson, g.F_GroupName groupName
|
||||
FROM ftb_attendance_group_user gu
|
||||
LEFT JOIN ftb_attendance_group g on g.F_Id = gu.F_GroupId
|
||||
WHERE gu.F_DeleteMark = 0 and gu.F_GroupId IN
|
||||
<foreach collection="groupIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- 获取考勤组成员id-->
|
||||
<select id="getGroupUserIds" resultType="java.lang.String">
|
||||
SELECT DISTINCT(F_UserId)
|
||||
FROM ftb_attendance_group_user
|
||||
WHERE F_GroupId IN
|
||||
<foreach collection="groupIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND F_DeleteMark = 0 AND F_Type = 1 AND F_UserGroupType = 1 AND F_RemoveTime IS NULL
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,481 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceLeaveApproveMapper" >
|
||||
|
||||
<sql id="Base_Column_List" >
|
||||
F_Id, F_User_Id, F_Type, F_StartTime, F_EndTime, F_ApplicationDuration, F_ReasonForLeave,
|
||||
F_Undeducted_Time, F_Balance_Status, F_Paid, F_No_Paid, f_flowtaskid, f_flowid, F_UniqueId,
|
||||
F_TenantId
|
||||
</sql>
|
||||
<sql id="Blob_Column_List" >
|
||||
F_Picture
|
||||
</sql>
|
||||
|
||||
<select id="getLeaveDetailById" resultType="jnpf.model.attendance.vo.AttendanceLeaveApproveVo">
|
||||
select F_Id id, F_User_Id userId ,F_Type_Id typeId, F_Type type,F_Unit unit, F_StartTime startTime, F_EndTime endTime, F_Balance_Status balanceStatus, F_Paid paid, F_No_Paid noPaid ,F_Status status,F_StartTimeType startTimeType,F_EndTimeType endTimeType,F_ShiftInvolved shiftInvolved
|
||||
from ftb_attendance_leave_approve
|
||||
where F_Id = #{id}
|
||||
</select>
|
||||
<!-- 修改请假审批信息-->
|
||||
<update id="updateLeaveApprove">
|
||||
update ftb_attendance_leave_approve
|
||||
set F_Undeducted_Time = #{dayNum},
|
||||
F_ApplicationDuration = #{applicationDuration},
|
||||
F_Type = #{leaveName},
|
||||
F_Status = 1,
|
||||
F_ApplicationDurationSecond = #{applicationDurationSecond},
|
||||
F_UndeductedTimeSecond = #{undeductedTimeSecond},
|
||||
F_ApproveUserId = #{userId},
|
||||
F_ApproveUserName = #{userName},
|
||||
F_ApproveTime = now(),
|
||||
F_ApplicationDurationDay = #{applicationDurationDay},
|
||||
F_UndeductedTimeDay = #{notDeductedDay},
|
||||
F_StartTimeHit = #{start},
|
||||
F_EndTimeHit = #{end},
|
||||
F_ShiftInvolved = #{leaveDurationJson},
|
||||
F_BalanceJsonNew = #{leaveConsumptionDetailJson}
|
||||
where F_Id = #{id}
|
||||
</update>
|
||||
<!-- 获取用户该类型的请假有多少未抵扣余额-->
|
||||
<select id="getUserUnDeductedTime" resultType="java.math.BigDecimal">
|
||||
SELECT IFNULL(SUM(F_Undeducted_Time),0)
|
||||
FROM ftb_attendance_leave_approve
|
||||
WHERE F_Type_Id = #{leaveTypeId} AND F_User_Id = #{userId} and F_Status = 1
|
||||
</select>
|
||||
<!-- 获取用户时间段内审核通过的请假审批列表-->
|
||||
<select id="getUserLeaveByTimeSlot" resultType="jnpf.model.attendance.vo.AttendanceLeaveApproveVo">
|
||||
SELECT a.F_Id id, a.F_User_Id userId, a.F_Type type,a.F_Unit unit, a.F_StartTime startTime, a.F_EndTime endTime,
|
||||
a.F_Balance_Status balanceStatus, a.F_Paid paid, a.F_No_Paid noPaid , a.F_Status `status`,
|
||||
a.F_StartTimeType startTimeType,a.F_EndTimeType endTimeType
|
||||
FROM ftb_attendance_leave_approve a
|
||||
where a.F_User_Id = #{userId} AND a.F_Status in (0,1)
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(a.F_StartTime,'%Y-%m-%d') <= DATE_FORMAT(#{endTime},'%Y-%m-%d')
|
||||
AND DATE_FORMAT(a.F_EndTime,'%Y-%m-%d') >= DATE_FORMAT(#{startTime},'%Y-%m-%d')
|
||||
]]>
|
||||
</select>
|
||||
<!-- <select id="getUserLeaveByTimeSlot" resultType="jnpf.model.attendance.vo.AttendanceLeaveApproveVo">-->
|
||||
<!-- SELECT a.F_Id id, a.F_User_Id userId, a.F_Type type,a.F_Unit unit, a.F_StartTime startTime, a.F_EndTime endTime, a.F_Balance_Status balanceStatus, a.F_Paid paid, a.F_No_Paid noPaid , a.F_Status `status`-->
|
||||
<!-- FROM ftb_attendance_daily_rule r-->
|
||||
<!-- LEFT JOIN ftb_attendance_leave_approve a ON r.F_ApplyId = a.F_Id AND F_AttendanceType = 3-->
|
||||
<!-- where a.F_User_Id = #{userId} AND a.F_Status = 1-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND DATE_FORMAT(a.F_StartTimeHit,'%Y-%m-%d %H:%i') < DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')-->
|
||||
<!-- AND DATE_FORMAT(a.F_EndTimeHit,'%Y-%m-%d %H:%i') > DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')-->
|
||||
<!-- ]]>-->
|
||||
<!-- UNION ALL-->
|
||||
<!-- select F_Id id, F_User_Id userId, F_Type type,F_Unit unit, F_StartTime startTime, F_EndTime endTime, F_Balance_Status balanceStatus, F_Paid paid, F_No_Paid noPaid , F_Status `status`-->
|
||||
<!-- from ftb_attendance_leave_approve-->
|
||||
<!-- where F_User_Id = #{userId} AND F_Status = 0-->
|
||||
<!-- <![CDATA[-->
|
||||
<!-- AND DATE_FORMAT(F_StartTimeHit,'%Y-%m-%d %H:%i') < DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')-->
|
||||
<!-- AND DATE_FORMAT(F_EndTimeHit,'%Y-%m-%d %H:%i') > DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')-->
|
||||
<!-- ]]>-->
|
||||
<!-- </select>-->
|
||||
<!-- 获取指定加班审批详情-->
|
||||
<select id="getWorkOverTime" resultType="jnpf.model.attendance.vo.AttendanceWorkOverTimeVo">
|
||||
select F_Id id,
|
||||
F_User_Id userId,
|
||||
F_WorkDay workDay,
|
||||
F_StartTime startTime,
|
||||
F_EndTime endTime,
|
||||
F_Reason workOvertimeReason,
|
||||
F_ShiftInvolved shiftInvolved,
|
||||
F_Status status
|
||||
from ftb_attendance_work_overtime_approve
|
||||
where F_Id = #{id}
|
||||
</select>
|
||||
<!-- 修改加班审批的审批状态-->
|
||||
<update id="updateWorkOverTimeApprove">
|
||||
update ftb_attendance_work_overtime_approve
|
||||
set F_Status = #{status},
|
||||
F_ApproveUserId = #{userId},
|
||||
F_ApproveUserName = #{userName},
|
||||
F_ApproveTime = now(),
|
||||
F_ShiftInvolved = #{json}
|
||||
where F_Id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getSelfApprove" resultType="jnpf.model.attendance.vo.AttendanceSelfApproveVo">
|
||||
select F_Id id,
|
||||
F_Group_Id groupId,
|
||||
F_Group_Name groupName,
|
||||
F_Self_Group_Id selfGroupId,
|
||||
F_Self_Group_Name selfGroupName,
|
||||
F_Start_Time startTime,
|
||||
F_End_Time endTime,
|
||||
F_Departure_Time departureTime,
|
||||
F_Back_Time BackTime,
|
||||
F_Status status,
|
||||
F_CreatorUserId creatorUserId
|
||||
from ftb_attendance_self_approve
|
||||
where F_Id = #{id}
|
||||
</select>
|
||||
<!-- 获取借调用户集合-->
|
||||
<select id="getUserList" resultType="java.lang.String">
|
||||
select F_User_Id
|
||||
from ftb_attendance_self_approve_user
|
||||
where F_Self_Id = #{id}
|
||||
</select>
|
||||
<!-- 获取用户时间段内加班申请数量-->
|
||||
<select id="getUserWorkByTimeSlot" resultType="java.lang.Integer">
|
||||
select count(0)
|
||||
from ftb_attendance_work_overtime_approve
|
||||
where F_User_Id = #{userId} AND F_Status in (0,1)
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(F_StartTime,'%Y-%m-%d %H:%i') < DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')
|
||||
AND DATE_FORMAT(F_EndTime,'%Y-%m-%d %H:%i') > DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 获取外出审批详情-->
|
||||
<select id="getGoOut" resultType="jnpf.model.attendance.vo.attendance.GoOutVo">
|
||||
SELECT F_Id id,F_User_Id userId,F_StartTime startTime,F_EndTime endTime,F_DayNum dayNum,F_Reason reason,F_Unit unit
|
||||
FROM ftb_attendance_go_out_approve
|
||||
WHERE F_Id = #{applyId}
|
||||
</select>
|
||||
<!-- 获取出差审批详情-->
|
||||
<select id="getBusinessTrip" resultType="jnpf.model.attendance.vo.attendance.BusinessTripVo">
|
||||
SELECT F_Id id,F_User_Id userId,F_Departure departure,F_Destination destination,F_StartTime startTime,F_EndTime endTime,F_DayNum dayNum,F_Transportation_Vehicles transportationVehicles,F_Reason reason
|
||||
FROM ftb_attendance_business_trip_approve
|
||||
WHERE F_Id = #{applyId}
|
||||
</select>
|
||||
<!-- 获取用户时间段内审核通过的请假审批列表-->
|
||||
<select id="getUserPassLeaveByTime" resultType="jnpf.model.attendance.vo.AttendanceLeaveApproveVo">
|
||||
select F_Id id, F_User_Id userId, F_Type type,F_Unit unit, F_StartTime startTime, F_EndTime endTime, F_Balance_Status balanceStatus, F_Paid paid, F_No_Paid noPaid , F_Status `status`
|
||||
from ftb_attendance_leave_approve
|
||||
where F_User_Id = #{userId} AND F_Status = 1
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(F_StartTime,'%Y-%m-%d %H:%i') < DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')
|
||||
AND DATE_FORMAT(F_EndTime,'%Y-%m-%d %H:%i') > DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')
|
||||
]]>
|
||||
</select>
|
||||
<select id="getBatchLeaveByUserIds" resultType="jnpf.model.attendance.vo.LeaveStaVo">
|
||||
select
|
||||
fala.F_User_Id userId,
|
||||
fals.F_Id leaveId,
|
||||
fals.F_Name leaveName,
|
||||
fala.F_StartTime startTime,
|
||||
fala.F_EndTime endTime,
|
||||
fala.F_BalanceJsonNew leaveJson
|
||||
from ftb_attendance_leave_approve fala
|
||||
left join ftb_attendance_leave_rules fals ON fala.F_Type_Id = fals.F_Id
|
||||
where F_Status = 1 and fala.F_BalanceJsonNew is not null
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(F_StartTime,'%Y-%m-%d %H:%i') < DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')
|
||||
AND DATE_FORMAT(F_EndTime,'%Y-%m-%d %H:%i') > DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')
|
||||
]]>
|
||||
AND F_User_Id in
|
||||
<foreach collection="userIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
group by fala.F_User_Id,fala.F_Id
|
||||
</select>
|
||||
|
||||
<select id="getUserPassWorkByTime" resultType="java.lang.Integer">
|
||||
select count(0)
|
||||
from ftb_attendance_work_overtime_approve
|
||||
where F_User_Id = #{userId} AND F_Status = 1
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(F_StartTime,'%Y-%m-%d %H:%i') < DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')
|
||||
AND DATE_FORMAT(F_EndTime,'%Y-%m-%d %H:%i') > DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 修改借调审批为通过-->
|
||||
<update id="updateSelfApprove">
|
||||
update ftb_attendance_self_approve
|
||||
set F_Status = #{status} ,
|
||||
F_Departure_Time = #{departureTime},
|
||||
F_Back_Time = #{backTime},
|
||||
F_ApproveUserId = #{userId},
|
||||
F_ApproveUserName = #{userName},
|
||||
F_ApproveTime = now()
|
||||
where F_Id = #{id}
|
||||
</update>
|
||||
<!-- 将对应审批变为未通过-->
|
||||
<update id="updateLeaveApproveStatus">
|
||||
update ftb_attendance_leave_approve
|
||||
set F_Status = #{status},
|
||||
F_ApproveUserId = #{userId},
|
||||
F_ApproveUserName = #{userName},
|
||||
F_ApproveTime = now()
|
||||
where F_Id = #{id}
|
||||
</update>
|
||||
<!-- 修改外出审批状态-->
|
||||
<update id="updateGoOutApprove">
|
||||
update ftb_attendance_go_out_approve
|
||||
set F_Status = #{status},
|
||||
F_ApproveUserId = #{userId},
|
||||
F_ApproveUserName = #{userName},
|
||||
F_ApproveTime = now()
|
||||
where F_Id = #{applyId}
|
||||
</update>
|
||||
<!-- 修改出差审批状态-->
|
||||
<update id="updateBusinessTripApprove">
|
||||
update ftb_attendance_business_trip_approve
|
||||
set F_Status = #{status},
|
||||
F_ApproveUserId = #{userId},
|
||||
F_ApproveUserName = #{userName},
|
||||
F_ApproveTime = now()
|
||||
where F_Id = #{applyId}
|
||||
</update>
|
||||
<select id="getUserLeaveList" resultType="jnpf.model.attendance.model.LeaveSituationData">
|
||||
select fala.F_Id applyId,
|
||||
fala.F_User_Id userId,
|
||||
fala.F_Unit unit,
|
||||
fala.F_StartTime startTime,
|
||||
fala.F_StartTimeType startTimeType,
|
||||
fala.F_EndTime endTime,
|
||||
fala.F_EndTimeType endTimeType,
|
||||
fals.F_Id leaveId,
|
||||
fals.F_Name leaveName,
|
||||
fals.F_BuiltIn isRest,
|
||||
fala.F_ShiftInvolved shiftInvolved,
|
||||
fala.F_BalanceJsonNew balanceJsonNew
|
||||
from ftb_attendance_leave_approve fala
|
||||
left join ftb_attendance_leave_type fals ON fala.F_Type_Id = fals.F_Id
|
||||
where fala.F_Status = 1
|
||||
and fala.F_GroupId = #{groupId}
|
||||
and fala.F_User_Id = #{userId}
|
||||
<![CDATA[
|
||||
and DATE_FORMAT(fala.F_StartTime, '%Y-%m-%d %H:%i') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i')
|
||||
and DATE_FORMAT(fala.F_EndTime, '%Y-%m-%d %H:%i') >= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i')
|
||||
]]>
|
||||
</select>
|
||||
<select id="getUserLeaveListByApplyIds" resultType="jnpf.model.attendance.model.LeaveSituationData">
|
||||
select
|
||||
fala.F_Id applyId,
|
||||
fala.F_GroupId groupId,
|
||||
fala.F_User_Id userId,
|
||||
fala.F_Unit unit,
|
||||
fala.F_StartTime startTime,
|
||||
fala.F_EndTime endTime,
|
||||
fals.F_Id leaveId,
|
||||
fals.F_Name leaveName,
|
||||
fals.F_BuiltIn isRest,
|
||||
fala.F_ShiftInvolved shiftInvolved,
|
||||
fala.F_BalanceJsonNew balanceJsonNew
|
||||
from ftb_attendance_leave_approve fala
|
||||
left join ftb_attendance_leave_type fals ON fala.F_Type_Id = fals.F_Id
|
||||
where fala.F_Status = 1 and fala.F_Id in
|
||||
<foreach collection="applyIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- 获取指定用户指定日期的加班申请列表-->
|
||||
<select id="getApplyWorkOverTimeList" resultType="jnpf.model.attendance.vo.DailyApprovalVo">
|
||||
SELECT DISTINCT a.F_Id taskId, '加班申请' as approvalName ,CONCAT_WS('~',DATE_FORMAT(a.F_StartTime,'%Y-%m-%d %H:%i'),DATE_FORMAT(a.F_EndTime,'%Y-%m-%d %H:%i')) AS applyTime , a.F_CreatorTime as submitTime,a.F_ApproveTime as approvalTime,a.F_ApproveUserId lastApprovalUserId,a.F_ApproveUserName lastApprovalUserName,a.F_Status lastResult ,a.F_Reason reason
|
||||
FROM ftb_attendance_work_overtime_approve a
|
||||
LEFT JOIN ftb_attendance_daily_rule r ON a.F_Id = r.F_ApplyId AND r.F_AttendanceType = #{code}
|
||||
WHERE a.F_User_Id = #{userId} AND a.F_Status !=3 AND r.F_GroupId = #{currentGroupId}
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(a.F_StartTime,'%Y-%m-%d') <= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
AND DATE_FORMAT(a.F_EndTime,'%Y-%m-%d') >= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 获取指定用户指定日期的出差申请列表-->
|
||||
<select id="getApplyGoOutList" resultType="jnpf.model.attendance.vo.DailyApprovalVo">
|
||||
SELECT DISTINCT a.F_Id taskId, '外出申请' as approvalName ,
|
||||
IF(a.F_Unit = 1 ,CONCAT_WS('~',DATE_FORMAT(a.F_StartTime,'%Y-%m-%d %H:%i'),DATE_FORMAT(a.F_EndTime,'%Y-%m-%d %H:%i')),
|
||||
if(a.F_Unit = 2 ,CONCAT_WS('~',DATE_FORMAT(a.F_StartTime,'%Y-%m-%d'),DATE_FORMAT(a.F_EndTime,'%Y-%m-%d')),
|
||||
CONCAT_WS('~',DATE_FORMAT(a.F_StartTime,'%Y-%m-%d'),DATE_FORMAT(a.F_EndTime,'%Y-%m-%d'))
|
||||
)) AS applyTime ,
|
||||
a.F_CreatorTime as submitTime,a.F_ApproveTime as approvalTime,a.F_ApproveUserId lastApprovalUserId,a.F_ApproveUserName lastApprovalUserName,a.F_Status lastResult ,a.F_Reason reason
|
||||
FROM ftb_attendance_go_out_approve a
|
||||
LEFT JOIN ftb_attendance_daily_rule r ON a.F_Id = r.F_ApplyId AND r.F_AttendanceType = #{code}
|
||||
WHERE a.F_User_Id = #{userId} AND a.F_Status !=3 AND r.F_GroupId = #{currentGroupId}
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(a.F_StartTime,'%Y-%m-%d') <= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
AND DATE_FORMAT(a.F_EndTime,'%Y-%m-%d') >= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 获取指定用户指定日期的请假申请列表-->
|
||||
<select id="getApplyLeaveList" resultType="jnpf.model.attendance.vo.DailyApprovalVo">
|
||||
SELECT DISTINCT a.F_Id taskId, '请假申请' as approvalName ,
|
||||
CASE
|
||||
WHEN a.F_Unit = 1 THEN CONCAT_WS('~', DATE_FORMAT(a.F_StartTime, '%Y-%m-%d %H:%i'), DATE_FORMAT(a.F_EndTime, '%Y-%m-%d %H:%i'))
|
||||
WHEN a.F_Unit = 2 THEN CONCAT_WS('~', DATE_FORMAT(a.F_StartTime, '%Y-%m-%d'), DATE_FORMAT(a.F_EndTime, '%Y-%m-%d'))
|
||||
ELSE CONCAT_WS('~',
|
||||
IF(a.F_StartTimeType = 1, CONCAT_WS(' ', DATE_FORMAT(a.F_StartTime, '%Y-%m-%d'), '上半天'), CONCAT_WS(' ', DATE_FORMAT(a.F_StartTime, '%Y-%m-%d'), '下半天')),
|
||||
IF(a.F_EndTimeType = 1, CONCAT_WS(' ', DATE_FORMAT(a.F_EndTime, '%Y-%m-%d'), '上半天'), CONCAT_WS(' ', DATE_FORMAT(a.F_EndTime, '%Y-%m-%d'), '下半天'))
|
||||
)
|
||||
END AS applyTime,
|
||||
a.F_CreatorTime as submitTime,a.F_ApproveTime as approvalTime,a.F_ApproveUserId lastApprovalUserId,a.F_ApproveUserName lastApprovalUserName,a.F_Status lastResult ,a.F_ReasonForLeave reason
|
||||
FROM ftb_attendance_leave_approve a
|
||||
LEFT JOIN ftb_attendance_daily_rule r ON a.F_Id = r.F_ApplyId AND r.F_AttendanceType = #{code}
|
||||
WHERE a.F_User_Id = #{userId} AND a.F_Status !=3 AND r.F_GroupId = #{currentGroupId}
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(a.F_StartTime,'%Y-%m-%d') <= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
AND DATE_FORMAT(a.F_EndTime,'%Y-%m-%d') >= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 获取指定用户指定日期的借调申请列表-->
|
||||
<select id="getApplySelfList" resultType="jnpf.model.attendance.vo.DailyApprovalVo">
|
||||
SELECT DISTINCT sa.F_Id taskId, '借调申请' as approvalName ,CONCAT_WS('~',DATE_FORMAT(F_Start_Time,'%Y-%m-%d %H:%i'),DATE_FORMAT(F_End_Time,'%Y-%m-%d %H:%i')) AS applyTime , F_CreatorTime as submitTime,F_ApproveTime as approvalTime,F_ApproveUserId lastApprovalUserId,F_ApproveUserName lastApprovalUserName,F_Status lastResult
|
||||
FROM ftb_attendance_self_approve sa
|
||||
LEFT JOIN ftb_attendance_self_approve_user sau ON sau.F_Self_Id = sa.F_Id
|
||||
WHERE sau.F_User_Id = #{userId} AND sa.F_Status !=3 AND (sa.F_Group_Id = #{currentGroupId} OR sa.F_Self_Group_Id = #{currentGroupId})
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(F_Start_Time,'%Y-%m-%d') <= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
AND DATE_FORMAT(F_End_Time,'%Y-%m-%d') >= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 获取指定用户指定日期的出差申请列表-->
|
||||
<select id="getApplyBusinessTripList" resultType="jnpf.model.attendance.vo.DailyApprovalVo">
|
||||
SELECT DISTINCT a.F_Id taskId, '出差申请' as approvalName , CONCAT_WS('~',DATE_FORMAT(a.F_StartTime,'%Y-%m-%d'),DATE_FORMAT(a.F_EndTime,'%Y-%m-%d')) AS applyTime , a.F_CreatorTime as submitTime,a.F_ApproveTime as approvalTime,a.F_ApproveUserId lastApprovalUserId,a.F_ApproveUserName lastApprovalUserName,a.F_Status lastResult ,a.F_Reason reason
|
||||
FROM ftb_attendance_business_trip_approve a
|
||||
LEFT JOIN ftb_attendance_daily_rule r ON a.F_Id = r.F_ApplyId AND r.F_AttendanceType = #{code}
|
||||
WHERE a.F_User_Id = #{userId} AND a.F_Status !=3 AND r.F_GroupId = #{currentGroupId}
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(a.F_StartTime,'%Y-%m-%d') <= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
AND DATE_FORMAT(a.F_EndTime,'%Y-%m-%d') >= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 获取指定用户指定日期的外出申请数量-->
|
||||
<select id="getUserGoOutByTimeSlot" resultType="java.lang.Integer">
|
||||
select count(0)
|
||||
from ftb_attendance_go_out_approve
|
||||
where F_User_Id = #{userId} AND F_Status = 1
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(F_StartTime,'%Y-%m-%d %H:%i') < DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')
|
||||
AND DATE_FORMAT(F_EndTime,'%Y-%m-%d %H:%i') > DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 获取指定用户指定日期的出差申请数量-->
|
||||
<select id="getUserBusinessTripByTimeSlot" resultType="java.lang.Integer">
|
||||
select count(0)
|
||||
from ftb_attendance_business_trip_approve
|
||||
where F_User_Id = #{userId} AND F_Status in (0,1)
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(F_StartTime,'%Y-%m-%d %H:%i') < DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')
|
||||
AND DATE_FORMAT(F_EndTime,'%Y-%m-%d %H:%i') > DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 获取指定用户指定日期的申请中的外出申请列表-->
|
||||
<select id="getApplyingGoOutList" resultType="jnpf.model.attendance.vo.DailyApprovalVo">
|
||||
SELECT DISTINCT a.F_Id, '外出申请' as approvalName ,
|
||||
IF(a.F_Unit = 1 ,CONCAT_WS('~',DATE_FORMAT(a.F_StartTime,'%Y-%m-%d %H:%i'),DATE_FORMAT(a.F_EndTime,'%Y-%m-%d %H:%i')),
|
||||
if(a.F_Unit = 2 ,CONCAT_WS('~',DATE_FORMAT(a.F_StartTime,'%Y-%m-%d'),DATE_FORMAT(a.F_EndTime,'%Y-%m-%d')),
|
||||
CONCAT_WS('~',DATE_FORMAT(a.F_StartTime,'%Y-%m-%d'),DATE_FORMAT(a.F_EndTime,'%Y-%m-%d'))
|
||||
)
|
||||
) AS applyTime ,
|
||||
a.F_CreatorTime as submitTime,a.F_ApproveTime as approvalTime,a.F_ApproveUserId lastApprovalUserId,a.F_ApproveUserName lastApprovalUserName,a.F_Status lastResult ,a.F_Unit unit ,a.F_Reason reason
|
||||
FROM ftb_attendance_go_out_approve a
|
||||
|
||||
WHERE a.F_User_Id = #{userId} AND (a.F_Status =0 OR a.F_Status =2)
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(a.F_StartTime,'%Y-%m-%d') <= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
AND DATE_FORMAT(a.F_EndTime,'%Y-%m-%d') >= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 获取指定用户指定日期的申请中的请假申请列表-->
|
||||
<select id="getApplyingLeaveList" resultType="jnpf.model.attendance.vo.DailyApprovalVo">
|
||||
SELECT DISTINCT a.F_Id taskId, '请假申请' as approvalName ,
|
||||
CASE
|
||||
WHEN a.F_Unit = 1 THEN CONCAT_WS('~', DATE_FORMAT(a.F_StartTime, '%Y-%m-%d %H:%i'), DATE_FORMAT(a.F_EndTime, '%Y-%m-%d %H:%i'))
|
||||
WHEN a.F_Unit = 2 THEN CONCAT_WS('~', DATE_FORMAT(a.F_StartTime, '%Y-%m-%d'), DATE_FORMAT(a.F_EndTime, '%Y-%m-%d'))
|
||||
ELSE CONCAT_WS('~',
|
||||
IF(a.F_StartTimeType = 1, CONCAT_WS(' ', DATE_FORMAT(a.F_StartTime, '%Y-%m-%d'), '上半天'), CONCAT_WS(' ', DATE_FORMAT(a.F_StartTime, '%Y-%m-%d'), '下半天')),
|
||||
IF(a.F_EndTimeType = 1, CONCAT_WS(' ', DATE_FORMAT(a.F_EndTime, '%Y-%m-%d'), '上半天'), CONCAT_WS(' ', DATE_FORMAT(a.F_EndTime, '%Y-%m-%d'), '下半天'))
|
||||
)
|
||||
END AS applyTime,
|
||||
a.F_CreatorTime as submitTime,a.F_ApproveTime as approvalTime,a.F_ApproveUserId lastApprovalUserId,a.F_ApproveUserName lastApprovalUserName,a.F_Status lastResult ,a.F_ReasonForLeave reason
|
||||
FROM ftb_attendance_leave_approve a
|
||||
WHERE a.F_User_Id = #{userId} AND (a.F_Status =0 OR a.F_Status =2)
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(a.F_StartTime,'%Y-%m-%d') <= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
AND DATE_FORMAT(a.F_EndTime,'%Y-%m-%d') >= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 获取指定用户指定日期的申请中的出差申请列表-->
|
||||
<select id="getApplyingBusinessTripList" resultType="jnpf.model.attendance.vo.DailyApprovalVo">
|
||||
SELECT DISTINCT a.F_Id taskId, '出差申请' as approvalName , CONCAT_WS('~',DATE_FORMAT(a.F_StartTime,'%Y-%m-%d'),DATE_FORMAT(a.F_EndTime,'%Y-%m-%d')) AS applyTime , a.F_CreatorTime as submitTime,a.F_ApproveTime as approvalTime,a.F_ApproveUserId lastApprovalUserId,a.F_ApproveUserName lastApprovalUserName,a.F_Status lastResult ,a.F_Reason reason
|
||||
FROM ftb_attendance_business_trip_approve a
|
||||
WHERE a.F_User_Id = #{userId} AND (a.F_Status =0 OR a.F_Status =2)
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(a.F_StartTime,'%Y-%m-%d') <= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
AND DATE_FORMAT(a.F_EndTime,'%Y-%m-%d') >= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 获取指定用户指定日期的申请中的加班申请列表-->
|
||||
<select id="getApplyingWorkOverTimeList" resultType="jnpf.model.attendance.vo.DailyApprovalVo">
|
||||
SELECT DISTINCT a.F_Id taskId, '加班申请' as approvalName ,CONCAT_WS('~',DATE_FORMAT(a.F_StartTime,'%Y-%m-%d %H:%i'),DATE_FORMAT(a.F_EndTime,'%Y-%m-%d %H:%i')) AS applyTime , a.F_CreatorTime as submitTime,a.F_ApproveTime as approvalTime,a.F_ApproveUserId lastApprovalUserId,a.F_ApproveUserName lastApprovalUserName,a.F_Status lastResult ,a.F_Reason reason
|
||||
FROM ftb_attendance_work_overtime_approve a
|
||||
WHERE a.F_User_Id = #{userId} AND (a.F_Status =0 OR a.F_Status =2)
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(a.F_StartTime,'%Y-%m-%d') <= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
AND DATE_FORMAT(a.F_EndTime,'%Y-%m-%d') >= DATE_FORMAT(#{queryDate},'%Y-%m-%d')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 获取已审批的借调记录-->
|
||||
<select id="getSelfApproveList" resultType="jnpf.model.attendance.vo.AttendanceSelfApproveVo">
|
||||
select F_Id id,
|
||||
F_Group_Id groupId,
|
||||
F_Group_Name groupName,
|
||||
F_Self_Group_Id selfGroupId,
|
||||
F_Self_Group_Name selfGroupName,
|
||||
F_Start_Time startTime,
|
||||
F_End_Time endTime,
|
||||
F_Departure_Time departureTime,
|
||||
F_Back_Time BackTime,
|
||||
F_Status status,
|
||||
F_CreatorUserId creatorUserId
|
||||
from ftb_attendance_self_approve
|
||||
where
|
||||
F_Start_Time >= #{startTime} AND F_Start_Time <![CDATA[<=]]> #{endTime} and F_Status = 1
|
||||
</select>
|
||||
<!-- 获取指定用户指定日期的出差申请数量除开本次申请-->
|
||||
<select id="getBusinessTripForOa" resultType="java.lang.Integer">
|
||||
select count(0)
|
||||
from ftb_attendance_business_trip_approve
|
||||
where F_User_Id = #{userId} AND F_Status in (0,1) AND F_Id != #{taskId}
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(F_StartTime,'%Y-%m-%d %H:%i') <= DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')
|
||||
AND DATE_FORMAT(F_EndTime,'%Y-%m-%d %H:%i') >= DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')
|
||||
]]>
|
||||
</select>
|
||||
<!-- 获取指定用户指定日期的外出申请数量除开本次申请-->
|
||||
<select id="getUserGoOutForOa" resultType="java.lang.Integer">
|
||||
select count(0)
|
||||
from ftb_attendance_go_out_approve
|
||||
where F_User_Id = #{userId} AND F_Status in (0,1) AND F_Id != #{taskId} AND F_Unit = 1
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(F_StartTime,'%Y-%m-%d %H:%i') <= DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')
|
||||
AND DATE_FORMAT(F_EndTime,'%Y-%m-%d %H:%i') >= DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')
|
||||
]]>
|
||||
</select>
|
||||
<select id="getUserWorkByTimeSlotForOa" resultType="java.lang.Integer">
|
||||
select count(0)
|
||||
from ftb_attendance_work_overtime_approve
|
||||
where F_User_Id = #{userId} AND F_Status in (0,1) AND F_Id != #{taskId}
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(F_StartTime,'%Y-%m-%d %H:%i') <= DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')
|
||||
AND DATE_FORMAT(F_EndTime,'%Y-%m-%d %H:%i') >= DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')
|
||||
]]>
|
||||
</select>
|
||||
<select id="getUserGoOutForDay" resultType="java.lang.Integer">
|
||||
select count(0)
|
||||
from ftb_attendance_go_out_approve
|
||||
where F_User_Id = #{userId} AND F_Status in (0,1) AND F_Id != #{taskId} AND F_Unit = 2
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(F_StartTime,'%Y-%m-%d') <= DATE_FORMAT(#{endTime},'%Y-%m-%d')
|
||||
AND DATE_FORMAT(F_EndTime,'%Y-%m-%d') >= DATE_FORMAT(#{startTime},'%Y-%m-%d')
|
||||
]]>
|
||||
</select>
|
||||
<select id="checkSelfApprove" resultType="java.lang.String">
|
||||
select sau.F_User_Id
|
||||
from ftb_attendance_self_approve sa
|
||||
LEFT JOIN ftb_attendance_self_approve_user sau ON sau.F_Self_Id = sa.F_Id
|
||||
where F_Status = 0
|
||||
<if test="taskId != null">
|
||||
AND sa.F_Id != #{taskId}
|
||||
</if>
|
||||
AND sau.F_User_Id IN
|
||||
<foreach item="item" collection="userIds" separator="," close=")" open="(" index="">
|
||||
#{item}
|
||||
</foreach>
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(sa.F_Start_Time,'%Y-%m-%d %H:%i') <= DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')
|
||||
AND DATE_FORMAT(sa.F_End_Time,'%Y-%m-%d %H:%i') >= DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')
|
||||
]]>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceLeaveGrantSettingMapper" >
|
||||
</mapper>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceLeaveRulesMapper" >
|
||||
<update id="updateState">
|
||||
update ftb_attendance_leave_rules
|
||||
set F_State = #{state},
|
||||
F_LastModifyUserId = #{userId},
|
||||
F_LastModifyTime = now()
|
||||
where F_Id = #{id}
|
||||
</update>
|
||||
<update id="updateByLeaveTypeId">
|
||||
update ftb_attendance_leave_rules
|
||||
set F_ScopeOfAdaptation = -1
|
||||
where F_LeaveTypeId = #{leaveTypeId}
|
||||
</update>
|
||||
|
||||
<select id="list" resultType="jnpf.model.attendance.vo.attendance.AttendanceLeaveRulesVo">
|
||||
select F_Id as id,
|
||||
F_Name as name,
|
||||
F_Unit as unit,
|
||||
F_Duration as duration,
|
||||
F_DistributeBalance as distributeBalance,
|
||||
F_RetirementLeave as retirementLeave,
|
||||
F_ScopeOfAdaptation as scopeOfAdaptation,
|
||||
F_State as state
|
||||
from ftb_attendance_leave_rules
|
||||
where F_DeleteMark = 0 and F_LeaveTypeId = #{typeId}
|
||||
<if test="iText != null and iText != ''">
|
||||
and F_Name like concat('%', #{iText}, '%')
|
||||
</if>
|
||||
order by F_CreatorTime desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceLeaveSettingsMapper" >
|
||||
|
||||
<sql id="Base_Column_List" >
|
||||
F_Id, F_Name, F_Unit, F_Duration, F_Is_Negative, F_Upper_Limit, F_State, F_CreatorUserId,
|
||||
F_CreatorTime, F_LastModifyUserId, F_LastModifyTime, F_DeleteMark, F_DeleteTime,
|
||||
F_DeleteUserId, F_TenantId
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceLeaveTypeMapper" >
|
||||
</mapper>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceLocationSettingMapper" >
|
||||
|
||||
<!-- 查询考勤机名称 -->
|
||||
<select id="getMachineName" resultType="java.lang.String">
|
||||
select F_Name from ftb_attendance_location_setting
|
||||
where F_Type = 3 and F_Address = #{sn} and F_DeleteMark = 0
|
||||
order by F_CreatorTime desc limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceMachineLogMapper">
|
||||
|
||||
<!-- 查询日志列表 -->
|
||||
<select id="getLogList" resultType="jnpf.model.attendance.vo.attendance.LogMiniVo">
|
||||
select F_UserName userName, F_GroupName groupName, F_CreatorTime clockInTime from ftb_attendance_machine_log
|
||||
where F_Action = #{action}
|
||||
<![CDATA[
|
||||
and date_format(F_CreatorTime, '%Y-%m-%d') >= date_format(#{date}, '%Y-%m-%d') and instr(F_ParamJson, #{mac}) > 0
|
||||
]]>
|
||||
order by F_CreatorTime desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceMachineManageMapper">
|
||||
|
||||
<!-- 更新考勤机的考勤组关联 -->
|
||||
<update id="updateRelationGroup">
|
||||
update ftb_attendance_machine_manage set F_GroupIds = #{groupIds} where F_Id = #{id}
|
||||
</update>
|
||||
<!-- 查询考勤机绑定的考勤组 -->
|
||||
<select id="getGroupIdsByMachine" resultType="java.lang.String">
|
||||
select F_GroupIds from ftb_attendance_machine_manage where F_Id = #{machineId}
|
||||
</select>
|
||||
<!-- 查询总条数 -->
|
||||
<select id="getTotal" resultType="java.lang.Integer">
|
||||
select count(1) from ftb_attendance_machine_manage where F_DeleteMark = 0
|
||||
</select>
|
||||
<!-- 查询名称数量 -->
|
||||
<select id="getMachineNameCount" resultType="java.lang.Integer">
|
||||
select count(1) from ftb_attendance_machine_manage
|
||||
where F_DeleteMark = 0 and F_Name = #{name}
|
||||
<if test="null != id and '' != id">
|
||||
and F_Id != #{id}
|
||||
</if>
|
||||
</select>
|
||||
<!-- 查询mac数量 -->
|
||||
<select id="getMachineMacCount" resultType="java.lang.Integer">
|
||||
select count(1) from ftb_attendance_machine_manage
|
||||
where F_DeleteMark = 0 and F_Mac = #{mac}
|
||||
<if test="null != id and '' != id">
|
||||
and F_Id != #{id}
|
||||
</if>
|
||||
</select>
|
||||
<!-- 查询考勤机名称 -->
|
||||
<select id="getMachineName" resultType="java.lang.String">
|
||||
select F_Name from ftb_attendance_machine_manage
|
||||
where F_DeleteMark = 0 and F_Mac = #{mac}
|
||||
</select>
|
||||
<!-- 获取数据库时间 -->
|
||||
<select id="getDbTime" resultType="java.util.Date">
|
||||
select now()
|
||||
</select>
|
||||
<!-- 查询关联此考勤组的考勤机 -->
|
||||
<select id="getRelationMachineByGroupId" resultType="jnpf.entity.attendance.AttendanceMachineManage">
|
||||
select F_Id id, F_Name `name`, F_Mac mac, F_Type `type`, F_GroupIds groupIds
|
||||
from ftb_attendance_machine_manage
|
||||
where F_DeleteMark = 0 and instr(F_GroupIds, #{groupId}) > 0
|
||||
</select>
|
||||
<!-- 查询绑定了考勤机的考勤组 -->
|
||||
<select id="selectGroupBindMachine" resultType="java.lang.String">
|
||||
select GROUP_CONCAT(F_GroupIds) from ftb_attendance_machine_manage where F_DeleteMark = 0
|
||||
</select>
|
||||
<!-- 查询考勤机列表 -->
|
||||
<select id="getMachineList" resultType="jnpf.entity.attendance.AttendanceMachineManage">
|
||||
SELECT
|
||||
mm.F_Id as id,
|
||||
mm.F_Name AS `name`,
|
||||
mm.F_Mac AS `mac`,
|
||||
mm.F_Type AS `type`,
|
||||
mm.F_TypeName AS typeName,
|
||||
SUM(CASE WHEN rs.F_ScopeType = 2 THEN 1 ELSE 0 END) AS orgCount,
|
||||
SUM(CASE WHEN rs.F_ScopeType = 1 THEN 1 ELSE 0 END) AS userCount
|
||||
FROM ftb_attendance_machine_manage mm
|
||||
<if test="null != scopeType">
|
||||
INNER JOIN (
|
||||
SELECT DISTINCT rsFilter.F_RuleId
|
||||
FROM ftb_attendance_rule_scope rsFilter
|
||||
WHERE rsFilter.F_BizType = #{bizType}
|
||||
AND (
|
||||
rsFilter.F_ScopeType = #{scopeType} AND rsFilter.F_ScopeValue IN
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
) scope ON mm.F_Id = scope.F_RuleId
|
||||
</if>
|
||||
LEFT JOIN ftb_attendance_rule_scope rs
|
||||
ON mm.F_Id = rs.F_RuleId AND rs.F_BizType = #{bizType}
|
||||
WHERE mm.F_DeleteMark = 0
|
||||
<if test="null != machineKind and '' != machineKind">
|
||||
AND mm.F_Type = #{machineKind}
|
||||
</if>
|
||||
<if test="null != keywords and '' != keywords">
|
||||
AND INSTR(CONCAT(IFNULL(mm.F_Mac, ""), IFNULL(mm.F_Name, "")), #{keywords}) > 0
|
||||
</if>
|
||||
GROUP BY mm.F_Id, mm.F_Name, mm.F_Mac, mm.F_Type, mm.F_TypeName
|
||||
ORDER BY mm.F_CreatorTime desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,289 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceManagerPermissionMapper" >
|
||||
|
||||
<!-- 获取指定考勤组用户的权限结合(含子权限)-->
|
||||
<select id="queryGroupUser" resultType="jnpf.model.attendance.vo.AttendanceGroupAdminVo">
|
||||
SELECT
|
||||
fam.F_UserId userId,
|
||||
GROUP_CONCAT( fpd.F_Name ) curPermissionJson,
|
||||
GROUP_CONCAT( fpd2.F_Name ) childPermissionJson
|
||||
FROM
|
||||
ftb_attendance_manager_permission fam
|
||||
LEFT JOIN ftb_permission_dict fpd ON fpd.F_Id = fam.F_PermissionId
|
||||
AND fam.F_Type = 1 AND fpd.F_Parent != 0
|
||||
LEFT JOIN ftb_permission_dict fpd2 ON fpd2.F_Id = fam.F_PermissionId
|
||||
AND fam.F_Type = 2 AND fpd2.F_Parent != 0
|
||||
WHERE
|
||||
fam.F_DeleteMark = 0
|
||||
and
|
||||
fam.F_GroupId = #{groupId}
|
||||
GROUP BY
|
||||
fam.F_UserId
|
||||
</select>
|
||||
<!-- 批量获取指定考勤组列表用户的权限结合(含子权限)-->
|
||||
<select id="queryGroupUsers" resultType="jnpf.model.attendance.vo.AttendanceGroupAdminVo">
|
||||
SELECT
|
||||
fam.F_UserId userId,
|
||||
GROUP_CONCAT( fpd.F_Name ) curPermissionJson,
|
||||
GROUP_CONCAT( fpd2.F_Name ) childPermissionJson
|
||||
FROM
|
||||
ftb_attendance_manager_permission fam
|
||||
LEFT JOIN ftb_permission_dict fpd ON fpd.F_Id = fam.F_PermissionId
|
||||
AND fam.F_Type = 1 AND fpd.F_Parent != 0
|
||||
LEFT JOIN ftb_permission_dict fpd2 ON fpd2.F_Id = fam.F_PermissionId
|
||||
AND fam.F_Type = 2 AND fpd2.F_Parent != 0
|
||||
WHERE
|
||||
fam.F_DeleteMark = 0
|
||||
and
|
||||
fam.F_GroupId in
|
||||
<foreach collection="groupIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
fam.F_UserId
|
||||
</select>
|
||||
<!-- 获取用户管理员权限类型-->
|
||||
<select id="getByUserId" resultType="jnpf.entity.PermissionDict">
|
||||
SELECT
|
||||
fpd.F_Id id,
|
||||
fpd.F_Name name,
|
||||
fpd.F_Parent parent
|
||||
FROM
|
||||
ftb_permission_dict fpd
|
||||
LEFT JOIN ftb_attendance_manager_permission famp ON fpd.F_Id = famp.F_PermissionId
|
||||
where fpd.F_DeleteMark = 0
|
||||
and famp.F_GroupId = #{groupId}
|
||||
<if test="userId != null and userId != ''">
|
||||
and famp.F_UserId = #{userId}
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and famp.F_Type = #{type}
|
||||
</if>
|
||||
and fpd.F_ModuleType = #{moduleType}
|
||||
|
||||
</select>
|
||||
<!-- 批量获取指定考勤组列表及以上用户的超级管理员权限-->
|
||||
<select id="queryUserForCurrAndUpChildAndSuper" resultType="jnpf.model.attendance.vo.AttendancePermissionVo">
|
||||
select t.userId,t.groupId from (
|
||||
select p.F_UserId userId,p.F_GroupId groupId from ftb_attendance_manager_permission p where p.F_GroupId in
|
||||
<foreach collection="groupIdList" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and p.F_DeleteMark = 0
|
||||
union all
|
||||
select p.F_UserId userId,g.F_Id groupId from ftb_attendance_manager_permission p left join ftb_attendance_group g on p.F_GroupId =g.F_ParentId where p.F_Type = 2 and g.F_Id in
|
||||
<foreach collection="groupIdList" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and p.F_DeleteMark = 0
|
||||
|
||||
union all
|
||||
select p.F_UserId userId, "-1" groupId from ftb_attendance_manager_permission p WHERE p.F_Type = 0 and p.F_DeleteMark = 0
|
||||
) t
|
||||
GROUP BY t.userId,t.groupId
|
||||
</select>
|
||||
|
||||
<!-- 批量获取指定权限指定考勤组列表及以上用户的超级管理员权限-->
|
||||
<select id="queryPermissionBySpecify" resultType="jnpf.model.attendance.vo.AttendancePermissionVo">
|
||||
select t.userId,t.groupId from (
|
||||
select p.F_UserId userId,p.F_GroupId groupId from ftb_attendance_manager_permission p left join ftb_permission_dict d on d.F_Id = p.F_PermissionId where p.F_GroupId in
|
||||
<foreach collection="groupIdList" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and p.F_DeleteMark = 0
|
||||
and d.F_ModuleType = 1 and d.F_Name in
|
||||
<foreach collection="parentCodes" item="code" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
union all
|
||||
select p.F_UserId userId,g.F_Id groupId from ftb_attendance_manager_permission p left join ftb_attendance_group g on p.F_GroupId =g.F_ParentId left join ftb_permission_dict d on d.F_Id = p.F_PermissionId where p.F_Type = 2 and g.F_Id in
|
||||
<foreach collection="groupIdList" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and p.F_DeleteMark = 0
|
||||
and d.F_ModuleType = 2 and d.F_Name in
|
||||
<foreach collection="childCodes" item="code" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
union all
|
||||
select p.F_UserId userId, "-1" groupId from ftb_attendance_manager_permission p WHERE p.F_Type = 0 and p.F_DeleteMark = 0
|
||||
) t
|
||||
GROUP BY t.userId,t.groupId
|
||||
</select>
|
||||
|
||||
<!-- 获取考勤组管理员权限类型-->
|
||||
<select id="queryMyPermissions" resultType="jnpf.model.attendance.vo.AttendancePermissionVo">
|
||||
SELECT
|
||||
fpd.F_Id id,
|
||||
fpd.F_Name name,
|
||||
fpd.F_Code code,
|
||||
famp.F_GroupId groupId,
|
||||
famp.F_UserId userId,
|
||||
famp.F_Type
|
||||
FROM
|
||||
ftb_attendance_manager_permission famp
|
||||
LEFT JOIN ftb_permission_dict fpd ON fpd.F_Id = famp.F_PermissionId
|
||||
WHERE
|
||||
1 = 1
|
||||
ADN famp.F_DeleteMark = 0
|
||||
And famp.F_GroupId = #{groupId}
|
||||
<if test="type != null">
|
||||
AND famp.F_Type = #{type}
|
||||
</if>
|
||||
<if test="userId != null and userId != ''">
|
||||
AND famp.F_UserId = #{userId}
|
||||
</if>
|
||||
</select>
|
||||
<!-- 获取用户在考勤组列表里面的管理员权限集合-->
|
||||
<select id="queryInGroupIds" resultType="jnpf.model.attendance.vo.CurUserPermissionVo">
|
||||
SELECT
|
||||
famp.F_GroupId groupId,
|
||||
GROUP_CONCAT(fpd.F_Name) allPermissions
|
||||
|
||||
FROM
|
||||
ftb_attendance_manager_permission famp
|
||||
LEFT JOIN ftb_permission_dict fpd on fpd.F_Id = famp.F_PermissionId
|
||||
WHERE
|
||||
famp.F_Type = 2
|
||||
and famp.F_UserId = #{userId}
|
||||
and famp.F_GroupId in
|
||||
<foreach collection="groupIdList" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
GROUP BY famp.F_GroupId
|
||||
</select>
|
||||
<!-- 获取用户在指定考勤组的权限列表-->
|
||||
<select id="queryByGroupId" resultType="jnpf.model.attendance.vo.CurUserPermissionVo">
|
||||
SELECT
|
||||
famp.F_GroupId groupId,
|
||||
GROUP_CONCAT(fpd.F_Name) allPermissions
|
||||
|
||||
FROM
|
||||
ftb_attendance_manager_permission famp
|
||||
LEFT JOIN ftb_permission_dict fpd on fpd.F_Id = famp.F_PermissionId
|
||||
WHERE
|
||||
famp.F_Type = 2
|
||||
and famp.F_UserId = #{userId}
|
||||
and famp.F_GroupId = #{groupId}
|
||||
<if test="permissionName != null and permissionName != ''">
|
||||
and fpd.F_Name = #{permissionName}
|
||||
</if>
|
||||
GROUP BY famp.F_GroupId
|
||||
</select>
|
||||
<!-- 获取考勤组权限列表里面包含指定编码层级的考勤组列表-->
|
||||
<select id="queryGroupVoInGroupIds" resultType="jnpf.model.attendance.vo.AttendanceGroupVo">
|
||||
SELECT
|
||||
fag.F_Id id,
|
||||
fag.F_GroupName groupName,
|
||||
fag.F_DetailName detailName,
|
||||
fag.F_ParentId parentId,
|
||||
fag.F_LevelCode levelCode
|
||||
|
||||
FROM
|
||||
ftb_attendance_group fag
|
||||
LEFT JOIN ftb_attendance_manager_permission famp on famp.F_GroupId = fag.F_Id
|
||||
LEFT JOIN ftb_permission_dict fpd on fpd.F_Id = famp.F_PermissionId
|
||||
WHERE
|
||||
<foreach collection="levelCodeList" item="levelCode" open="(" separator="or" close=")">
|
||||
fag.F_LevelCode like concat("%",#{levelCode},"%")
|
||||
</foreach>
|
||||
and fag.F_DeleteMark = 0
|
||||
GROUP BY fag.F_Id
|
||||
</select>
|
||||
<!-- 获取考勤组的指定类型管理员及权限集合-->
|
||||
<select id="queryManagerByGroupIds" resultType="jnpf.model.attendance.vo.QueryGroupAdminVo">
|
||||
SELECT
|
||||
famp.F_UserId userId,
|
||||
GROUP_CONCAT(fpd.F_Name) permissions
|
||||
|
||||
FROM
|
||||
ftb_attendance_manager_permission famp
|
||||
LEFT JOIN ftb_permission_dict fpd on fpd.F_Id = famp.F_PermissionId
|
||||
WHERE 1=1
|
||||
|
||||
<if test="type != null">
|
||||
and famp.F_Type = #{type}
|
||||
</if>
|
||||
and famp.F_GroupId in
|
||||
<foreach collection="groupIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
GROUP BY famp.F_UserId
|
||||
</select>
|
||||
<!-- 获取用户在指定考勤组的权限列表-->
|
||||
<select id="queryGroupUserPermissionByUserId" resultType="jnpf.model.attendance.vo.AttendanceGroupAdminVo">
|
||||
SELECT
|
||||
fam.F_UserId userId,
|
||||
GROUP_CONCAT( fpd.F_Name ) curPermissionJson,
|
||||
GROUP_CONCAT( fpd2.F_Name ) childPermissionJson
|
||||
FROM
|
||||
ftb_attendance_manager_permission fam
|
||||
LEFT JOIN ftb_permission_dict fpd ON fpd.F_Id = fam.F_PermissionId
|
||||
AND fam.F_Type = 1 AND fpd.F_Parent != 0
|
||||
LEFT JOIN ftb_permission_dict fpd2 ON fpd2.F_Id = fam.F_PermissionId
|
||||
AND fam.F_Type = 2 AND fpd2.F_Parent != 0
|
||||
WHERE
|
||||
fam.F_DeleteMark = 0
|
||||
and
|
||||
fam.F_GroupId = #{groupId} AND fam.F_UserId = #{userId}
|
||||
GROUP BY
|
||||
fam.F_UserId
|
||||
</select>
|
||||
<!-- 批量保存考勤组管理员信息-->
|
||||
<insert id="batchSaveGroupAdmin">
|
||||
INSERT INTO ftb_attendance_manager_permission (F_Id, F_Type, F_GroupId, F_UserId, F_PermissionId, F_CreatorUserId, F_CreatorTime)
|
||||
VALUES
|
||||
<foreach collection ="curGroupAdminList" item="admin" separator =",">
|
||||
(#{admin.id}, #{admin.type}, #{admin.groupId}, #{admin.userId}, #{admin.permissionId}, #{admin.creatorUserId}, #{admin.creatorTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 更新用户考勤组管理员权限 -->
|
||||
<update id="updateUserGroupManagerPermission">
|
||||
UPDATE ftb_attendance_manager_permission
|
||||
SET F_GroupId = #{groupId1}
|
||||
WHERE F_GroupId = #{groupId} AND F_UserId = #{userId}
|
||||
</update>
|
||||
|
||||
<update id="updateBatchUserGroupManagerPermission">
|
||||
UPDATE ftb_attendance_manager_permission
|
||||
SET F_GroupId = #{groupId}
|
||||
WHERE F_GroupId = #{oldGroupId} AND F_UserId in
|
||||
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 获取用户在指定考勤组的权限列表-->
|
||||
<select id="getGroupManagerPermission" resultType="jnpf.entity.AttendanceManagerPermission">
|
||||
SELECT F_Id id,F_Type type,F_GroupId groupId,F_UserId userId,F_PermissionId permissionId,F_CreatorUserId creatorUserId
|
||||
FROM ftb_attendance_manager_permission
|
||||
WHERE F_GroupId = #{groupId} AND F_UserId = #{userId}
|
||||
</select>
|
||||
<!-- 获取用户集合在指定考勤组的权限信息-->
|
||||
<select id="getGroupManagerPermissionByUserIds" resultType="jnpf.entity.AttendanceManagerPermission">
|
||||
SELECT F_Id id,F_Type type,F_GroupId groupId,F_UserId userId,F_PermissionId permissionId,F_CreatorUserId creatorUserId
|
||||
FROM ftb_attendance_manager_permission
|
||||
WHERE F_GroupId = #{groupId} AND F_UserId in
|
||||
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- 批量添加-->
|
||||
<insert id="addBatch">
|
||||
INSERT INTO ftb_attendance_manager_permission
|
||||
(F_Id, F_Type, F_GroupId, F_UserId, F_PermissionId, F_CreatorUserId, F_CreatorTime)
|
||||
VALUES
|
||||
<foreach collection="addSchedules" item="admin" separator=",">
|
||||
(#{admin.id}, #{admin.type}, #{admin.groupId}, #{admin.userId}, #{admin.permissionId}, #{admin.creatorUserId}, now())
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 根据用户Id和考勤组Id删除对应的权限记录-->
|
||||
<delete id="deleteByGroupUserId">
|
||||
delete from ftb_attendance_manager_permission
|
||||
where F_GroupId = #{groupId} and F_UserId = #{userId}
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceNoticeMapper">
|
||||
|
||||
<!-- 可根据自己的需求,是否要使用 -->
|
||||
<resultMap type="jnpf.entity.attendance.AttendanceNoticeEntity" id="AttendanceNoticeMap">
|
||||
<result property="id" column="F_Id"/>
|
||||
<result property="type" column="F_Type"/>
|
||||
<result property="dataJson" column="F_DataJson"/>
|
||||
<result property="creatorTime" column="F_CreatorTime"/>
|
||||
<result property="creatorUserId" column="F_CreatorUserId"/>
|
||||
<result property="tenantId" column="F_TenantId"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,65 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceQuickTemplateMapper" >
|
||||
|
||||
<!-- 新增模板信息-->
|
||||
<insert id="saveTemplate">
|
||||
INSERT INTO ftb_attendance_quick_template
|
||||
(F_Id,F_Name,F_GroupId,F_CreatorTime,F_CreatorUserId )
|
||||
VALUES
|
||||
(#{dto.id},#{dto.name},#{dto.groupId},now(),#{userId})
|
||||
</insert>
|
||||
<insert id="saveClass">
|
||||
INSERT INTO ftb_attendance_quick_template_item_new (F_Id,F_TemplateId,F_Num,F_ShiftNameId,F_ShiftType,F_Sort,F_Type)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id},#{item.groupId},#{item.num},#{item.shiftNameId},#{item.shiftType},#{item.sort},#{item.type})
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 修改快速模板信息-->
|
||||
<update id="updateTemplate">
|
||||
update ftb_attendance_quick_template
|
||||
set F_Name = #{dto.name},
|
||||
F_GroupId = #{dto.groupId},
|
||||
F_LastModifyUserId = #{userId},
|
||||
F_LastModifyTime = now()
|
||||
where F_Id = #{dto.id}
|
||||
</update>
|
||||
<!-- 删除模板绑定的信息信息-->
|
||||
<delete id="deleteClass">
|
||||
DELETE FROM ftb_attendance_quick_template_item_new
|
||||
WHERE F_TemplateId = #{id}
|
||||
</delete>
|
||||
<delete id="deleteTemplateItem">
|
||||
UPDATE ftb_attendance_quick_template_item_new t1
|
||||
JOIN (
|
||||
SELECT F_Num
|
||||
FROM ftb_attendance_quick_template_item_new
|
||||
WHERE F_ShiftNameId = #{shiftNameId}
|
||||
AND F_Num IN
|
||||
<foreach collection="nums" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
) t2 ON t1.F_Num = t2.F_Num
|
||||
SET t1.F_Type = 0,
|
||||
t1.F_ShiftNameId = NULL
|
||||
WHERE t1.F_TemplateId = #{id}
|
||||
</delete>
|
||||
<!-- 获取考勤组快速模板集合-->
|
||||
<select id="getTemByGroupId" resultType="jnpf.model.attendance.vo.attendance.QuickTemVo">
|
||||
SELECT F_Id id,F_Name `name`
|
||||
FROM ftb_attendance_quick_template
|
||||
WHERE F_GroupId = #{groupId} and F_DeleteMark = 0
|
||||
ORDER BY F_CreatorTime DESC
|
||||
</select>
|
||||
<!-- 获取考勤组快速模板下班次集合信息-->
|
||||
<select id="getShiftByTemIds" resultType="jnpf.model.attendance.vo.attendance.ShiftNameVo">
|
||||
SELECT sn.F_Id id ,sn.F_Name `name` ,sn.F_ShortName shortName ,sn.F_Colour colour ,fc.F_ShiftType fixedType ,sn.F_Type shiftType ,fc.F_Num num,fc.F_Type type , fc.F_Sort fixedSort,fc.F_TemplateId templateId
|
||||
FROM ftb_attendance_quick_template_item_new fc
|
||||
LEFT JOIN ftb_attendance_shift_name sn ON sn.F_Id = fc.F_ShiftNameId
|
||||
WHERE fc.F_TemplateId IN
|
||||
<foreach collection="temIds" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceRepairMapper" >
|
||||
|
||||
<!-- 根据时间判定使用的配置 -->
|
||||
<select id="getAttendanceRepairByDate" resultType="jnpf.entity.attendance.AttendanceRepair">
|
||||
select F_Id id, F_GroupId groupId, F_UserId userId, F_GenerateYear generateYear, F_GenerateMonth generateMonth, F_GenerateDay generateDay,
|
||||
F_TotalNum totalNum, F_RepairNum repairNum, F_RepairRecord repairRecord, F_ExpireDate expireDate
|
||||
from ftb_attendance_repair
|
||||
where F_DeleteMark = 0
|
||||
and date(#{applyDate}) between
|
||||
date(concat(F_GenerateYear, '-', F_GenerateMonth, '-', F_GenerateDay))
|
||||
and F_ExpireDate and F_UserId = #{userId} and F_GroupId = #{groupId}
|
||||
order by F_CreatorTime desc limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceSelfApproveMapper" >
|
||||
|
||||
<sql id="Base_Column_List" >
|
||||
F_Id, F_Group_Id, F_Self_Group_Id, F_User_Id, F_Start_Time, F_End_Time, F_Departure_Time,
|
||||
f_flowtaskid, f_flowid, F_UniqueId, F_TenantId
|
||||
</sql>
|
||||
<!-- 时间段内存在多个考勤组查询对应的借调信息-->
|
||||
<select id="getSelfApprove" resultType="jnpf.model.attendance.vo.DailyRuleResultVo">
|
||||
SELECT F_Start_Time inPoint ,F_End_Time outPoint , F_Departure_Time departureTime,F_Back_Time backTime ,(
|
||||
select F_GroupName from ftb_attendance_group where F_Id = asa.F_Group_Id
|
||||
) groupName
|
||||
FROM ftb_attendance_self_approve asa
|
||||
LEFT JOIN ftb_attendance_self_approve_user asau ON asa.F_Id = asau.F_Self_Id
|
||||
WHERE asa.F_Status = 1 AND asau.F_User_Id = #{userId}
|
||||
<![CDATA[
|
||||
AND DATE_FORMAT(F_Start_Time,'%Y-%m-%d %H:%i') < DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i')
|
||||
AND DATE_FORMAT(F_End_Time,'%Y-%m-%d %H:%i') > DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i')
|
||||
]]>
|
||||
</select>
|
||||
|
||||
<!-- <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >-->
|
||||
<!-- delete from ftb_attendance_self_approve-->
|
||||
<!-- where F_Id = #{fId,jdbcType=VARCHAR}-->
|
||||
<!-- </delete>-->
|
||||
<!-- <insert id="insert" parameterType="com.shs.cts.util.domain.po.experience.AttendanceSelfApprove" >-->
|
||||
<!-- insert into ftb_attendance_self_approve (F_Id, F_Group_Id, F_Self_Group_Id, -->
|
||||
<!-- F_User_Id, F_Start_Time, F_End_Time, -->
|
||||
<!-- F_Departure_Time, f_flowtaskid, f_flowid, -->
|
||||
<!-- F_UniqueId, F_TenantId)-->
|
||||
<!-- values (#{fId,jdbcType=VARCHAR}, #{fGroupId,jdbcType=VARCHAR}, #{fSelfGroupId,jdbcType=VARCHAR}, -->
|
||||
<!-- #{fUserId,jdbcType=VARCHAR}, #{fStartTime,jdbcType=TIMESTAMP}, #{fEndTime,jdbcType=TIMESTAMP}, -->
|
||||
<!-- #{fDepartureTime,jdbcType=TIMESTAMP}, #{fFlowtaskid,jdbcType=VARCHAR}, #{fFlowid,jdbcType=VARCHAR}, -->
|
||||
<!-- #{fUniqueid,jdbcType=VARCHAR}, #{fTenantid,jdbcType=VARCHAR})-->
|
||||
<!-- </insert>-->
|
||||
<!-- -->
|
||||
<!-- <update id="updateByPrimaryKey" parameterType="com.shs.cts.util.domain.po.experience.AttendanceSelfApprove" >-->
|
||||
<!-- update ftb_attendance_self_approve-->
|
||||
<!-- set F_Group_Id = #{fGroupId,jdbcType=VARCHAR},-->
|
||||
<!-- F_Self_Group_Id = #{fSelfGroupId,jdbcType=VARCHAR},-->
|
||||
<!-- F_User_Id = #{fUserId,jdbcType=VARCHAR},-->
|
||||
<!-- F_Start_Time = #{fStartTime,jdbcType=TIMESTAMP},-->
|
||||
<!-- F_End_Time = #{fEndTime,jdbcType=TIMESTAMP},-->
|
||||
<!-- F_Departure_Time = #{fDepartureTime,jdbcType=TIMESTAMP},-->
|
||||
<!-- f_flowtaskid = #{fFlowtaskid,jdbcType=VARCHAR},-->
|
||||
<!-- f_flowid = #{fFlowid,jdbcType=VARCHAR},-->
|
||||
<!-- F_UniqueId = #{fUniqueid,jdbcType=VARCHAR},-->
|
||||
<!-- F_TenantId = #{fTenantid,jdbcType=VARCHAR}-->
|
||||
<!-- where F_Id = #{fId,jdbcType=VARCHAR}-->
|
||||
<!-- </update>-->
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceShiftNameSettingMapper" >
|
||||
<!-- 新增班次名称信息-->
|
||||
<insert id="save">
|
||||
INSERT INTO ftb_attendance_shift_name
|
||||
(F_Id,F_Name,F_ShortName,F_Colour,F_Type,F_GroupId,F_SettingId,F_CreatorUserId )
|
||||
VALUES
|
||||
(#{dto.id},#{dto.name},#{dto.shortName},#{dto.colour},#{dto.shiftType},#{dto.groupId},#{dto.settingId},#{dto.userId})
|
||||
</insert>
|
||||
|
||||
<!-- 保存班次名称信息-->
|
||||
<update id="update">
|
||||
update ftb_attendance_shift_name
|
||||
set F_Name = #{dto.name},
|
||||
F_ShortName = #{dto.shortName},
|
||||
F_Colour = #{dto.colour},
|
||||
F_Type = #{dto.shiftType},
|
||||
F_GroupId = #{dto.groupId},
|
||||
F_SettingId = #{dto.settingId},
|
||||
F_LastModifyUserId = #{dto.userId},
|
||||
F_LastModifyTime = now()
|
||||
where F_Id = #{dto.id}
|
||||
</update>
|
||||
<!-- 校验班次名称是否重复-->
|
||||
<select id="checkName" resultType="java.lang.Integer">
|
||||
SELECT COUNT(0) FROM ftb_attendance_shift_name
|
||||
WHERE F_GroupId = #{dto.groupId} AND F_DeleteMark = 0 AND F_Name = #{dto.name}
|
||||
<if test="dto.id != null and dto.id !=''">
|
||||
AND F_Id != #{dto.id}
|
||||
</if>
|
||||
</select>
|
||||
<!-- 获取班次名称信息详情-->
|
||||
<select id="getDetail" resultType="jnpf.model.attendance.vo.attendance.ShiftNameVo">
|
||||
select F_Id id,F_Name name,F_ShortName shortName,F_Colour colour,F_Type type,F_GroupId groupId,F_SettingId settingId, F_Enable enable
|
||||
from ftb_attendance_shift_name
|
||||
where F_Id = #{id} AND F_DeleteMark = 0
|
||||
</select>
|
||||
<!-- 删除原来的关联班次信息-->
|
||||
<delete id="deletePeriodByShiftId">
|
||||
DELETE FROM ftb_attendance_shift_setting_period
|
||||
WHERE F_ShiftId = #{id}
|
||||
</delete>
|
||||
<!-- 删除班次-->
|
||||
<update id="delete">
|
||||
update ftb_attendance_shift_name
|
||||
set F_DeleteMark = 1,
|
||||
F_DeleteUserId = #{userId},
|
||||
F_LastModifyTime = now()
|
||||
where F_Id = #{shiftNameId}
|
||||
</update>
|
||||
<!-- 修改班次状态-->
|
||||
<update id="updateEnable">
|
||||
update ftb_attendance_shift_name
|
||||
set F_Enable = #{enable},
|
||||
F_LastModifyUserId = #{userId},
|
||||
F_LastModifyTime = now()
|
||||
where F_Id = #{shiftNameId}
|
||||
</update>
|
||||
<!-- 修改排班基础配置-->
|
||||
<update id="updateByGroupId">
|
||||
update ftb_attendance_shift_setting
|
||||
set F_SystemType = #{systemType},
|
||||
F_LastModifyUserId = #{userId},
|
||||
F_LastModifyTime = now()
|
||||
where F_GroupId = #{groupId}
|
||||
</update>
|
||||
<!-- 获取固定排班班次详情-->
|
||||
<select id="getFixedClass" resultType="jnpf.model.attendance.vo.attendance.ShiftNameVo">
|
||||
SELECT sn.F_Id id ,sn.F_Name `name` ,sn.F_ShortName shortName ,sn.F_Colour colour ,fc.F_ShiftType fixedType ,sn.F_Type shiftType ,fc.F_Num num,fc.F_Type type , fc.F_Sort sort
|
||||
FROM ftb_attendance_fixed_class fc
|
||||
LEFT JOIN ftb_attendance_shift_name sn ON sn.F_Id = fc.F_ShiftNameId
|
||||
LEFT JOIN ftb_attendance_shift_setting ss ON ss.F_GroupId = fc.F_GroupId
|
||||
WHERE ss.F_GroupId = #{groupId}
|
||||
</select>
|
||||
<!-- 新增固定排班班次详情-->
|
||||
<insert id="saveFixedClass">
|
||||
INSERT INTO ftb_attendance_fixed_class (F_Id,F_GroupId,F_Num,F_ShiftNameId,F_ShiftType,F_Sort,F_Type)
|
||||
VALUES
|
||||
<foreach collection="fixedClassDtos" item="item" separator=",">
|
||||
(#{item.id},#{item.groupId},#{item.num},#{item.shiftNameId},#{item.shiftType},#{item.sort},#{item.type})
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 删除固定排班信息-->
|
||||
<select id="getListByGroupId" resultType="jnpf.model.attendance.vo.attendance.ShiftNameListVo">
|
||||
SELECT F_Id id,F_Name `name`,F_ShortName shortName,F_Colour colour,F_Type shiftType,F_Enable `enable`
|
||||
FROM ftb_attendance_shift_name
|
||||
WHERE F_GroupId = #{queryDto.groupId} AND F_DeleteMark = 0
|
||||
<if test="queryDto.enable != null ">
|
||||
AND F_Enable = #{queryDto.enable}
|
||||
</if>
|
||||
ORDER BY F_CreatorTime DESC
|
||||
</select>
|
||||
<!-- 获取考勤组班次列表-->
|
||||
<delete id="deleteFixedClass">
|
||||
DELETE FROM ftb_attendance_fixed_class
|
||||
WHERE F_GroupId = #{settingId}
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceUserBalanceMapper">
|
||||
<insert id="batchAddBalanceDetail">
|
||||
insert into ftb_attendance_user_balance_detail
|
||||
(F_Id,F_UserId,F_ObjectId,F_Content,F_Quota)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id},#{item.userId},#{item.objectId},#{item.content},#{item.quota})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getDetail" resultType="jnpf.model.attendance.vo.attendance.AttendanceUserBalanceDetailVo">
|
||||
select
|
||||
F_Id as id,
|
||||
F_ObjectId as objectId,
|
||||
F_Content as content,
|
||||
ROUND(F_Quota,2) as quota,
|
||||
F_CreatorTime as creatorTime
|
||||
from ftb_attendance_user_balance_detail
|
||||
where F_UserId = #{userId}
|
||||
<if test="id != null and '' != id">
|
||||
and F_ObjectId = #{id}
|
||||
</if>
|
||||
<if test="id == null or '' == id">
|
||||
and F_ObjectId is null
|
||||
</if>
|
||||
|
||||
ORDER BY F_CreatorTime DESC
|
||||
</select>
|
||||
<select id="getTotalBalance" resultType="java.math.BigDecimal">
|
||||
SELECT SUM(F_Balance) as totalBalance
|
||||
FROM ftb_attendance_balance_record
|
||||
WHERE F_User_Id = #{userId} AND F_State = 0 AND F_Over = 0 AND F_DeleteMark = 0
|
||||
<if test="balanceId != null">
|
||||
AND (( F_Object_Id = #{balanceId} AND F_Type = 2)
|
||||
<if test="isRetirementLeave">
|
||||
OR(F_Type = 3 )
|
||||
</if>
|
||||
)
|
||||
</if>
|
||||
<if test="balanceId == null">
|
||||
and F_Type = 3
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceUserBalanceRecordMapper" >
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceUserConfigMapper" >
|
||||
<!-- 新增用户配置-->
|
||||
<insert id="addUserConfig">
|
||||
insert into ftb_attence_user_config (F_Id, F_User_Id , F_User_Config )
|
||||
values (#{userConfigVo.id},#{userId},#{userConfigVo.configJson})
|
||||
</insert>
|
||||
<!-- 更新用户配置-->
|
||||
<update id="updateUSerConfig">
|
||||
update ftb_attence_user_config
|
||||
set F_User_Config = #{configJson}
|
||||
where F_User_Id = #{userId}
|
||||
</update>
|
||||
<!-- 获取用户配置-->
|
||||
<select id="getUserConfig" resultType="jnpf.model.attendance.vo.attendance.UserConfigVo">
|
||||
SELECT F_User_Config configJson
|
||||
FROM ftb_attence_user_config
|
||||
WHERE F_User_Id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceUserFaceMapper" >
|
||||
|
||||
<!-- 人脸列表 -->
|
||||
<select id="getUserFaceList" resultType="jnpf.model.attendance.vo.UserFaceDetailVo">
|
||||
select t.*, uf.F_Id as faceId, uf.F_FaceDataThumbnail as faceDataThumbnail, uf.F_SyncStatus syncStatus, uf.F_LastModifyTime as creatorTime
|
||||
from (
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
row(#{item.userId}, #{item.realName}, #{item.groupName}, #{item.bindingMachine}, #{item.orgName}, #{item.positionName}, #{item.workStatus})
|
||||
</foreach>
|
||||
) as t(userId, userName, groupName, bindingMachine, orgName, postName, workStatus)
|
||||
left join ftb_attendance_user_face uf on t.userId = uf.F_UserId and uf.F_DeleteMark = 0
|
||||
where 1 = 1
|
||||
<if test="null != queryDto.userName and '' != queryDto.userName">
|
||||
and instr(t.userName, #{queryDto.userName}) > 0
|
||||
</if>
|
||||
<if test="null != queryDto.setCheck and 1 == queryDto.setCheck">
|
||||
and uf.F_FaceData is not null
|
||||
</if>
|
||||
<if test="null != queryDto.setCheck and 2 == queryDto.setCheck">
|
||||
and uf.F_FaceData is null
|
||||
</if>
|
||||
<if test="0 == queryDto.syncStatus or 1 == queryDto.syncStatus">
|
||||
and uf.F_SyncStatus = #{queryDto.syncStatus}
|
||||
</if>
|
||||
order by uf.F_LastModifyTime desc
|
||||
</select>
|
||||
<select id="getNoThumbnail" resultType="jnpf.model.attendance.vo.UserFaceDetailVo">
|
||||
SELECT F_Id faceId , F_FaceData faceData
|
||||
FROM ftb_attendance_user_face
|
||||
WHERE F_DeleteMark = 0 AND F_FaceDataThumbnail IS NULL
|
||||
</select>
|
||||
<update id="updateUserFaceThumbnail">
|
||||
UPDATE ftb_attendance_user_face
|
||||
SET F_FaceDataThumbnail = #{userFaceDetailVos.faceDataThumbnail}
|
||||
WHERE F_Id = #{userFaceDetailVos.faceId}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?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="jnpf.attendance.mapper.AttendanceUserSettingMapper" >
|
||||
<!-- 更新配置-->
|
||||
<update id="update">
|
||||
UPDATE ftb_attendance_app_user_setting
|
||||
SET F_Status = #{attendanceAppUserSettingDto.status},
|
||||
F_Value = #{attendanceAppUserSettingDto.value}
|
||||
WHERE F_Id = #{attendanceAppUserSettingDto.id}
|
||||
</update>
|
||||
<!-- 查询是否重复-->
|
||||
<select id="getDetail" resultType="java.lang.String">
|
||||
SELECT F_Id
|
||||
FROM ftb_attendance_app_user_setting
|
||||
WHERE F_Type = #{attendanceAppUserSettingDto.type}
|
||||
<if test="null != attendanceAppUserSettingDto.type and attendanceAppUserSettingDto.type != 3">
|
||||
AND F_AssociationId = #{attendanceAppUserSettingDto.associationId}
|
||||
</if>
|
||||
<if test="null != attendanceAppUserSettingDto.type and attendanceAppUserSettingDto.type != 2">
|
||||
AND F_SettingId = #{attendanceAppUserSettingDto.settingId}
|
||||
</if>
|
||||
</select>
|
||||
<!-- 根据父级Id查询设置列表-->
|
||||
<select id="getSettingList" resultType="jnpf.model.attendance.vo.UserSettingVo">
|
||||
SELECT F_Id settingId,F_SettingName settingName,F_Code code ,F_Sort sort , F_PId pId ,F_SystemType type
|
||||
FROM ftb_attendance_app_setting
|
||||
WHERE F_SystemType = #{type}
|
||||
<if test="null != type and type == 1">
|
||||
AND F_PId = #{pId}
|
||||
</if>
|
||||
ORDER BY F_Sort ASC
|
||||
</select>
|
||||
<!-- 查询用户设置/考勤组设置-->
|
||||
<select id="getUserSetting" resultType="jnpf.model.attendance.vo.UserSettingVo">
|
||||
SELECT s.F_Id settingId,s.F_SettingName settingName ,s.F_Code code ,us.F_Status `status`,us.F_Value `value`, us.F_Id id
|
||||
FROM ftb_attendance_app_setting s
|
||||
LEFT JOIN ftb_attendance_app_user_setting us ON s.F_Id = us.F_SettingId
|
||||
WHERE F_Type = #{appUserSettingQueryDto.type} AND s.F_SystemType = #{appUserSettingQueryDto.type}
|
||||
<if test="null != appUserSettingQueryDto.PId and '' != appUserSettingQueryDto.PId ">
|
||||
AND s.F_PId = #{appUserSettingQueryDto.PId}
|
||||
</if>
|
||||
<if test="null != appUserSettingQueryDto.associationId and '' != appUserSettingQueryDto.associationId">
|
||||
AND us.F_AssociationId = #{appUserSettingQueryDto.associationId}
|
||||
</if>
|
||||
</select>
|
||||
<!-- 批量获取考勤组设置-->
|
||||
<select id="getGroupSetting" resultType="jnpf.model.attendance.vo.UserSettingVo">
|
||||
SELECT F_Status `status`,F_Value `value`, F_AssociationId associationId ,F_Id id
|
||||
FROM ftb_attendance_app_user_setting
|
||||
WHERE F_Type = #{type} AND F_AssociationId IN
|
||||
<foreach collection="groupIds" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</select>
|
||||
<!-- 根据用户编码及用户批量获取设置-->
|
||||
<select id="getUserSettingByCode" resultType="jnpf.model.attendance.vo.UserSettingVo">
|
||||
SELECT s.F_Code code ,us.F_Status `status`,us.F_Value `value` ,us.F_AssociationId associationId
|
||||
FROM ftb_attendance_app_user_setting us
|
||||
LEFT JOIN ftb_attendance_app_setting s ON s.F_Id = us.F_SettingId
|
||||
WHERE s.F_Code IN
|
||||
<foreach collection="code" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
<if test="null != associationId and associationId.size > 0">
|
||||
AND us.F_AssociationId IN
|
||||
<foreach collection="associationId" item="value1" separator="," open="(" close=")">
|
||||
#{value1}
|
||||
</foreach>
|
||||
</if>
|
||||
AND F_Type = #{type}
|
||||
</select>
|
||||
<!-- 新增配置-->
|
||||
<insert id="add">
|
||||
INSERT INTO ftb_attendance_app_user_setting (F_Id,F_SettingId,F_Type,F_AssociationId,F_Status,F_Value)
|
||||
VALUES(#{attendanceAppUserSettingDto.id},#{attendanceAppUserSettingDto.settingId},#{attendanceAppUserSettingDto.type},#{attendanceAppUserSettingDto.associationId},#{attendanceAppUserSettingDto.status},#{attendanceAppUserSettingDto.value})
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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="jnpf.attendance.mapper.ClockInResultMapper" >
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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="jnpf.attendance.mapper.ClockInResultV2Mapper" >
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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="jnpf.attendance.mapper.DailyRuleChangeMapper" >
|
||||
|
||||
<!-- 批量保存变更 -->
|
||||
<insert id="saveRecordBatch">
|
||||
INSERT INTO ftb_attendance_daily_rule_change (F_Id, F_GroupId, F_UserId, F_Day, F_TenantId)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id}, #{item.groupId}, #{item.userId}, #{item.day}, #{item.tenantId})
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
F_LastModifyTime = NOW()
|
||||
</insert>
|
||||
<!-- 删除小于当前时间的记录 -->
|
||||
<delete id="removeBatch">
|
||||
DELETE FROM ftb_attendance_daily_rule_change
|
||||
WHERE (
|
||||
<foreach collection="list" item="item" separator=" OR ">
|
||||
(F_GroupId = #{item.groupId} AND F_UserId = #{item.userId} AND F_Day = #{item.day} AND F_LastModifyTime < #{day})
|
||||
</foreach>
|
||||
)
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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="jnpf.attendance.mapper.DailyRuleMapper" >
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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="jnpf.attendance.mapper.EnableBalanceMapper">
|
||||
|
||||
<select id="getOvertimeSalary" resultType="jnpf.model.attendance.vo.attendance.OvertimeSalaryHoursVo">
|
||||
SELECT
|
||||
F_UserId userId,
|
||||
SUM(CASE WHEN F_OvertimeType = 1 THEN F_Balance ELSE 0 END) AS weekdayOvertimeSalaryDays,
|
||||
SUM(CASE WHEN F_OvertimeType = 3 THEN F_Balance ELSE 0 END) AS holidaysOvertimeSalaryDays,
|
||||
SUM(CASE WHEN F_OvertimeType = 2 THEN F_Balance ELSE 0 END) AS publicHolidaysOvertimeSalaryDays
|
||||
FROM ftb_attendance_enable_balance
|
||||
WHERE F_UserId IN
|
||||
<foreach item="item" collection="userIds" separator="," open="(" close=")" index="">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="startDate != null and endDate != null ">
|
||||
and F_Day between #{startDate} and #{endDate}
|
||||
</if>
|
||||
GROUP BY F_UserId
|
||||
</select>
|
||||
<select id="getOvertimeSalaryJson" resultType="jnpf.model.attendance.vo.attendance.OvertimeSalaryHoursJsonVo">
|
||||
SELECT
|
||||
F_UserId userId,
|
||||
F_Balance AS holidaysOvertimeSalaryDays,
|
||||
F_FestivalStr festivalStr
|
||||
FROM ftb_attendance_enable_balance
|
||||
WHERE
|
||||
F_OvertimeType = 3
|
||||
and F_FestivalStr is not null
|
||||
and F_UserId IN
|
||||
<foreach item="item" collection="userIds" separator="," open="(" close=")" index="">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="startDate != null and endDate != null ">
|
||||
and F_Day between #{startDate} and #{endDate}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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="jnpf.attendance.mapper.FtbAttendanceFaceChangeLogMapper" >
|
||||
|
||||
<!-- 变动记录列表 -->
|
||||
<select id="getChangeLogList" resultType="jnpf.model.attendance.vo.ChangeLogVo">
|
||||
select F_Id id, F_CreatorUserId creatorUserId, F_FaceId faceId, F_UserId userId, F_Content content, F_CreatorTime creatorTime
|
||||
from ftb_attendance_face_change_log where 1 = 1
|
||||
<if test="null != startDate and '' != startDate">
|
||||
<![CDATA[
|
||||
and DATE_FORMAT(F_CreatorTime, '%Y-%m-%d') >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
|
||||
]]>
|
||||
</if>
|
||||
<if test="null != endDate and '' != endDate">
|
||||
<![CDATA[
|
||||
and DATE_FORMAT(F_CreatorTime, '%Y-%m-%d') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
|
||||
]]>
|
||||
</if>
|
||||
<if test="null != list and list.size > 0">
|
||||
and F_UserId in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
order by F_CreatorTime desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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="jnpf.attendance.mapper.FtbScheduleGroupDrawingParamMapper">
|
||||
|
||||
<select id="selectLineRuleDtoByGroupId" resultType="jnpf.model.attendance.dto.scheduling.LineSchedulingRuleDto">
|
||||
SELECT
|
||||
t.F_Id AS id,
|
||||
t.F_MaxDailySegmentsEnabled AS maxDailySegmentsEnabled,
|
||||
t.F_MaxDailySegmentsValue AS maxDailySegmentsValue,
|
||||
t.F_MaxDailySegmentsPriority AS maxDailySegmentsPriority,
|
||||
t.F_MaxSingleSegmentHoursEnabled AS maxSingleSegmentHoursEnabled,
|
||||
t.F_MaxSingleSegmentHoursValue AS maxSingleSegmentHoursValue,
|
||||
t.F_MaxSingleSegmentHoursPriority AS maxSingleSegmentHoursPriority,
|
||||
t.F_MinSingleSegmentHoursEnabled AS minSingleSegmentHoursEnabled,
|
||||
t.F_MinSingleSegmentHoursValue AS minSingleSegmentHoursValue,
|
||||
t.F_MinSingleSegmentHoursPriority AS minSingleSegmentHoursPriority
|
||||
FROM ftb_attendance_group_drawing_param t
|
||||
WHERE t.F_GroupId = #{groupId}
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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="jnpf.attendance.mapper.FtbScheduleGroupFixedParamMapper">
|
||||
|
||||
<select id="selectFixedRuleDtoByGroupId" resultType="jnpf.model.attendance.dto.scheduling.FixedSchedulingRuleDto">
|
||||
SELECT
|
||||
t.F_Id AS id,
|
||||
t.F_DailyWorkHoursEnabled AS dailyWorkHoursEnabled,
|
||||
t.F_DailyWorkHoursValue AS dailyWorkHoursValue,
|
||||
t.F_DailyWorkHoursPriority AS dailyWorkHoursPriority,
|
||||
t.F_ConsecutiveWorkDaysEnabled AS consecutiveWorkDaysEnabled,
|
||||
t.F_ConsecutiveWorkDaysValue AS consecutiveWorkDaysValue,
|
||||
t.F_ConsecutiveWorkDaysPriority AS consecutiveWorkDaysPriority,
|
||||
t.F_WeeklyWorkDaysEnabled AS weeklyWorkDaysEnabled,
|
||||
t.F_WeeklyWorkDaysValue AS weeklyWorkDaysValue,
|
||||
t.F_WeeklyWorkDaysPriority AS weeklyWorkDaysPriority,
|
||||
t.F_WeeklyWorkHoursEnabled AS weeklyWorkHoursEnabled,
|
||||
t.F_WeeklyWorkHoursValue AS weeklyWorkHoursValue,
|
||||
t.F_WeeklyWorkHoursPriority AS weeklyWorkHoursPriority,
|
||||
t.F_MinRestBetweenShiftsEnabled AS minRestBetweenShiftsEnabled,
|
||||
t.F_MinRestBetweenShiftsValue AS minRestBetweenShiftsValue,
|
||||
t.F_MinRestBetweenShiftsPriority AS minRestBetweenShiftsPriority
|
||||
FROM ftb_attendance_group_fixed_param t
|
||||
WHERE t.F_GroupId = #{groupId}
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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="jnpf.attendance.mapper.InitializationMapper" >
|
||||
<!-- 初始化存休表-->
|
||||
<delete id="truncatStorageRest">
|
||||
delete FROM ftb_attendance_storage_rest
|
||||
</delete>
|
||||
<!-- 获取所有的用户劵逻辑-->
|
||||
<select id="getBalanceRecord" resultType="jnpf.model.attendance.vo.AttendanceBalanceRecordVo">
|
||||
SELECT F_Id id, F_Name `name`, F_User_Id userId, F_Balance balance, F_Total total, F_Unit unit, IFNULL(F_Expire_Time,DATE_FORMAT('2999-1-1','%Y-%m-%d')) expireTime, F_Grant_Way grantWay,
|
||||
F_State `state`, F_Over `over`, F_Paid paid, F_CreatorUserId creatoruserid, F_CreatorTime creatortime ,DATE_FORMAT(F_CreatorTime, '%Y-%m') creatorTimeStr
|
||||
FROM ftb_attendance_balance_record
|
||||
</select>
|
||||
<!-- 获取所有的用户劵逻辑-->
|
||||
<select id="getAllBalanceUseRecord" resultType="jnpf.model.attendance.vo.attendance.BalanceUseRecordVo">
|
||||
SELECT
|
||||
F_Balance_Id balanceId,
|
||||
F_Quota quota,
|
||||
F_Unit unit,
|
||||
F_Start_Time startTime,
|
||||
F_End_Time endTime,
|
||||
F_CreatorTime creatorTime
|
||||
FROM ftb_attendance_balance_use_record
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?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="jnpf.attendance.mapper.OvertimeRuleMapper">
|
||||
|
||||
<!-- 查询加班规则列表 -->
|
||||
<select id="selectOvertimeRulePage" resultType="jnpf.model.attendance.vo.attendance.OvertimeRulePageVo">
|
||||
SELECT
|
||||
r.F_Id AS id, r.F_RuleName AS ruleName, r.F_Enabled AS enabled,
|
||||
COALESCE(d.workRule, 0) AS workRule,
|
||||
COALESCE(d.restRule, 0) AS restRule,
|
||||
COALESCE(d.holidayRule, 0) AS holidayRule,
|
||||
CASE
|
||||
WHEN s.allCount > 0 THEN '全部'
|
||||
ELSE CONCAT(
|
||||
CASE
|
||||
WHEN COALESCE(s.orgCount, 0) > 0
|
||||
THEN CONCAT('【', s.orgCount, '个组织】')
|
||||
ELSE ''
|
||||
END,
|
||||
CASE
|
||||
WHEN COALESCE(s.orgCount, 0) > 0 AND COALESCE(s.userCount, 0) > 0
|
||||
THEN '、'
|
||||
ELSE ''
|
||||
END,
|
||||
CASE
|
||||
WHEN COALESCE(s.userCount, 0) > 0
|
||||
THEN CONCAT('【', s.userCount, '位成员】')
|
||||
ELSE ''
|
||||
END
|
||||
)
|
||||
END AS scope
|
||||
FROM ftb_attendance_overtime_rule r
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
F_RuleId,
|
||||
MAX(CASE WHEN F_OvertimeType = 1 AND F_Enabled = 1 THEN F_CalcMethod ELSE 0 END) AS workRule,
|
||||
MAX(CASE WHEN F_OvertimeType = 2 AND F_Enabled = 1 THEN F_CalcMethod ELSE 0 END) AS restRule,
|
||||
MAX(CASE WHEN F_OvertimeType = 3 AND F_Enabled = 1 THEN F_CalcMethod ELSE 0 END) AS holidayRule
|
||||
FROM ftb_attendance_overtime_rule_detail
|
||||
GROUP BY F_RuleId
|
||||
) d ON r.F_Id = d.F_RuleId
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
F_RuleId,
|
||||
SUM(CASE WHEN F_ScopeType = 3 THEN 1 ELSE 0 END) AS allCount,
|
||||
SUM(CASE WHEN F_ScopeType = 2 THEN 1 ELSE 0 END) AS orgCount,
|
||||
SUM(CASE WHEN F_ScopeType = 1 THEN 1 ELSE 0 END) AS userCount
|
||||
FROM ftb_attendance_rule_scope
|
||||
GROUP BY F_RuleId
|
||||
) s ON r.F_Id = s.F_RuleId
|
||||
WHERE r.F_DeleteMark = 0
|
||||
<if test="null != ruleName and '' != ruleName">
|
||||
AND INSTR(r.F_RuleName, #{ruleName}) > 0
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,124 @@
|
||||
<?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="jnpf.attendance.mapper.PublicHolidayRulesMapper" >
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO ftb_attendance_public_holiday_rules (
|
||||
F_Id, F_Name, F_Type, F_DayNum, F_TransformationType,
|
||||
F_LifespanType, F_FixedDay, F_SpecifyDay, F_ScopeOfAdaptation,
|
||||
F_State, F_CreatorTime, F_CreatorUserId, F_LastModifyTime, F_LastModifyUserId
|
||||
)
|
||||
VALUES (
|
||||
#{publicHolidayRulesDto.id}, #{publicHolidayRulesDto.name}, #{publicHolidayRulesDto.type}, #{publicHolidayRulesDto.dayNum}, #{publicHolidayRulesDto.transformationType},
|
||||
#{publicHolidayRulesDto.lifespanType}, #{publicHolidayRulesDto.fixedDay}, #{publicHolidayRulesDto.specifyDay}, #{publicHolidayRulesDto.scopeOfAdaptation},
|
||||
0, now(), #{userId}, now(), #{userId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
UPDATE ftb_attendance_public_holiday_rules
|
||||
SET
|
||||
F_Name = #{publicHolidayRulesDto.name},
|
||||
F_Type = #{publicHolidayRulesDto.type},
|
||||
F_DayNum = #{publicHolidayRulesDto.dayNum},
|
||||
F_TransformationType = #{publicHolidayRulesDto.transformationType},
|
||||
F_LifespanType = #{publicHolidayRulesDto.lifespanType},
|
||||
F_FixedDay = #{publicHolidayRulesDto.fixedDay},
|
||||
F_SpecifyDay = #{publicHolidayRulesDto.specifyDay},
|
||||
F_ScopeOfAdaptation = #{publicHolidayRulesDto.scopeOfAdaptation},
|
||||
F_LastModifyTime = now(),
|
||||
F_LastModifyUserId = #{userId}
|
||||
WHERE F_Id = #{publicHolidayRulesDto.id}
|
||||
</update>
|
||||
|
||||
<update id="updateState">
|
||||
UPDATE ftb_attendance_public_holiday_rules
|
||||
SET
|
||||
F_State = #{state},
|
||||
F_LastModifyTime = now(),
|
||||
F_LastModifyUserId = #{userId}
|
||||
WHERE F_Id = #{id}
|
||||
</update>
|
||||
<update id="updateScopeOfAdaptation">
|
||||
UPDATE ftb_attendance_public_holiday_rules
|
||||
SET F_ScopeOfAdaptation = -1
|
||||
</update>
|
||||
<delete id="deletePublicHolidayBalance">
|
||||
DELETE FROM ftb_attendance_public_holiday_balance
|
||||
WHERE F_YearMonth = #{yearMonth} AND F_UserId IN
|
||||
<foreach collection="userIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="list" resultType="jnpf.model.attendance.vo.attendance.AttendancePublicHolidayRulesVo">
|
||||
SELECT
|
||||
F_Id AS id,
|
||||
F_Name AS name,
|
||||
F_Type AS type,
|
||||
F_DayNum AS dayNum,
|
||||
F_TransformationType AS transformationType,
|
||||
F_ScopeOfAdaptation AS scopeOfAdaptation,
|
||||
F_State AS state
|
||||
FROM ftb_attendance_public_holiday_rules
|
||||
WHERE 1=1
|
||||
<if test="iText != null and iText != ''">
|
||||
AND F_Name LIKE CONCAT('%',#{iText},'%')
|
||||
</if>
|
||||
ORDER BY F_LastModifyTime DESC
|
||||
</select>
|
||||
|
||||
<select id="getBalanceList"
|
||||
resultType="jnpf.model.attendance.vo.attendance.AttendancePublicHolidayBalance">
|
||||
SELECT F_UserId userId, F_Total total
|
||||
FROM ftb_attendance_public_holiday_balance
|
||||
WHERE F_YearMonth = #{yearMonth} AND F_UserId IN
|
||||
<foreach collection="userIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getPublicHolidayBalanceList"
|
||||
resultType="jnpf.model.attendance.vo.attendance.AttendancePublicHolidayBalance">
|
||||
SELECT F_UserId userId, F_YearMonth yearMonth, F_Balance balance, F_Total total ,F_TransformationType transformationType
|
||||
FROM ftb_attendance_public_holiday_balance
|
||||
WHERE F_YearMonth = #{yearMonth} AND F_UserId IN
|
||||
<foreach collection="userIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<insert id="batchAddPublicHolidayBalance">
|
||||
INSERT INTO ftb_attendance_public_holiday_balance (
|
||||
F_Id, F_UserId, F_Balance, F_Total, F_YearMonth,F_TransformationType,F_AttendanceRatio
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="addList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.userId}, #{item.balance}, #{item.total}, #{yearMonth},#{item.transformationType},#{item.attendanceRatio}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getPublicHolidayTransferList" resultType="jnpf.model.attendance.vo.attendance.PublicHolidayTransferListVo">
|
||||
SELECT
|
||||
F_UserId userId,
|
||||
F_YearMonth yearMonth,
|
||||
F_Balance surplusDays,
|
||||
F_AttendanceRatio attendanceRatio
|
||||
FROM ftb_attendance_public_holiday_balance
|
||||
WHERE F_YearMonth = #{yearMonth}
|
||||
AND F_TransformationType = 0
|
||||
AND F_UserId IN
|
||||
<foreach collection="userIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="selectPublicHolidayBalanceList" resultType="java.lang.String">
|
||||
SELECT F_UserId
|
||||
FROM ftb_attendance_public_holiday_balance
|
||||
WHERE F_YearMonth = #{yearMonth} AND F_UserId IN
|
||||
<foreach collection="userIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,74 @@
|
||||
<?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="jnpf.attendance.mapper.RuleScopeMapper">
|
||||
|
||||
<!-- 查询用户生效中的规则 -->
|
||||
<select id="selectUserEffectList" resultType="jnpf.entity.attendance.AttendanceRuleScope">
|
||||
SELECT t.F_Id id, t.F_BizType bizType, t.F_RuleId ruleId, t.F_ScopeType scopeType, t.F_ScopeValue scopeValue, t.F_Priority priority
|
||||
FROM (
|
||||
SELECT *,
|
||||
DENSE_RANK() OVER (ORDER BY F_ScopeType ASC) AS rn
|
||||
FROM ftb_attendance_rule_scope
|
||||
WHERE (F_ScopeType = 3
|
||||
OR (F_ScopeType = 2 AND F_ScopeValue = #{organizeId})
|
||||
OR (F_ScopeType = 1 AND F_ScopeValue = #{userId}))
|
||||
<if test="null != bizType and '' != bizType">
|
||||
AND F_BizType = #{bizType}
|
||||
</if>
|
||||
) t
|
||||
WHERE t.rn = 1
|
||||
</select>
|
||||
<!-- 查询用户生效中的规则[批量] -->
|
||||
<select id="selectUserEffectListBatch" resultType="jnpf.entity.attendance.AttendanceRuleScope">
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
t.F_Id AS id,
|
||||
t.F_BizType AS bizType,
|
||||
t.F_RuleId AS ruleId,
|
||||
t.F_ScopeType AS scopeType,
|
||||
t.F_ScopeValue AS scopeValue,
|
||||
t.F_Priority AS priority,
|
||||
t.F_Expand AS expand,
|
||||
uo.userId
|
||||
<if test="1 == priority">
|
||||
, ROW_NUMBER() OVER (PARTITION BY uo.userId,t.F_Expand ORDER BY t.F_ScopeType ASC) AS rn
|
||||
</if>
|
||||
FROM ftb_attendance_rule_scope t
|
||||
INNER JOIN (
|
||||
<foreach collection="list" item="item" separator="UNION ALL">
|
||||
SELECT
|
||||
#{item.userId} AS userId,
|
||||
#{item.organizeId} AS organizeId
|
||||
</foreach>
|
||||
) AS uo
|
||||
ON (t.F_ScopeType = 3)
|
||||
OR (t.F_ScopeType = 2 AND t.F_ScopeValue = uo.organizeId)
|
||||
OR (t.F_ScopeType = 1 AND t.F_ScopeValue = uo.userId)
|
||||
<where>
|
||||
<if test="null != bizType and '' != bizType">
|
||||
t.F_BizType = #{bizType}
|
||||
</if>
|
||||
<if test="null != leaveTypeIds and leaveTypeIds.size>0">
|
||||
and t.F_Expand in
|
||||
<foreach collection="leaveTypeIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
) tt
|
||||
<if test="1 == priority">
|
||||
WHERE tt.rn = 1
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectOrgEffectListBatch" resultType="jnpf.entity.attendance.AttendanceRuleScope">
|
||||
SELECT
|
||||
t.F_Id AS id,
|
||||
t.F_BizType AS bizType,
|
||||
t.F_RuleId AS ruleId,
|
||||
t.F_ScopeType AS scopeType,
|
||||
t.F_ScopeValue AS scopeValue
|
||||
FROM ftb_attendance_rule_scope t
|
||||
WHERE t.F_BizType = #{bizType} AND t.F_ScopeType = 2 AND t.F_ScopeValue = #{organizeId}
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,399 @@
|
||||
<?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="jnpf.attendance.mapper.StatisticsMapper">
|
||||
<!--查询用户/考勤组-排班、打卡、请假申请返回字段映射配置-->
|
||||
<resultMap type="jnpf.model.attendance.model.SituationData" id="UserActualAttendDataMap">
|
||||
<result property="groupId" column="F_GroupId"/>
|
||||
<result property="groupName" column="F_GroupName"/>
|
||||
<result property="userId" column="F_UserId"/>
|
||||
<result property="ruleId" column="F_Id"/>
|
||||
<result property="isAbsence" column="isAbsence"/>
|
||||
<result property="attendanceType" column="F_AttendanceType"/>
|
||||
<result property="applyViewEnable" column="F_ApplyViewEnable"/>
|
||||
<result property="selfGroup" column="F_SelfGroup"/>
|
||||
<result property="day" column="F_Day"/>
|
||||
<result property="breakStartPoint" column="F_BreakStartPoint"/>
|
||||
<result property="breakEndPoint" column="F_BreakEndPoint"/>
|
||||
<result property="inPoint" column="F_InPoint"/>
|
||||
<result property="outPoint" column="F_OutPoint"/>
|
||||
<result property="validDuration" column="F_ValidDuration"/>
|
||||
<result property="applyId" column="F_ApplyId"/>
|
||||
<result property="leaveApproveId" column="leaveApproveId"/>
|
||||
<result property="leaveTypeCode" column="F_LeaveTypeCode"/>
|
||||
<result property="leaveType" column="leaveType"/>
|
||||
<result property="unit" column="F_Unit"/>
|
||||
<result property="startTime" column="F_StartTime"/>
|
||||
<result property="endTime" column="F_EndTime"/>
|
||||
<result property="applicationDuration" column="F_ApplicationDurationSecond"/>
|
||||
<result property="unDeductedTime" column="F_UndeductedTimeSecond"/>
|
||||
<result property="shiftInvolved" column="F_ShiftInvolved"/>
|
||||
<result property="status" column="F_Status"/>
|
||||
<result property="outLackPoint" column="F_OutLackPoint"/>
|
||||
<!--主从关联查询配置,子查询数据以(b_、c_)命名可查询出结果列表-->
|
||||
<collection property="balanceRecordList" columnPrefix="b_"
|
||||
resultMap="BalanceRecordMap">
|
||||
</collection>
|
||||
<collection property="clockInResultList" columnPrefix="c_"
|
||||
resultMap="ClockInResultMap">
|
||||
</collection>
|
||||
</resultMap>
|
||||
<!--券余额使用记录映射配置-->
|
||||
<resultMap type="jnpf.model.attendance.model.BalanceRecord" id="BalanceRecordMap">
|
||||
<result property="unit" column="F_Unit"/>
|
||||
<result property="quota" column="F_Quota"/>
|
||||
<result property="paid" column="F_Paid"/>
|
||||
<result property="expireTime" column="F_Expire_Time"/>
|
||||
</resultMap>
|
||||
<!--打卡记录映射配置-->
|
||||
<resultMap type="jnpf.model.attendance.model.ClockInResult" id="ClockInResultMap">
|
||||
<result property="id" column="F_Id"/>
|
||||
<result property="ruleId" column="F_RuleId"/>
|
||||
<result property="userId" column="F_UserId"/>
|
||||
<result property="effectiveTime" column="F_EffectiveTime"/>
|
||||
<result property="clockInType" column="F_ClockInType"/>
|
||||
<result property="clockInStatus" column="F_ClockInStatus"/>
|
||||
<result property="clockInKind" column="F_ClockInKind"/>
|
||||
<result property="repaired" column="F_Repaired"/>
|
||||
<result property="approvalStatus" column="F_ApprovalStatus"/>
|
||||
<result property="clockInTime" column="F_ClockInTime"/>
|
||||
<result property="applyType" column="F_ApplyType"/>
|
||||
<result property="applyId" column="F_ApplyId"/>
|
||||
<result property="absence" column="F_Absence"/>
|
||||
<result property="absenceLeader" column="F_AbsenceLeader"/>
|
||||
<result property="restMinute" column="F_RestMinute"/>
|
||||
<result property="abnormalMinute" column="F_AbnormalMinute"/>
|
||||
<result property="deleteMark" column="F_DeleteMark"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="jnpf.model.attendance.model.UserLeaveApprove" id="UserLeaveApproveDataMap">
|
||||
<result property="id" column="F_Id"/>
|
||||
<result property="userId" column="F_User_Id"/>
|
||||
<result property="unit" column="F_Unit"/>
|
||||
<result property="startTimeType" column="F_StartTimeType"/>
|
||||
<result property="endTimeType" column="F_EndTimeType"/>
|
||||
<result property="startTime" column="F_StartTime"/>
|
||||
<result property="endTime" column="F_EndTime"/>
|
||||
<result property="applicationDuration" column="F_ApplicationDurationSecond"/>
|
||||
<result property="unDeductedTime" column="F_UndeductedTimeSecond"/>
|
||||
<result property="applicationDurationDay" column="F_ApplicationDurationDay"/>
|
||||
<result property="undeductedTimeDay" column="F_UndeductedTimeDay"/>
|
||||
<result property="balanceStatus" column="F_Balance_Status"/>
|
||||
<result property="paid" column="F_Paid"/>
|
||||
<result property="noPaid" column="F_No_Paid"/>
|
||||
<result property="shiftInvolved" column="F_ShiftInvolved"/>
|
||||
<result property="leaveTypeCode" column="F_LeaveTypeCode"/>
|
||||
<result property="leaveTypeName" column="F_LeaveTypeName"/>
|
||||
<!--主从关联查询配置,子查询数据以(b_、c_)命名可查询出结果列表-->
|
||||
<collection property="balanceRecordList" columnPrefix="b_"
|
||||
resultMap="BalanceRecordMap">
|
||||
</collection>
|
||||
</resultMap>
|
||||
<!--加班返回实体-->
|
||||
<resultMap type="jnpf.model.attendance.model.UserRuleRecord" id="UserRuleDataMap">
|
||||
<result property="groupId" column="F_GroupId"/>
|
||||
<result property="userId" column="F_UserId"/>
|
||||
<result property="day" column="F_Day"/>
|
||||
<result property="inPoint" column="F_InPoint"/>
|
||||
<result property="outPoint" column="F_OutPoint"/>
|
||||
<result property="attendanceType" column="F_AttendanceType"/>
|
||||
<result property="applyViewEnable" column="F_ApplyViewEnable"/>
|
||||
<result property="inStepOutType" column="F_InStepOutType"/>
|
||||
<result property="outStepOutType" column="F_OutStepOutType"/>
|
||||
<result property="selfGroup" column="F_SelfGroup"/>
|
||||
<!--主从关联查询配置,子查询数据以(b_、c_)命名可查询出结果列表-->
|
||||
<collection property="clockInResultList" columnPrefix="b_"
|
||||
resultMap="UserClockInResultMap">
|
||||
</collection>
|
||||
</resultMap>
|
||||
<resultMap type="jnpf.model.attendance.model.ClockInResultRecordVo" id="UserClockInResultMap">
|
||||
<result property="id" column="F_Id"/>
|
||||
<result property="clockTime" column="F_ClockInTime"/>
|
||||
<result property="effectiveTime" column="F_EffectiveTime"/>
|
||||
<result property="abnormalSecond" column="F_AbnormalMinute"/>
|
||||
<result property="clockInType" column="F_ClockInType"/>
|
||||
<result property="clockInKind" column="F_ClockInKind"/>
|
||||
<result property="clockInStatus" column="F_ClockInStatus"/>
|
||||
<result property="approvalStatus" column="F_ApprovalStatus"/>
|
||||
<result property="repaired" column="F_Repaired"/>
|
||||
<result property="absence" column="F_Absence"/>
|
||||
<result property="absenceLeader" column="F_AbsenceLeader"/>
|
||||
<result property="deleteMark" column="F_DeleteMark"/>
|
||||
</resultMap>
|
||||
<!--web列表筛选条件查询-->
|
||||
<!--查询用户/考勤组-排班、打卡、请假申请信息筛选条件-->
|
||||
<sql id="USER_ACTUALATTEND_DATA_WHERE">
|
||||
<where>
|
||||
fadr.F_ApplyViewEnable in (1,3,9,10)
|
||||
AND fadr.F_DeleteMark = 0
|
||||
AND fag.F_DeleteMark = 0
|
||||
<if test="userIds!= null and userIds.size()>0">
|
||||
and fadr.F_UserId in
|
||||
<foreach collection="userIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="groupIds!= null and groupIds.size()>0">
|
||||
and fadr.F_GroupId in
|
||||
<foreach collection="groupIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="attendanceTypeList!= null and attendanceTypeList.size()>0">
|
||||
and fadr.F_AttendanceType not in
|
||||
<foreach collection="attendanceTypeList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dateRangeDto.startDate != null and dateRangeDto.endDate != ''">
|
||||
AND fadr.F_Day BETWEEN #{dateRangeDto.startDate} AND #{dateRangeDto.endDate}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<sql id="USER_ACTUALATTEND_DATA_FIELD">
|
||||
fadr.F_GroupId,
|
||||
fag.F_GroupName,
|
||||
fadr.F_Id,
|
||||
fadr.F_UserId,
|
||||
fadr.F_ApplyViewEnable,
|
||||
fadr.F_LateEnable,
|
||||
fadr.F_EarlyEnable,
|
||||
fadr.F_BreakEnable,
|
||||
fadr.F_SelfGroup,
|
||||
fadr.F_Day,
|
||||
fadr.F_BreakStartPoint,
|
||||
fadr.F_BreakEndPoint,
|
||||
fadr.F_InPoint,
|
||||
fadr.F_OutPoint,
|
||||
fadr.F_ValidDuration,
|
||||
fadr.F_ApplyId,
|
||||
fadr.F_DeleteMark,
|
||||
fala.F_Id leaveApproveId,
|
||||
fals.F_Id F_LeaveTypeCode,
|
||||
fals.F_Name F_LeaveTypeName,
|
||||
fals.F_Type leaveType,
|
||||
fala.F_Unit,
|
||||
fala.F_StartTime,
|
||||
fala.F_EndTime,
|
||||
fala.F_ApplicationDurationSecond,
|
||||
fala.F_UndeductedTimeSecond,
|
||||
fala.F_ShiftInvolved,
|
||||
fala.F_Status,
|
||||
fabur.F_Unit b_F_Unit,
|
||||
fabur.F_Quota b_F_Quota,
|
||||
fabr.F_Paid b_F_Paid,
|
||||
facir.F_Id c_F_Id,
|
||||
facir.F_RuleId c_F_RuleId,
|
||||
facir.F_UserId c_F_UserId,
|
||||
facir.F_EffectiveTime c_F_EffectiveTime,
|
||||
facir.F_ClockInType c_F_ClockInType,
|
||||
facir.F_ClockInStatus c_F_ClockInStatus,
|
||||
facir.F_ClockInKind c_F_ClockInKind,
|
||||
facir.F_Absence c_F_Absence,
|
||||
facir.F_Repaired c_F_Repaired,
|
||||
faci.F_ClockInTime c_F_ClockInTime,
|
||||
faci.F_ApprovalStatus c_F_ApprovalStatus,
|
||||
facir.F_ApplyType c_F_ApplyType,
|
||||
facir.F_ApplyId c_F_ApplyId,
|
||||
facir.F_RestMinute c_F_RestMinute,
|
||||
facir.F_AbnormalMinute c_F_AbnormalMinute,
|
||||
facir.F_AbsenceLeader c_F_AbsenceLeader,
|
||||
facir.F_DeleteMark c_F_DeleteMark
|
||||
</sql>
|
||||
<!-- 查询用户关联的考勤组信息 -->
|
||||
<select id="getUserAssociationGroupDataList"
|
||||
resultType="jnpf.model.attendance.model.UserAssociationGroupData">
|
||||
SELECT
|
||||
fagu.F_UserId userId,
|
||||
fagu.F_UserGroupType type,
|
||||
fagu.F_TimeJson timeJson,
|
||||
fagu.F_GroupId groupId,
|
||||
fagu.F_RemoveTime removeTime,
|
||||
fag.F_GroupName groupName
|
||||
FROM
|
||||
ftb_attendance_group_user fagu
|
||||
LEFT JOIN ftb_attendance_group fag ON fagu.F_GroupId = fag.F_Id
|
||||
<where>
|
||||
fag.F_DeleteMark = 0
|
||||
and fagu.F_DeleteMark = 0
|
||||
<if test="groupIds!= null and groupIds.size()>0">
|
||||
and fagu.F_GroupId in
|
||||
<foreach collection="groupIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="userIds!= null and userIds.size()>0">
|
||||
and fagu.F_UserId in
|
||||
<foreach collection="userIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
AND fagu.F_UserGroupType in(1,2)
|
||||
</where>
|
||||
GROUP BY fagu.F_UserId,fagu.F_UserGroupType
|
||||
</select>
|
||||
<!-- 查询被借调记录-->
|
||||
<select id="getUserSecondRecordList" resultType="jnpf.model.attendance.model.UserSecondRecord">
|
||||
SELECT
|
||||
F_Id id,
|
||||
F_UserId userId,
|
||||
F_GroupId groupId,
|
||||
F_TimeJson timeJson
|
||||
FROM ftb_attendance_group_user
|
||||
<where>
|
||||
F_UserGroupType = 2
|
||||
<if test="userIds!= null and userIds.size()>0">
|
||||
and F_UserId in
|
||||
<foreach collection="userIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="groupIds!= null and groupIds.size()>0">
|
||||
and F_GroupId in
|
||||
<foreach collection="groupIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY F_UserId
|
||||
</select>
|
||||
<!--获取用户打卡结果数据-->
|
||||
<select id="getUserClockInResultList" resultType="jnpf.model.attendance.model.ClockInResultRecord">
|
||||
select
|
||||
facir.F_Id id,
|
||||
fadr.F_Day day,
|
||||
fadr.F_GroupId groupId,
|
||||
fadr.F_UserId userId,
|
||||
faci.F_ClockInTime clockTime,
|
||||
facir.F_EffectiveTime effectiveTime,
|
||||
facir.F_AbnormalMinute abnormalSecond,
|
||||
facir.F_ClockInType clockInType,
|
||||
facir.F_ClockInKind clockInKind,
|
||||
IF(facir.F_ApplyId is null,0,1) approvalStatus,
|
||||
facir.F_Repaired repaired,
|
||||
fadr.F_InPoint inPoint,
|
||||
fadr.F_OutPoint outPoint,
|
||||
facir.F_Absence absence,
|
||||
facir.F_AbsenceLeader absenceLeader
|
||||
FROM ftb_attendance_daily_rule fadr
|
||||
LEFT JOIN ftb_attendance_clock_in_result facir ON facir.F_RuleId = fadr.F_Id
|
||||
LEFT JOIN ftb_attendance_clock_in faci ON faci.F_Id = facir.F_ClockInId
|
||||
<where>
|
||||
and fadr.F_DeleteMark = 0
|
||||
and facir.F_DeleteMark = 0
|
||||
<if test="attendanceTypeList!= null and attendanceTypeList.size()>0">
|
||||
and fadr.F_AttendanceType in
|
||||
<foreach collection="attendanceTypeList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="userIds!= null and userIds.size()>0">
|
||||
and fadr.F_UserId in
|
||||
<foreach collection="userIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="groupIds!= null and groupIds.size()>0">
|
||||
and fadr.F_GroupId in
|
||||
<foreach collection="groupIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dateRangeDto.startDate != null and dateRangeDto.endDate != ''">
|
||||
AND fadr.F_Day BETWEEN #{dateRangeDto.startDate} AND #{dateRangeDto.endDate}
|
||||
</if>
|
||||
<if test="clockInStatus != null">
|
||||
and facir.F_ClockInStatus = #{clockInStatus}
|
||||
</if>
|
||||
<if test="absenceStatus != null">
|
||||
and facir.F_Absence = #{absenceStatus}
|
||||
</if>
|
||||
<if test="repairedStatus != null">
|
||||
and facir.F_Repaired = #{repairedStatus}
|
||||
</if>
|
||||
<if test="clockInKind != null">
|
||||
and facir.F_ClockInKind = #{clockInKind}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<!--获取用户加班数据-->
|
||||
<select id="getUserRuleRecordList" resultMap="UserRuleDataMap">
|
||||
select
|
||||
fadr.F_GroupId,
|
||||
fadr.F_UserId,
|
||||
fadr.F_Day,
|
||||
fadr.F_InPoint,
|
||||
fadr.F_OutPoint,
|
||||
fadr.F_AttendanceType,
|
||||
fadr.F_ApplyViewEnable,
|
||||
fadr.F_InStepOutType,
|
||||
fadr.F_OutStepOutType,
|
||||
fadr.F_SelfGroup,
|
||||
facir.F_Id b_F_Id,
|
||||
faci.F_ClockInTime b_F_ClockInTime,
|
||||
facir.F_EffectiveTime b_F_EffectiveTime,
|
||||
facir.F_AbnormalMinute b_F_AbnormalMinute,
|
||||
facir.F_ClockInType b_F_ClockInType,
|
||||
facir.F_ClockInKind b_F_ClockInKind,
|
||||
facir.F_ClockInStatus b_F_ClockInStatus,
|
||||
IF(facir.F_ApplyId is null,0,1) b_F_ApprovalStatus,
|
||||
facir.F_Repaired b_F_Repaired,
|
||||
facir.F_Absence b_F_Absence,
|
||||
facir.F_AbsenceLeader b_F_AbsenceLeader,
|
||||
facir.F_DeleteMark b_F_DeleteMark
|
||||
FROM ftb_attendance_daily_rule fadr
|
||||
LEFT JOIN ftb_attendance_clock_in_result facir ON facir.F_RuleId = fadr.F_Id
|
||||
LEFT JOIN ftb_attendance_clock_in faci ON faci.F_Id = facir.F_ClockInId
|
||||
<where>
|
||||
and fadr.F_DeleteMark = 0
|
||||
and fadr.F_ApplyViewEnable in (1,3,9,10)
|
||||
<if test="userIds!= null and userIds.size()>0">
|
||||
and fadr.F_UserId in
|
||||
<foreach collection="userIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="groupIdList!= null and groupIdList.size()>0">
|
||||
and fadr.F_GroupId in
|
||||
<foreach collection="groupIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dateRangeDto.startDate != null and dateRangeDto.endDate != ''">
|
||||
AND fadr.F_Day BETWEEN #{dateRangeDto.startDate} AND #{dateRangeDto.endDate}
|
||||
</if>
|
||||
<if test="attendanceTypeList!= null and attendanceTypeList.size()>0">
|
||||
and fadr.F_AttendanceType in
|
||||
<foreach collection="attendanceTypeList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<!-- 获取用户指定考勤组时间范围内的排班数据-->
|
||||
<select id="getUserRuleList" resultType="jnpf.model.attendance.vo.attendance.UserRuleListVo">
|
||||
SELECT r.F_Id ruleId,r.F_GroupId groupId,r.F_SchedulesType schedulesType, r.F_PeriodId periodId,r.F_Day day, r.F_AttendanceType attendanceType,r.F_ShiftId shiftId, r.F_InPoint inPoint,r.F_OutPoint outPoint,r.F_UserId userId,r.F_ApplyUnit applyUnit,p.F_InPoint periodInPoint,p.F_OutPoint periodOutPoint,p.F_OutType periodOutType,goa.F_StartTime goOutStartTime,goa.F_EndTime goOutEndTime,r.F_ApplyViewEnable applyViewEnable ,r.F_InStepOutType inStepOutType ,r.F_OutStepOutType outStepOutType ,r.F_OutStepOutApplyId outStepOutApplyId,r.F_InStepOutApplyId inStepOutApplyId
|
||||
FROM ftb_attendance_daily_rule r
|
||||
LEFT JOIN ftb_attendance_shift_setting_period p ON r.F_PeriodId = p.F_Id
|
||||
LEFT JOIN ftb_attendance_go_out_approve goa ON r.F_ApplyId = goa.F_Id
|
||||
WHERE r.F_Day BETWEEN #{dateRangeDto.startDate} AND #{dateRangeDto.endDate}
|
||||
AND r.F_AttendanceType > 0 AND r.F_ApplyViewEnable in (1,3,9,10)
|
||||
AND r.F_GroupId = #{groupId}
|
||||
<if test="userIds!= null and userIds.size()>0">
|
||||
AND r.F_UserId IN
|
||||
<foreach collection="userIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dateRangeDto.startDate != null and dateRangeDto.endDate != ''">
|
||||
AND r.F_Day BETWEEN #{dateRangeDto.startDate} AND #{dateRangeDto.endDate}
|
||||
</if>
|
||||
<if test="code!= null and code.size()>0">
|
||||
and r.F_AttendanceType in
|
||||
<foreach collection="code" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY r.F_AttendanceType DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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="jnpf.attendance.mapper.StorageRestMapper">
|
||||
<!-- 批量保存数据-->
|
||||
<insert id="saveBatch">
|
||||
INSERT INTO ftb_attendance_storage_rest (F_Id,F_UserId,F_Num,F_YearMonth)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id}, #{item.userId},#{item.num}, #{item.yearMonth})
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 获取用户指定年月的存休-->
|
||||
<select id="batchGetUserStorageRest" resultType="jnpf.model.attendance.vo.attendance.AttendanceStorageRestVo">
|
||||
SELECT
|
||||
F_UserId userId,
|
||||
F_Num num,
|
||||
F_YearMonth yearMonth
|
||||
FROM ftb_attendance_storage_rest
|
||||
<where>
|
||||
AND F_YearMonth = #{yearMonth}
|
||||
<if test="userIds!= null and userIds.size()>0">
|
||||
and F_UserId in
|
||||
<foreach collection="userIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
</where>
|
||||
group by F_UserId
|
||||
</select>
|
||||
|
||||
<!-- 实时获取当月存休-->
|
||||
<select id="getRealTimeUserStorageRest"
|
||||
resultType="jnpf.model.attendance.vo.attendance.AttendanceStorageRestVo">
|
||||
SELECT F_User_Id userId,IFNULL(SUM(F_Balance),0) num
|
||||
FROM ftb_attendance_balance_record
|
||||
WHERE F_User_Id IN
|
||||
<foreach collection="userIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND F_DeleteMark = 0 AND F_State = 0 AND F_Type = 3 AND F_State = 0 AND F_Over = 0
|
||||
GROUP BY F_User_Id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?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="jnpf.attendance.mapper.UserPhoneMapper">
|
||||
|
||||
<!-- 查询常用手机列表 -->
|
||||
<select id="getUsualPhoneList" resultType="jnpf.model.attendance.vo.attendance.UsualPhonePageVo">
|
||||
select F_Id id, F_UserId userId, F_PhoneName phoneName, F_PhoneCode phoneCode, F_CreatorTime creatorTime
|
||||
from ftb_attendance_user_phone
|
||||
where F_DeleteMark = 0
|
||||
<if test="null != list and list.size > 0">
|
||||
and F_UserId in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
order by F_CreatorTime desc
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user