mitao
19 小时以前 03587b58b343956f910a653c37b9a7bcd84e4af9
ruoyi-system/src/main/resources/mapper/system/OaApprovalApplicationAssetMapper.xml
@@ -17,6 +17,40 @@
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, approval_application_id, title, asset_type_id, operate_time, expect_return_date, type, borrow_application_id
    </sql>
</sql>
    <!-- 分页查询:资产领用申请列表(关联审批记录与资产类型) -->
    <select id="selectReceivePage" resultType="com.ruoyi.system.vo.asset.OaApprovalApplicationAssetPageVO">
        SELECT
            oaa.id                               AS id,
            aaa.application_code                 AS applicationCode,
            oaa.title                            AS title,
            aaa.dept_name                        AS deptName,
            aaa.applicant_name                   AS applicantName,
            CASE WHEN at2.level = 2 THEN at1.type_name ELSE at2.type_name END AS firstAssetTypeName,
            CASE WHEN at2.level = 2 THEN at2.type_name ELSE NULL END         AS secondAssetTypeName,
            oaa.operate_time                     AS operateTime,
            aaa.approval_status                  AS approvalStatus
        FROM oa_approval_application_asset oaa
                 INNER JOIN oa_approval_applications aaa ON aaa.id = oaa.approval_application_id
                 LEFT JOIN asset_type at2 ON at2.id = oaa.asset_type_id
                 LEFT JOIN asset_type at1 ON at1.id = (CASE WHEN at2.level = 2 THEN at2.parent_id ELSE at2.id END)
        <where>
            AND aaa.disabled = 0
            AND oaa.type = 0
            <if test="query != null and query.keyword != null and query.keyword != ''">
                AND (
                    oaa.title LIKE CONCAT('%', #{query.keyword}, '%')
                    OR  aaa.application_code LIKE CONCAT('%', #{query.keyword}, '%')
                    OR  aaa.dept_name LIKE CONCAT('%', #{query.keyword}, '%')
                    OR  aaa.applicant_name LIKE CONCAT('%', #{query.keyword}, '%')
                )
            </if>
            <if test="query != null and query.deptId != null">
                AND aaa.dept_id = #{query.deptId}
            </if>
        </where>
        ORDER BY oaa.operate_time DESC, oaa.id DESC
    </select>
</mapper>