|
|
@@ -3,7 +3,7 @@
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.ktg.iscs.mapper.IsMaterialsLoanMapper">
|
|
|
-
|
|
|
+
|
|
|
<resultMap type="IsMaterialsLoan" id="IsMaterialsLoanResult">
|
|
|
<result property="materialsLoanId" column="materials_loan_id" />
|
|
|
<result property="materialsId" column="materials_id" />
|
|
|
@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="restitutionUserId" column="restitution_user_id" />
|
|
|
<result property="restitutionToId" column="restitution_to_id" />
|
|
|
<result property="restitutionTime" column="restitution_time" />
|
|
|
+ <result property="restitutionRequired" column="restitution_required" />
|
|
|
<result property="remark" column="remark" />
|
|
|
<result property="delFlag" column="del_flag" />
|
|
|
<result property="createBy" column="create_by" />
|
|
|
@@ -28,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
<select id="selectIsMaterialsLoanList" parameterType="IsMaterialsLoan" resultMap="IsMaterialsLoanResult">
|
|
|
<include refid="selectIsMaterialsLoanVo"/>
|
|
|
- <where>
|
|
|
+ <where>
|
|
|
<if test="materialsId != null "> and materials_id = #{materialsId}</if>
|
|
|
<if test="loanUserId != null "> and loan_user_id = #{loanUserId}</if>
|
|
|
<if test="loanFromId != null "> and loan_from_id = #{loanFromId}</if>
|
|
|
@@ -39,12 +40,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="restitutionTime != null "> and restitution_time = #{restitutionTime}</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<select id="selectIsMaterialsLoanByMaterialsLoanId" parameterType="Long" resultMap="IsMaterialsLoanResult">
|
|
|
<include refid="selectIsMaterialsLoanVo"/>
|
|
|
where materials_loan_id = #{materialsLoanId}
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<insert id="insertIsMaterialsLoan" parameterType="IsMaterialsLoan" useGeneratedKeys="true" keyProperty="materialsLoanId">
|
|
|
insert into is_materials_loan
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
@@ -56,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="restitutionUserId != null">restitution_user_id,</if>
|
|
|
<if test="restitutionToId != null">restitution_to_id,</if>
|
|
|
<if test="restitutionTime != null">restitution_time,</if>
|
|
|
+ <if test="restitutionRequired != null">restitutionRequired,</if>
|
|
|
<if test="remark != null">remark,</if>
|
|
|
<if test="delFlag != null">del_flag,</if>
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
@@ -72,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="restitutionUserId != null">#{restitutionUserId},</if>
|
|
|
<if test="restitutionToId != null">#{restitutionToId},</if>
|
|
|
<if test="restitutionTime != null">#{restitutionTime},</if>
|
|
|
+ <if test="restitutionRequired != null">#{restitutionRequired},</if>
|
|
|
<if test="remark != null">#{remark},</if>
|
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
@@ -92,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="restitutionUserId != null">restitution_user_id = #{restitutionUserId},</if>
|
|
|
<if test="restitutionToId != null">restitution_to_id = #{restitutionToId},</if>
|
|
|
<if test="restitutionTime != null">restitution_time = #{restitutionTime},</if>
|
|
|
+ <if test="restitutionRequired != null">restitution_required = #{restitutionRequired},</if>
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
@@ -107,9 +111,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteIsMaterialsLoanByMaterialsLoanIds" parameterType="String">
|
|
|
- delete from is_materials_loan where materials_loan_id in
|
|
|
+ delete from is_materials_loan where materials_loan_id in
|
|
|
<foreach item="materialsLoanId" collection="array" open="(" separator="," close=")">
|
|
|
#{materialsLoanId}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
-</mapper>
|
|
|
+
|
|
|
+ <select id="getIsMaterialsLoanPage" resultType="com.ktg.iscs.domain.vo.MaterialsLoan.MaterialsLoanPageVO">
|
|
|
+ SELECT
|
|
|
+ l.*,
|
|
|
+ m.materials_code,
|
|
|
+ m.materials_name,
|
|
|
+ c1.cabinet_name as loan_from_name,
|
|
|
+ c2.cabinet_name as restitution_to_name,
|
|
|
+ u.user_name as loan_user_name
|
|
|
+ FROM
|
|
|
+ is_materials_loan l
|
|
|
+ LEFT JOIN is_materials m ON m.materials_id = l.materials_id
|
|
|
+ LEFT JOIN is_materials_cabinet c1 ON c1.cabinet_id = l.loan_from_id
|
|
|
+ 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
|
|
|
+ <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>
|
|
|
+ <if test="dto.loanFromId != null">
|
|
|
+ and l.loan_from_id = #{dto.loanFromId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.restitutionToId != null">
|
|
|
+ and l.restitution_to_id = #{dto.restitutionToId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY l.materials_loan_id DESC
|
|
|
+ </select>
|
|
|
+</mapper>
|