|
@@ -17,37 +17,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
<result property="startTime" column="start_time" />
|
|
|
<result property="endTime" column="end_time" />
|
|
|
+ <result property="remainingDays" column="remaining_days" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectTTempPermissionVo">
|
|
|
SELECT
|
|
|
- id,
|
|
|
- t.user_id,
|
|
|
- u.login_name,
|
|
|
- u.user_name,
|
|
|
- d.dept_id,
|
|
|
- d.dept_name,
|
|
|
- t.create_by,
|
|
|
- t.create_time,
|
|
|
- t.update_by,
|
|
|
- t.update_time,
|
|
|
- start_time,
|
|
|
- end_time
|
|
|
+ *
|
|
|
FROM
|
|
|
- t_temp_permission t
|
|
|
- LEFT JOIN sys_user u ON t.user_id = u.user_id
|
|
|
- LEFT JOIN sys_dept d ON u.dept_id = d.dept_id
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ id,
|
|
|
+ t.user_id,
|
|
|
+ u.login_name,
|
|
|
+ u.user_name,
|
|
|
+ d.dept_id,
|
|
|
+ d.dept_name,
|
|
|
+ t.create_by,
|
|
|
+ t.create_time,
|
|
|
+ t.update_by,
|
|
|
+ t.update_time,
|
|
|
+ start_time,
|
|
|
+ end_time,
|
|
|
+ TO_DAYS(end_time) - TO_DAYS(NOW()) remaining_days
|
|
|
+ FROM
|
|
|
+ t_temp_permission t
|
|
|
+ LEFT JOIN sys_user u ON t.user_id = u.user_id
|
|
|
+ LEFT JOIN sys_dept d ON u.dept_id = d.dept_id
|
|
|
+ ) tb
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectTTempPermissionList" parameterType="TTempPermission" resultMap="TTempPermissionResult">
|
|
|
<include refid="selectTTempPermissionVo"/>
|
|
|
<where>
|
|
|
- <if test="loginName != null and loginName != ''"> and u.login_name like concat('%', #{loginName}, '%')</if>
|
|
|
- <if test="userName != null and userName != ''"> and u.user_name like concat('%', #{userName}, '%')</if>
|
|
|
- <if test="deptId != null "> and d.dept_id = #{deptId}</if>
|
|
|
- <if test="endTime != null "> and TO_DAYS(NOW())-TO_DAYS(end_time) >= -7</if>
|
|
|
+ <if test="loginName != null and loginName != ''"> and login_name like concat('%', #{loginName}, '%')</if>
|
|
|
+ <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
|
|
+ <if test="deptId != null "> and dept_id = #{deptId}</if>
|
|
|
+ <if test="endTime != null "> and remaining_days <![CDATA[<=]]> 7</if>
|
|
|
</where>
|
|
|
- order by t.start_time desc, t.end_time asc
|
|
|
+ order by remaining_days asc
|
|
|
</select>
|
|
|
|
|
|
<select id="selectTTempPermissionById" parameterType="Long" resultMap="TTempPermissionResult">
|