22 lines
1021 B
XML
22 lines
1021 B
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="github.benjamin.equipreservebackend.mapper.ApprovalMapper">
|
|
|
|
<select id="getApproval" resultType="github.benjamin.equipreservebackend.vo.LeaderApprovalVO">
|
|
SELECT a.id as approvalId, r.applicant_name, r.applicant_team, r.applicant_contact, d.name as deviceName, r.start_time, r.end_time, a.decision, r.status
|
|
FROM approvals a
|
|
LEFT JOIN reservations r ON a.reservation_id = r.id
|
|
LEFT JOIN devices d ON r.device_id = d.id
|
|
WHERE a.approver_id = #{approverId}
|
|
<if test="applicantName != null and applicantName != ''">
|
|
AND r.applicant_name LIKE CONCAT('%', #{applicantName}, '%')
|
|
</if>
|
|
<if test="deviceName != null and deviceName != ''">
|
|
AND d.name LIKE CONCAT('%', #{deviceName}, '%')
|
|
</if>
|
|
ORDER BY a.timestamp DESC
|
|
</select>
|
|
|
|
</mapper> |