310 lines
12 KiB
XML
310 lines
12 KiB
XML
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||
|
|
<mapper namespace="com.bonus.boot.manager.manager.dao.WeChatDao">
|
||
|
|
<insert id="insertEvection">
|
||
|
|
INSERT INTO leave_apply_wechat(uuid, user_id, user_name, org_id, org_name, type, leave_type, leave_reason,
|
||
|
|
leave_start_date,
|
||
|
|
leave_start_interval,
|
||
|
|
leave_end_date,
|
||
|
|
leave_end_interval,
|
||
|
|
leave_duration, source, create_user_id, is_agree, location, host_user_id,
|
||
|
|
host_user_name, remark
|
||
|
|
, leave_form_id, submit_id, examine_status)
|
||
|
|
VALUES (#{uuid}, #{userId}, #{userName}, #{orgId}, #{orgName}, '出差', '出差', #{leaveReason},
|
||
|
|
#{leaveStartDate},
|
||
|
|
#{leaveStartInterval},
|
||
|
|
#{leaveEndDate},
|
||
|
|
#{leaveEndInterval},
|
||
|
|
#{leaveDuration}, #{source}, #{createUserId}, #{isAgree}, #{location}, #{hostUserId}, #{hostUserName},
|
||
|
|
#{remark},
|
||
|
|
#{leaveFormId}, #{createUserId}, '1')
|
||
|
|
</insert>
|
||
|
|
<insert id="insertLeaveReporting">
|
||
|
|
INSERT INTO leave_apply_wechat(uuid, user_id, user_name, org_id, org_name, leave_type, type, leave_reason,
|
||
|
|
leave_start_date,
|
||
|
|
leave_start_interval,
|
||
|
|
leave_end_date,
|
||
|
|
leave_end_interval,
|
||
|
|
leave_duration, source, create_user_id, is_agree, location, host_user_id,
|
||
|
|
host_user_name, remark, examine_status)
|
||
|
|
VALUES (#{uuid}, #{userId}, #{userName}, #{orgId}, #{orgName}, #{leaveType}, '请假', #{leaveReason},
|
||
|
|
#{leaveStartDate},
|
||
|
|
#{leaveStartInterval},
|
||
|
|
#{leaveEndDate},
|
||
|
|
#{leaveEndInterval},
|
||
|
|
#{leaveDuration}, #{source}, #{createUserId}, #{isAgree}, #{location}, #{hostUserId}, #{hostUserName},
|
||
|
|
#{remark}, '1')
|
||
|
|
</insert>
|
||
|
|
<update id="updateUser">
|
||
|
|
update sys_user_wechat
|
||
|
|
set password = #{password}
|
||
|
|
where user_id = #{userId}
|
||
|
|
</update>
|
||
|
|
<select id="getById" resultType="com.bonus.boot.manager.manager.entity.UserDto">
|
||
|
|
select su.id,
|
||
|
|
su.username as username,
|
||
|
|
su.phone,
|
||
|
|
su.org_id as orgId,
|
||
|
|
sru.roleId as roleId
|
||
|
|
from sys_user su
|
||
|
|
left join sys_role_user sru on su.id = sru.userId
|
||
|
|
where su.id = #{id}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getByUserId" resultType="com.bonus.boot.manager.manager.entity.UserDto">
|
||
|
|
select su.user_id,
|
||
|
|
su.username as username,
|
||
|
|
su.phone,
|
||
|
|
su.org_id as orgId,
|
||
|
|
sru.roleId as roleId
|
||
|
|
from sys_user su
|
||
|
|
left join sys_role_user sru on su.id = sru.userId
|
||
|
|
where su.user_id = #{userId}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getSelectUserCurrent" resultType="com.bonus.boot.manager.manager.model.SysUser">
|
||
|
|
select user_id as userId,
|
||
|
|
user_name as username,
|
||
|
|
phone
|
||
|
|
from sys_user_wechat
|
||
|
|
where is_active = 1
|
||
|
|
and user_id!=#{userId}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getTravelPersonSelect" resultType="com.bonus.boot.manager.manager.model.SysUser">
|
||
|
|
select user_id as userId,
|
||
|
|
user_name as username,
|
||
|
|
phone
|
||
|
|
from sys_user_wechat
|
||
|
|
where is_active = 1
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getSysUserWechat" resultType="com.bonus.boot.manager.appManage.entity.SysUserWechat">
|
||
|
|
select aa.user_id as userId,
|
||
|
|
aa.user_name as username,
|
||
|
|
aa.phone,
|
||
|
|
aa.is_face as isFace,
|
||
|
|
aa.open_id as openId,
|
||
|
|
bb.user_id as faceId
|
||
|
|
from sys_user_wechat aa
|
||
|
|
LEFT JOIN sys_user_face_wechat bb ON aa.user_id = bb.user_id
|
||
|
|
where aa.is_active = 1
|
||
|
|
and aa.user_id = #{userId}
|
||
|
|
</select>
|
||
|
|
<select id="getEvectionList" resultType="com.bonus.boot.manager.manager.entity.EvectionBean">
|
||
|
|
SELECT
|
||
|
|
b.*
|
||
|
|
FROM
|
||
|
|
(
|
||
|
|
SELECT a.*,
|
||
|
|
GROUP_CONCAT(a.user_ids SEPARATOR ',') AS travelers,
|
||
|
|
GROUP_CONCAT(a.user_name SEPARATOR ',') AS travelersName,
|
||
|
|
su.user_id,
|
||
|
|
su.user_name AS userName
|
||
|
|
FROM
|
||
|
|
(
|
||
|
|
SELECT
|
||
|
|
l.id,
|
||
|
|
l.user_id as user_ids,
|
||
|
|
l.user_name,
|
||
|
|
l.org_id,
|
||
|
|
l.org_name,
|
||
|
|
l.create_time,
|
||
|
|
l.type,
|
||
|
|
l.leave_type,
|
||
|
|
l.leave_reason,
|
||
|
|
l.leave_start_date as leaveStartDate,
|
||
|
|
l.leave_start_interval,
|
||
|
|
l.leave_end_date as leaveEndDate,
|
||
|
|
l.leave_end_interval,
|
||
|
|
l.leave_duration as leaveDuration,
|
||
|
|
l.location,
|
||
|
|
l.leave_form_id as uuid,
|
||
|
|
l.submit_id,
|
||
|
|
l.update_time
|
||
|
|
FROM
|
||
|
|
leave_apply_wechat l
|
||
|
|
WHERE
|
||
|
|
l.is_active = '1' AND l.type = '出差'
|
||
|
|
GROUP BY
|
||
|
|
l.id,
|
||
|
|
l.user_id,
|
||
|
|
l.user_name,
|
||
|
|
l.org_id,
|
||
|
|
l.org_name,
|
||
|
|
l.create_time,
|
||
|
|
l.type,
|
||
|
|
l.leave_type,
|
||
|
|
l.leave_reason,
|
||
|
|
l.leave_start_date,
|
||
|
|
l.leave_start_interval,
|
||
|
|
l.leave_end_date,
|
||
|
|
l.leave_end_interval,
|
||
|
|
l.leave_duration,
|
||
|
|
l.examine_status,
|
||
|
|
l.submit_id
|
||
|
|
) a
|
||
|
|
LEFT JOIN sys_user_wechat su ON su.user_id = a.submit_id
|
||
|
|
GROUP BY a.uuid
|
||
|
|
) b
|
||
|
|
WHERE
|
||
|
|
b.submit_id=#{userId}
|
||
|
|
ORDER BY b.leaveStartDate DESC
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectWchatc" resultType="com.bonus.boot.manager.manager.entity.EvectionBean">
|
||
|
|
SELECT *,leave_type as leaveType
|
||
|
|
FROM leave_apply_wechat
|
||
|
|
<where>
|
||
|
|
<if test="userId != null and userId != ''">
|
||
|
|
AND user_id = #{userId}
|
||
|
|
</if>
|
||
|
|
<if test="orgId != null">
|
||
|
|
AND org_id = #{orgId}
|
||
|
|
</if>
|
||
|
|
<if test="invoiceDate != null and invoiceDate != ''">
|
||
|
|
AND STR_TO_DATE(leave_start_date, '%Y-%m-%d') <![CDATA[ <= ]]> STR_TO_DATE(#{invoiceDate}, '%Y-%m-%d')
|
||
|
|
AND STR_TO_DATE(leave_end_date, '%Y-%m-%d') <![CDATA[ >= ]]> STR_TO_DATE(#{invoiceDate}, '%Y-%m-%d')
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
<select id="selectEvectionById" resultType="com.bonus.boot.manager.manager.entity.EvectionBean">
|
||
|
|
SELECT a.*,
|
||
|
|
GROUP_CONCAT(a.user_ids SEPARATOR ',' ) AS travelers,
|
||
|
|
GROUP_CONCAT(a.user_name SEPARATOR ',' ) AS travelersName,
|
||
|
|
su.user_id,
|
||
|
|
su.user_name as userName
|
||
|
|
FROM (SELECT l.id,
|
||
|
|
l.user_id as user_ids,
|
||
|
|
l.user_name,
|
||
|
|
l.org_id,
|
||
|
|
l.org_name,
|
||
|
|
l.create_time,
|
||
|
|
l.type,
|
||
|
|
l.leave_type,
|
||
|
|
l.leave_reason as leaveReason,
|
||
|
|
l.leave_start_date as leaveStartDate,
|
||
|
|
l.leave_start_interval,
|
||
|
|
l.leave_end_date as leaveEndDate,
|
||
|
|
l.leave_end_interval,
|
||
|
|
l.leave_duration as leaveDuration,
|
||
|
|
l.leave_form_id as uuid,
|
||
|
|
l.submit_id,
|
||
|
|
l.host_user_id,
|
||
|
|
l.host_user_name as hostUserName,
|
||
|
|
l.is_agree as isAgree,
|
||
|
|
l.location,
|
||
|
|
l.remark
|
||
|
|
FROM leave_apply_wechat l
|
||
|
|
WHERE l.is_active = '1'
|
||
|
|
AND l.type = '出差'
|
||
|
|
and l.leave_form_id = #{uuid}
|
||
|
|
GROUP BY l.id,
|
||
|
|
l.user_id,
|
||
|
|
l.user_name,
|
||
|
|
l.org_id,
|
||
|
|
l.org_name,
|
||
|
|
l.create_time,
|
||
|
|
l.type,
|
||
|
|
l.leave_type,
|
||
|
|
l.leave_reason,
|
||
|
|
l.leave_start_date,
|
||
|
|
l.leave_start_interval,
|
||
|
|
l.leave_end_date,
|
||
|
|
l.leave_end_interval,
|
||
|
|
l.leave_duration,
|
||
|
|
l.examine_status,
|
||
|
|
l.submit_id,
|
||
|
|
l.host_user_id,
|
||
|
|
l.is_agree,
|
||
|
|
l.location,
|
||
|
|
l.remark
|
||
|
|
ORDER BY l.update_time DESC) a
|
||
|
|
LEFT JOIN sys_user_wechat su ON su.user_id = a.submit_id
|
||
|
|
GROUP BY uuid
|
||
|
|
</select>
|
||
|
|
<select id="getLeaveReportingList" resultType="com.bonus.boot.manager.manager.entity.LeaveReportingBean">
|
||
|
|
SELECT
|
||
|
|
l.user_id,
|
||
|
|
l.uuid,
|
||
|
|
l.user_name as userName,
|
||
|
|
l.org_id,
|
||
|
|
l.org_name,
|
||
|
|
l.create_time,
|
||
|
|
l.leave_type as leaveType,
|
||
|
|
l.type,
|
||
|
|
l.leave_reason as leaveReason,
|
||
|
|
l.leave_start_date as leaveStartDate,
|
||
|
|
l.leave_start_interval,
|
||
|
|
l.leave_end_date as leaveEndDate,
|
||
|
|
l.leave_end_interval,
|
||
|
|
l.leave_duration as leaveDuration
|
||
|
|
FROM
|
||
|
|
leave_apply_wechat l
|
||
|
|
WHERE
|
||
|
|
l.is_active = '1' AND l.type = '请假'
|
||
|
|
and l.user_id = #{userId}
|
||
|
|
GROUP BY
|
||
|
|
l.uuid,
|
||
|
|
l.user_id,
|
||
|
|
l.user_name,
|
||
|
|
l.org_id,
|
||
|
|
l.org_name,
|
||
|
|
l.create_time,
|
||
|
|
l.leave_type,
|
||
|
|
l.type,
|
||
|
|
l.leave_reason,
|
||
|
|
l.leave_start_date,
|
||
|
|
l.leave_start_interval,
|
||
|
|
l.leave_end_date,
|
||
|
|
l.leave_end_interval,
|
||
|
|
l.leave_duration,
|
||
|
|
l.examine_status
|
||
|
|
ORDER BY l.leave_start_date DESC
|
||
|
|
</select>
|
||
|
|
<select id="selectLeaveReportingById"
|
||
|
|
resultType="com.bonus.boot.manager.manager.entity.LeaveReportingBean">
|
||
|
|
SELECT l.uuid,
|
||
|
|
l.user_id,
|
||
|
|
l.user_name as userName,
|
||
|
|
l.org_id,
|
||
|
|
l.org_name,
|
||
|
|
l.create_time,
|
||
|
|
l.leave_type as leaveType,
|
||
|
|
l.type,
|
||
|
|
l.leave_reason as leaveReason,
|
||
|
|
l.leave_start_date as leaveStartDate,
|
||
|
|
l.leave_start_interval,
|
||
|
|
l.leave_end_date as leaveEndDate,
|
||
|
|
l.leave_end_interval,
|
||
|
|
l.leave_duration as leaveDuration,
|
||
|
|
l.host_user_id,
|
||
|
|
l.host_user_name as hostUserName,
|
||
|
|
l.is_agree as isAgree,
|
||
|
|
l.location,
|
||
|
|
l. remark as remark
|
||
|
|
FROM
|
||
|
|
leave_apply_wechat l
|
||
|
|
WHERE l.uuid = #{uuid}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getHolidayType" resultType="com.bonus.boot.manager.manager.entity.LeaveReportingBean">
|
||
|
|
SELECT
|
||
|
|
dict_code AS id,
|
||
|
|
dict_label AS type
|
||
|
|
FROM
|
||
|
|
sys_dict_data_wechat
|
||
|
|
WHERE
|
||
|
|
STATUS = 0
|
||
|
|
</select>
|
||
|
|
<select id="getFestivalAndHoliday" resultType="com.bonus.boot.manager.manager.entity.LeaveReportingBean">
|
||
|
|
SELECT id, date, `name`, type
|
||
|
|
FROM
|
||
|
|
sys_holiday_wechat
|
||
|
|
where
|
||
|
|
type ='1'
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|