|
|
@@ -136,7 +136,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
c1.cabinet_name as loan_from_name,
|
|
|
c2.cabinet_name as restitution_to_name,
|
|
|
u.user_name as loan_user_name,
|
|
|
- u1.user_name as restitution_user_name
|
|
|
+ u1.user_name as restitution_user_name,
|
|
|
+ m.materials_type_id,
|
|
|
+ mt.materials_type_name,
|
|
|
+ mt.materials_type_icon,
|
|
|
+ mt.materials_type_picture,
|
|
|
+ CASE
|
|
|
+ WHEN l.actual_restitution_time IS NOT NULL THEN
|
|
|
+ CONCAT(
|
|
|
+ FLOOR( TIMESTAMPDIFF( SECOND, l.loan_time, l.actual_restitution_time ) / 3600 ),
|
|
|
+ '小时 ',
|
|
|
+ MOD ( FLOOR( TIMESTAMPDIFF( SECOND, l.loan_time, l.actual_restitution_time ) / 60 ), 60 ),
|
|
|
+ '分 ',
|
|
|
+ MOD ( TIMESTAMPDIFF( SECOND, l.loan_time, l.actual_restitution_time ), 60 ),
|
|
|
+ '秒'
|
|
|
+ ) ELSE null
|
|
|
+ END AS loan_duration
|
|
|
+
|
|
|
FROM
|
|
|
is_materials_loan l
|
|
|
LEFT JOIN is_materials m ON m.materials_id = l.materials_id
|
|
|
@@ -144,16 +160,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
LEFT JOIN is_materials_cabinet c2 ON c2.cabinet_id = l.restitution_to_id
|
|
|
LEFT JOIN sys_user u ON u.user_id = l.loan_user_id
|
|
|
LEFT JOIN sys_user u1 ON u1.user_id = l.restitution_user_id
|
|
|
+ LEFT JOIN is_materials_type mt ON mt.materials_type_id = m.materials_type_id
|
|
|
<where>
|
|
|
- <if test="dto.materialsCode != null and dto.materialsCode.trim != ''">
|
|
|
- and m.materials_code like concat('%',#{dto.materialsCode},'%')
|
|
|
- </if>
|
|
|
<if test="dto.materialsName != null and dto.materialsName.trim != ''">
|
|
|
and m.materials_name like concat('%',#{dto.materialsName},'%')
|
|
|
</if>
|
|
|
- <if test="dto.loanUserName != null and dto.loanUserName.trim != ''">
|
|
|
- and u.user_name like concat('%',#{dto.loanUserName},'%')
|
|
|
- </if>
|
|
|
<if test="dto.restitutionRequired != null">
|
|
|
and l.restitution_required = #{dto.restitutionRequired}
|
|
|
</if>
|
|
|
@@ -163,6 +174,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="dto.restitutionToId != null">
|
|
|
and l.restitution_to_id = #{dto.restitutionToId}
|
|
|
</if>
|
|
|
+ <if test="dto.materialsTypeId != null">
|
|
|
+ and m.materials_type_id = #{dto.materialsTypeId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.loanUserName != null and dto.loanUserName.trim != ''">
|
|
|
+ and u.user_name like concat('%',#{dto.loanUserName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="dto.loanTimeStart != null and dto.loanTimeStart.trim != ''">
|
|
|
+ and l.loan_time >= #{dto.loanTimeStart}
|
|
|
+ </if>
|
|
|
+ <if test="dto.loanTimeEnd != null and dto.loanTimeEnd.trim != ''">
|
|
|
+ and l.loan_time <= #{dto.loanTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="dto.restitutionUserName != null and dto.restitutionUserName.trim != ''">
|
|
|
+ and u1.user_name like concat('%',#{dto.restitutionUserName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="dto.restitutionTimeStart != null and dto.restitutionTimeStart.trim != ''">
|
|
|
+ and l.actual_restitution_time >= #{dto.restitutionTimeStart}
|
|
|
+ </if>
|
|
|
+ <if test="dto.restitutionTimeEnd != null and dto.restitutionTimeEnd.trim != ''">
|
|
|
+ and l.actual_restitution_time <= #{dto.restitutionTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="dto.status != null and dto.status.trim != ''">
|
|
|
+ and l.status = #{dto.status}
|
|
|
+ </if>
|
|
|
+
|
|
|
</where>
|
|
|
ORDER BY l.materials_loan_id DESC
|
|
|
</select>
|