Newer
Older
casic-metering / casic-metering-dao / src / main / resources / mapper / meter / MeterFixedAssetsMapper.xml
xiezhuangz on 16 Jan 2023 5 KB 申请流程提交,流程状态查询
<?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="com.casic.missiles.mapper.MeterFixedAssetsMapper">

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
--         mfa.id, asset_no, asset_type, equipment_name, equipment_no, is_fixed_assets, manufacturer, manufacturer_country, manufacturing_no, manufacturing_date, model_no, manager_state, ABC, label_bind, card_establishment_date, enable_date, mesure_type, mesure_cycle, mesure_range, uncertainty, use_dept,use_person, major_category, mesure_dept, mesure_date, valid_date, mesure_result, is_calibration_test_equipment, is_measure_account, is_standard_support_equipment, asset_source, equipment_specifications, equipment_category, equipment_type, capital_source, manager_level, purpose, technical_level, intact_state, overall_dimension, weight, single_price, install_incidental_expenses, install_place, origin_value, present_origin_value, depreciation_period, depreciation_method, attribute, version, remark, create_user, is_del, create_time, update_time
        mfa.*
    </sql>
    <select id="selectMaxNo" resultType="java.lang.Long">
        SELECT IFNULL(max(RIGHT(asset_no, 12)), 0) from meter_fixed_assets
    </select>

    <select id="listPage" resultType="com.casic.missiles.model.MeterFixedAssets">
        SELECT <include refid="Base_Column_List"/>,
        su.name as usePersonName, sd.full_name as useDeptName,
        mse.standard_no AS supportStandardEquipmentNo,
        mse.standard_name AS supportStandardEquipmentName
        FROM meter_fixed_assets mfa
        LEFT JOIN sys_user su ON su.id = mfa.use_person
        LEFT JOIN sys_dept sd on sd.id = mfa.use_dept
        LEFT JOIN meter_standard_support_equipment msse ON msse.equipment_id = mfa.id and msse.is_del != 1
        LEFT JOIN meter_standard_equipment mse ON msse.standard_equipment_id = mse.id and mse.is_del != 1
        WHERE 1=1 and mfa.is_del != 1
        <if test="fixedAssetRequest.id != null">
            and mfa.id = #{fixedAssetRequest.id}
        </if>
        <if test="fixedAssetRequest.assetNo != null and fixedAssetRequest.assetNo !=''">
            and mfa.asset_no like concat('%', #{fixedAssetRequest.assetNo}, '%')
        </if>
        <if test="fixedAssetRequest.assetType != null">
            and mfa.asset_type = #{fixedAssetRequest.assetType}
        </if>
        <if test="fixedAssetRequest.equipmentNo != null and fixedAssetRequest.equipmentNo !=''">
            and mfa.equipment_no like concat('%', #{fixedAssetRequest.equipmentNo}, '%')
        </if>
        <if test="fixedAssetRequest.equipmentName != null and fixedAssetRequest.equipmentName !=''">
            and mfa.equipment_name like concat('%', #{fixedAssetRequest.equipmentName}, '%')
        </if>
        <if test="fixedAssetRequest.mesureType != null">
            and mfa.mesure_type = #{fixedAssetRequest.mesureType}
        </if>
        <if test="fixedAssetRequest.managerState != null">
            and mfa.manager_state = #{fixedAssetRequest.managerState}
        </if>
        <if test="fixedAssetRequest.useDept != null">
            and mfa.use_dept = #{fixedAssetRequest.useDept}
        </if>
<!--        <if test="fixedAssetRequest.validDate != null">-->
<!--            and DATE_FORMAT(valid_date,'%Y-%m-%d') = #{fixedAssetRequest.validDate}-->
<!--        </if>-->
        <if test="fixedAssetRequest.validDateStart != null and fixedAssetRequest.validDateStart != ''">
            and mfa.valid_date <![CDATA[ >= ]]> #{fixedAssetRequest.validDateStart}
        </if>
        <if test="fixedAssetRequest.validDateEnd != null and fixedAssetRequest.validDateEnd != ''">
            and mfa.valid_date <![CDATA[ <= ]]> #{fixedAssetRequest.validDateEnd}
        </if>
        <if test="fixedAssetRequest.ABC != null and fixedAssetRequest.ABC != ''">
            and mfa.ABC = #{fixedAssetRequest.abc}
        </if>
        <if test="fixedAssetRequest.modelNo != null and fixedAssetRequest.modelNo !=''">
            and mfa.model_no like concat('%', #{fixedAssetRequest.modelNo}, '%')
        </if>
        <if test="fixedAssetRequest.equipmentSpecifications != null and fixedAssetRequest.equipmentSpecifications !=''">
            and mfa.equipment_specifications like concat('%', #{fixedAssetRequest.equipmentSpecifications}, '%')
        </if>
        <if test="fixedAssetRequest.equipmentCategory != null and fixedAssetRequest.equipmentCategory !=''">
            and mfa.equipment_category = #{fixedAssetRequest.equipmentCategory}
        </if>
        <if test="fixedAssetRequest.manufacturingNo != null and fixedAssetRequest.manufacturingNo !=''">
            and mfa.manufacturing_no like concat('%', #{fixedAssetRequest.manufacturingNo}, '%')
        </if>
        <if test="fixedAssetRequest.isCalibrationTestEquipment != null">
            and mfa.is_calibration_test_equipment = #{fixedAssetRequest.isCalibrationTestEquipment}
        </if>
        <if test="fixedAssetRequest.isMeasureAccount != null">
            and mfa.is_measure_account = #{fixedAssetRequest.isMeasureAccount}
        </if>
        <if test="fixedAssetRequest.isStandardSupportEquipment != null">
            and mfa.is_standard_support_equipment = #{fixedAssetRequest.isStandardSupportEquipment}
        </if>
        <if test="fixedAssetRequest.isFixedAssets != null">
            and mfa.is_fixed_assets = #{fixedAssetRequest.isFixedAssets}
        </if>
        <if test="fixedAssetRequest.ids != null and fixedAssetRequest.ids.size() > 0 ">
            and mfa.id in
            <foreach collection='fixedAssetRequest.ids' item='id' open='(' separator=',' close=')'>
                #{id}
            </foreach>
        </if>
        ORDER BY mfa.create_time DESC
    </select>

</mapper>