<?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.ruoyi.asset.mapper.TbAssetInformationMapper">
    
    <resultMap type="TbAssetInformation" id="TbAssetInformationResult">
        <result property="id"    column="id"    />
        <result property="code"    column="code"    />
        <result property="name"    column="name"    />
        <result property="number"    column="number"    />
        <result property="imageUrl"    column="image_url"    />
        <result property="categoryNumber"    column="category_number"    />
        <result property="specificationsModel"    column="specifications_model"    />
        <result property="abcCategory"    column="abc_category"    />
        <result property="manageStatus"    column="manage_status"    />
        <result property="userDepartment"    column="user_department"    />
        <result property="department"    column="department"    />
        <result property="responsiblePerson"    column="responsible_person"    />
        <result property="locationNumber"    column="location_number"    />
        <result property="property"    column="property"    />
        <result property="purchaseDate"    column="purchase_date"    />
        <result property="commissioningDate"    column="commissioning_date"    />
        <result property="originalValue"    column="original_value"    />
        <result property="durableYears"    column="durable_years"    />
        <result property="netValue"    column="net_value"    />
        <result property="residualValue"    column="residual_value"    />
        <result property="accumulatedDepreciation"    column="accumulated_depreciation"    />
        <result property="lastDepreciationDate"    column="last_depreciation_date"    />
        <result property="depreciationMethod"    column="depreciation_method"    />
        <result property="contractNumber"    column="contract_number"    />
        <result property="factoryNumber"    column="factory_number"    />
        <result property="manufacturer"    column="manufacturer"    />
        <result property="supplier"    column="supplier"    />
        <result property="purpose"    column="purpose"    />
        <result property="maintenanceDate"    column="maintenance_date"    />
        <result property="maintenanceTel"    column="maintenance_tel"    />
        <result property="maintenanceUser"    column="maintenance_user"    />
        <result property="corporation"    column="corporation"    />
        <result property="recordStatus"    column="record_status"    />
        <result property="remark"    column="remark"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="isWhitelist"    column="is_whitelist"    />
        <result property="quantity"    column="quantity"    />
        <result property="units"    column="units"    />
        <result property="paymentReceivingTime"    column="payment_receiving_time"    />
        <result property="epc"    column="epc"    />
        <result property="epcReplenishLength"    column="epc_replenish_length"    />
        <result property="lifeExpectancy"    column="life_expectancy"    />
        <result property="lifeUnits"    column="life_units"    />
        <result property="startDate"    column="start_date"    />
        <result property="reservedColumnJ"    column="reserved_column_j"    />
    </resultMap>

    <sql id="selectTbAssetInformationVo">
        select id, code, name, number, image_url, category_number, specifications_model, abc_category, manage_status, user_department, department, responsible_person, location_number, property, purchase_date, commissioning_date, original_value, durable_years, net_value, residual_value, accumulated_depreciation, last_depreciation_date, depreciation_method, contract_number, factory_number, manufacturer, supplier, purpose, maintenance_date, maintenance_tel, maintenance_user, corporation, record_status, remark, create_by, create_time, update_by, update_time, is_whitelist, quantity, units, payment_receiving_time, epc, epc_replenish_length, life_expectancy, life_units, start_date, reserved_column_j from tb_asset_information
    </sql>

    <sql id="selectTbAssetInformation">
        SELECT
            a.id, a.code, a.name, a.number,
            a.image_url imageUrl,
            a.category_number categoryNumber,
            a.specifications_model specificationsModel,
            a.abc_category abcCategory,
            a.manage_status manageStatus,
            a.user_department userDepartment,
            a.department,
            a.responsible_person responsiblePerson,
            a.location_number locationNumber,
            a.property,
            a.purchase_date purchaseDate,
            a.commissioning_date commissioningDate,
            a.original_value originalValue,
            a.durable_years durableYears,
            a.net_value netValue,
            a.residual_value residualValue,
            a.accumulated_depreciation accumulatedDepreciation,
            a.last_depreciation_date lastDepreciationDate,
            a.depreciation_method depreciationMethod,
            a.contract_number contractNumber,
            a.factory_number factoryNumber,
            a.manufacturer,
            a.supplier,
            a.purpose,
            a.maintenance_tel maintenanceTel,
            a.maintenance_date maintenanceDate,
            a.maintenance_user maintenanceUser,
            a.corporation,
            a.record_status recordStatus,
            a.remark,
            a.create_by createBy,
            a.create_time createTime,
            a.update_by updateBy,
            a.update_time updateTime,
            a.is_whitelist isWhitelist,
            a.quantity,
            a.units,
            a.payment_receiving_time paymentReceivingTime,
            a.epc,
            a.epc_replenish_length epcReplenishLength,
            a.life_expectancy lifeExpectancy,
            a.life_units lifeUnits,
            a.start_date startDate,
            b.id locationId,
            b.name locationName,
            b.label locationLabel,
            g.id parentLocationId,
            g.name parentLocationName,
            g.label parentLocationLabel,
            h.id ancestorLocationId,
            h.name ancestorLocationName,
            h.label ancestorLocationLabel,
            c.id categoryId,
            c.name categoryName,
            d.dept_name userDepartmentName,
            e.dept_name departmentName,
            f.dept_name corporationName
        FROM `tb_asset_information` a
        LEFT JOIN tb_location b ON a.location_number = b.number
        LEFT JOIN tb_location g ON b.parent_id = g.id
        LEFT JOIN tb_location h ON g.parent_id = h.id
        LEFT JOIN tb_asset_category c ON a.category_number = c.number
        LEFT JOIN sys_dept d ON a.user_department = d.dept_id
        LEFT JOIN sys_dept e ON a.department = e.dept_id
        LEFT JOIN sys_dept f ON a.corporation = f.dept_id
    </sql>

    <select id="selectInfoList" parameterType="TbAssetInformation" resultType="TbAssetInformation">
        SELECT
            a.id, a.code, a.name, a.number,
            a.image_url imageUrl,
            a.category_number categoryNumber,
            a.specifications_model specificationsModel,
            a.abc_category abcCategory,
            a.manage_status manageStatus,
            a.user_department userDepartment,
            a.department,
            a.responsible_person responsiblePerson,
            a.location_number locationNumber,
            a.property,
            a.purchase_date purchaseDate,
            a.commissioning_date commissioningDate,
            a.original_value originalValue,
            a.durable_years durableYears,
            a.net_value netValue,
            a.residual_value residualValue,
            a.accumulated_depreciation accumulatedDepreciation,
            a.last_depreciation_date lastDepreciationDate,
            a.depreciation_method depreciationMethod,
            a.contract_number contractNumber,
            a.factory_number factoryNumber,
            a.manufacturer,
            a.supplier,
            a.purpose,
            a.maintenance_tel maintenanceTel,
            a.maintenance_date maintenanceDate,
            a.maintenance_user maintenanceUser,
            a.corporation,
            a.record_status recordStatus,
            a.remark,
            a.create_by createBy,
            a.create_time createTime,
            a.update_by updateBy,
            a.update_time updateTime,
            a.is_whitelist isWhitelist,
            a.quantity,
            a.units,
            a.payment_receiving_time paymentReceivingTime,
            a.epc,
            a.epc_replenish_length epcReplenishLength,
            a.life_expectancy lifeExpectancy,
            a.life_units lifeUnits,
            a.start_date startDate,
            b.id locationId,
            b.name locationName,
            b.label locationLabel,
            c.id categoryId,
            c.name categoryName,
            d.dept_name userDepartmentName,
            e.dept_name departmentName,
            f.dept_name corporationName
        FROM `tb_asset_information` a
        LEFT JOIN tb_location b ON a.location_number = b.number
        LEFT JOIN tb_asset_category c ON a.category_number = c.number
        LEFT JOIN sys_dept d ON a.user_department = d.dept_id
        LEFT JOIN sys_dept e ON a.department = e.dept_id
        LEFT JOIN sys_dept f ON a.corporation = f.dept_id
        <where>
            <if test="locationNumber != null  and locationNumber != ''"> and a.location_number in
                <foreach collection="nlist" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        </where>
    </select>

<!--    <select id="selectTbAssetInformationList" parameterType="TbAssetInformation" resultMap="TbAssetInformationResult">-->
<!--        <include refid="selectTbAssetInformationVo"/>-->
<!--        <where>  -->
<!--            <if test="code != null  and code != ''"> and code = #{code}</if>-->
<!--            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>-->
<!--            <if test="number != null  and number != ''"> and number = #{number}</if>-->
<!--            <if test="imageUrl != null  and imageUrl != ''"> and image_url = #{imageUrl}</if>-->
<!--            <if test="categoryNumber != null  and categoryNumber != ''"> and category_number = #{categoryNumber}</if>-->
<!--            <if test="specificationsModel != null  and specificationsModel != ''"> and specifications_model = #{specificationsModel}</if>-->
<!--            <if test="abcCategory != null  and abcCategory != ''"> and abc_category = #{abcCategory}</if>-->
<!--            <if test="manageStatus != null "> and manage_status = #{manageStatus}</if>-->
<!--            <if test="userDepartment != null  and userDepartment != ''"> and user_department = #{userDepartment}</if>-->
<!--            <if test="department != null  and department != ''"> and department = #{department}</if>-->
<!--            <if test="responsiblePerson != null  and responsiblePerson != ''"> and responsible_person = #{responsiblePerson}</if>-->
<!--            <if test="locationNumber != null  and locationNumber != ''"> and location_number in-->
<!--             <foreach collection="nlist" item="item" open="(" separator="," close=")">-->
<!--                 #{item}-->
<!--             </foreach> </if>-->
<!--            <if test="property != null  and property != ''"> and property = #{property}</if>-->
<!--            <if test="purchaseDate != null "> and purchase_date = #{purchaseDate}</if>-->
<!--            <if test="commissioningDate != null "> and commissioning_date = #{commissioningDate}</if>-->
<!--            <if test="originalValue != null  and originalValue != ''"> and original_value = #{originalValue}</if>-->
<!--            <if test="durableYears != null "> and durable_years = #{durableYears}</if>-->
<!--            <if test="netValue != null  and netValue != ''"> and net_value = #{netValue}</if>-->
<!--            <if test="residualValue != null  and residualValue != ''"> and residual_value = #{residualValue}</if>-->
<!--            <if test="accumulatedDepreciation != null  and accumulatedDepreciation != ''"> and accumulated_depreciation = #{accumulatedDepreciation}</if>-->
<!--            <if test="lastDepreciationDate != null "> and last_depreciation_date = #{lastDepreciationDate}</if>-->
<!--            <if test="depreciationMethod != null "> and depreciation_method = #{depreciationMethod}</if>-->
<!--            <if test="contractNumber != null  and contractNumber != ''"> and contract_number = #{contractNumber}</if>-->
<!--            <if test="factoryNumber != null  and factoryNumber != ''"> and factory_number = #{factoryNumber}</if>-->
<!--            <if test="manufacturer != null  and manufacturer != ''"> and manufacturer = #{manufacturer}</if>-->
<!--            <if test="supplier != null  and supplier != ''"> and supplier = #{supplier}</if>-->
<!--            <if test="purpose != null  and purpose != ''"> and purpose = #{purpose}</if>-->
<!--            <if test="maintenanceDate != null "> and maintenance_date = #{maintenanceDate}</if>-->
<!--            <if test="maintenanceTel != null  and maintenanceTel != ''"> and maintenance_tel = #{maintenanceTel}</if>-->
<!--            <if test="maintenanceUser != null  and maintenanceUser != ''"> and maintenance_user = #{maintenanceUser}</if>-->
<!--            <if test="corporation != null  and corporation != ''"> and corporation = #{corporation}</if>-->
<!--            <if test="recordStatus != null "> and record_status = #{recordStatus}</if>-->
<!--            <if test="isWhitelist != null  and isWhitelist != ''"> and is_whitelist = #{isWhitelist}</if>-->
<!--            <if test="quantity != null  and quantity != ''"> and quantity = #{quantity}</if>-->
<!--            <if test="units != null  and units != ''"> and units = #{units}</if>-->
<!--            <if test="paymentReceivingTime != null"> and payment_receiving_time = #{paymentReceivingTime}</if>-->
<!--            <if test="reservedColumnE != null  and reservedColumnE != ''"> and reserved_column_e = #{reservedColumnE}</if>-->
<!--            <if test="reservedColumnF != null  and reservedColumnF != ''"> and reserved_column_f = #{reservedColumnF}</if>-->
<!--            <if test="lifeExpectancy != null  and lifeExpectancy != ''"> and life_expectancy = #{lifeExpectancy}</if>-->
<!--            <if test="lifeUnits != null  and lifeUnits != ''"> and life_units = #{lifeUnits}</if>-->
<!--            <if test="startDate != null"> and start_date = #{startDate}</if>-->
<!--            <if test="reservedColumnJ != null  and reservedColumnJ != ''"> and reserved_column_j = #{reservedColumnJ}</if>-->
<!--        </where>-->
<!--    </select>-->

    <select id="selectTbAssetInformationList" parameterType="TbAssetInformation" resultType="TbAssetInformation">
        <include refid="selectTbAssetInformation"/>
        <where>
            <if test="code != null  and code != ''"> and a.code = #{code}</if>
            <if test="name != null  and name != ''"> and a.name like concat('%', #{name}, '%')</if>
            <if test="number != null  and number != ''"> and a.number = #{number}</if>
            <if test="imageUrl != null  and imageUrl != ''"> and a.image_url = #{imageUrl}</if>
            <if test="categoryNumber != null  and categoryNumber != ''"> and a.category_number = #{categoryNumber}</if>
            <if test="specificationsModel != null  and specificationsModel != ''"> and a.specifications_model = #{specificationsModel}</if>
            <if test="abcCategory != null  and abcCategory != ''"> and a.abc_category = #{abcCategory}</if>
            <if test="manageStatus != null "> and a.manage_status = #{manageStatus}</if>
            <if test="userDepartment != null  and userDepartment != ''"> and a.user_department = #{userDepartment}</if>
            <if test="department != null  and department != ''"> and a.department = #{department}</if>
            <if test="responsiblePerson != null  and responsiblePerson != ''"> and a.responsible_person = #{responsiblePerson}</if>
            <if test="locationNumber != null  and locationNumber != ''"> and a.location_number in
                <foreach collection="nlist" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach> </if>
            <if test="property != null  and property != ''"> and a.property = #{property}</if>
            <if test="purchaseDate != null "> and a.purchase_date = #{purchaseDate}</if>
            <if test="commissioningDate != null "> and a.commissioning_date = #{commissioningDate}</if>
            <if test="originalValue != null  and originalValue != ''"> and a.original_value = #{originalValue}</if>
            <if test="durableYears != null "> and a.durable_years = #{durableYears}</if>
            <if test="netValue != null  and netValue != ''"> and a.net_value = #{netValue}</if>
            <if test="residualValue != null  and residualValue != ''"> and a.residual_value = #{residualValue}</if>
            <if test="accumulatedDepreciation != null  and accumulatedDepreciation != ''"> and accumulated_depreciation = #{accumulatedDepreciation}</if>
            <if test="lastDepreciationDate != null "> and a.last_depreciation_date = #{lastDepreciationDate}</if>
            <if test="depreciationMethod != null "> and a.depreciation_method = #{depreciationMethod}</if>
            <if test="contractNumber != null  and contractNumber != ''"> and a.contract_number = #{contractNumber}</if>
            <if test="factoryNumber != null  and factoryNumber != ''"> and a.factory_number = #{factoryNumber}</if>
            <if test="manufacturer != null  and manufacturer != ''"> and a.manufacturer = #{manufacturer}</if>
            <if test="supplier != null  and supplier != ''"> and a.supplier = #{supplier}</if>
            <if test="purpose != null  and purpose != ''"> and a.purpose = #{purpose}</if>
            <if test="maintenanceDate != null "> and a.maintenance_date = #{maintenanceDate}</if>
            <if test="maintenanceTel != null  and maintenanceTel != ''"> and a.maintenance_tel = #{maintenanceTel}</if>
            <if test="maintenanceUser != null  and maintenanceUser != ''"> and a.maintenance_user = #{maintenanceUser}</if>
            <if test="corporation != null  and corporation != ''"> and a.corporation = #{corporation}</if>
            <if test="recordStatus != null "> and a.record_status = #{recordStatus}</if>
            <if test="isWhitelist != null  and isWhitelist != ''"> and a.is_whitelist = #{isWhitelist}</if>
            <if test="quantity != null  and quantity != ''"> and a.quantity = #{quantity}</if>
            <if test="units != null  and units != ''"> and a.units = #{units}</if>
            <if test="paymentReceivingTime != null"> and a.payment_receiving_time = #{paymentReceivingTime}</if>
            <if test="epc != null  and epc != ''"> and a.epc = #{epc}</if>
            <if test="epcReplenishLength != null"> and a.epc_replenish_length = #{epcReplenishLength}</if>
            <if test="lifeExpectancy != null"> and a.life_expectancy = #{lifeExpectancy}</if>
            <if test="lifeUnits != null  and lifeUnits != ''"> and a.life_units = #{lifeUnits}</if>
            <if test="startDate != null"> and a.start_date = #{startDate}</if>
            <if test="reservedColumnJ != null  and reservedColumnJ != ''"> and a.reserved_column_j = #{reservedColumnJ}</if>
        </where>
    </select>

    <select id="selectNumberByLocations" parameterType="String" resultType="String">
        select a.number from tb_asset_information a
        where a.location_number in
        <foreach item="item" collection="locations" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

    <select id="selectAssetInformationByLocations" parameterType="String" resultType="TbAssetInformation">
        <include refid="selectTbAssetInformation"/>
        where a.location_number in
        <foreach item="item" collection="locations" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

    <select id="selectTbAssetInformationByEpcList" parameterType="String" resultType="TbAssetInformation">
        <include refid="selectTbAssetInformation"/>
        where a.epc in
        <foreach item="epc" collection="epcList" open="(" separator="," close=")">
            #{epc}
        </foreach>
    </select>
    
<!--    <select id="selectTbAssetInformationById" parameterType="Long" resultMap="TbAssetInformationResult">-->
<!--        <include refid="selectTbAssetInformationVo"/>-->
<!--        where id = #{id}-->
<!--    </select>-->

    <select id="selectTbAssetInformationById" parameterType="Long" resultType="TbAssetInformation">
        <include refid="selectTbAssetInformation"/>
        where a.id = #{id}
    </select>

    <!--List<TbAssetInformation> selectTbAssetInformationByIds(Long[] ids);-->
<!--    <select id="selectTbAssetInformationByIds" parameterType="String" resultMap="TbAssetInformationResult">-->
<!--        <include refid="selectTbAssetInformationVo"/>-->
<!--        where id in-->
<!--        <foreach item="id" collection="list" open="(" separator="," close=")">-->
<!--            #{id}-->
<!--        </foreach>-->
<!--    </select>-->

    <select id="selectTbAssetInformationByIds" parameterType="String" resultType="TbAssetInformation">
        <include refid="selectTbAssetInformation"/>
        where a.id in
        <foreach item="id" collection="list" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>

<!--    <select id="selectTbAssetInformationByAssetNumber" parameterType="String" resultMap="TbAssetInformationResult">-->
<!--        <include refid="selectTbAssetInformationVo"></include>-->
<!--        where number = #{assetNumber}-->
<!--    </select>-->

    <select id="selectTbAssetInformationByAssetNumber" parameterType="String" resultType="TbAssetInformation">
        <include refid="selectTbAssetInformation"></include>
        where a.number = #{assetNumber}
    </select>

    <select id="selectTbAssetInformationByEpc" parameterType="String" resultType="TbAssetInformation">
        <include refid="selectTbAssetInformation"></include>
        where a.epc = #{epc}
    </select>
        
    <insert id="insertTbAssetInformation" parameterType="TbAssetInformation" useGeneratedKeys="true" keyProperty="id">
        insert into tb_asset_information
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="code != null">code,</if>
            <if test="name != null">name,</if>
            <if test="number != null and number != ''">number,</if>
            <if test="imageUrl != null">image_url,</if>
            <if test="categoryNumber != null">category_number,</if>
            <if test="specificationsModel != null and specificationsModel != ''">specifications_model,</if>
            <if test="abcCategory != null">abc_category,</if>
            <if test="manageStatus != null">manage_status,</if>
            <if test="userDepartment != null">user_department,</if>
            <if test="department != null">department,</if>
            <if test="responsiblePerson != null">responsible_person,</if>
            <if test="locationNumber != null">location_number,</if>
            <if test="property != null">property,</if>
            <if test="purchaseDate != null">purchase_date,</if>
            <if test="commissioningDate != null">commissioning_date,</if>
            <if test="originalValue != null">original_value,</if>
            <if test="durableYears != null">durable_years,</if>
            <if test="netValue != null">net_value,</if>
            <if test="residualValue != null">residual_value,</if>
            <if test="accumulatedDepreciation != null">accumulated_depreciation,</if>
            <if test="lastDepreciationDate != null">last_depreciation_date,</if>
            <if test="depreciationMethod != null">depreciation_method,</if>
            <if test="contractNumber != null">contract_number,</if>
            <if test="factoryNumber != null">factory_number,</if>
            <if test="manufacturer != null">manufacturer,</if>
            <if test="supplier != null">supplier,</if>
            <if test="purpose != null">purpose,</if>
            <if test="maintenanceDate != null">maintenance_date,</if>
            <if test="maintenanceTel != null">maintenance_tel,</if>
            <if test="maintenanceUser != null">maintenance_user,</if>
            <if test="corporation != null">corporation,</if>
            <if test="recordStatus != null">record_status,</if>
            <if test="remark != null">remark,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="isWhitelist != null">is_whitelist,</if>
            <if test="quantity != null">quantity,</if>
            <if test="units != null">units,</if>
            <if test="paymentReceivingTime != null">payment_receiving_time,</if>
            <if test="epc != null">epc,</if>
            <if test="epcReplenishLength != null">epc_replenish_length,</if>
            <if test="lifeExpectancy != null">life_expectancy,</if>
            <if test="lifeUnits != null">life_units,</if>
            <if test="startDate != null">start_date,</if>
            <if test="reservedColumnJ != null">reserved_column_j,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="code != null">#{code},</if>
            <if test="name != null">#{name},</if>
            <if test="number != null and number != ''">#{number},</if>
            <if test="imageUrl != null">#{imageUrl},</if>
            <if test="categoryNumber != null">#{categoryNumber},</if>
            <if test="specificationsModel != null and specificationsModel != ''">#{specificationsModel},</if>
            <if test="abcCategory != null">#{abcCategory},</if>
            <if test="manageStatus != null">#{manageStatus},</if>
            <if test="userDepartment != null">#{userDepartment},</if>
            <if test="department != null">#{department},</if>
            <if test="responsiblePerson != null">#{responsiblePerson},</if>
            <if test="locationNumber != null">#{locationNumber},</if>
            <if test="property != null">#{property},</if>
            <if test="purchaseDate != null">#{purchaseDate},</if>
            <if test="commissioningDate != null">#{commissioningDate},</if>
            <if test="originalValue != null">#{originalValue},</if>
            <if test="durableYears != null">#{durableYears},</if>
            <if test="netValue != null">#{netValue},</if>
            <if test="residualValue != null">#{residualValue},</if>
            <if test="accumulatedDepreciation != null">#{accumulatedDepreciation},</if>
            <if test="lastDepreciationDate != null">#{lastDepreciationDate},</if>
            <if test="depreciationMethod != null">#{depreciationMethod},</if>
            <if test="contractNumber != null">#{contractNumber},</if>
            <if test="factoryNumber != null">#{factoryNumber},</if>
            <if test="manufacturer != null">#{manufacturer},</if>
            <if test="supplier != null">#{supplier},</if>
            <if test="purpose != null">#{purpose},</if>
            <if test="maintenanceDate != null">#{maintenanceDate},</if>
            <if test="maintenanceTel != null">#{maintenanceTel},</if>
            <if test="maintenanceUser != null">#{maintenanceUser},</if>
            <if test="corporation != null">#{corporation},</if>
            <if test="recordStatus != null">#{recordStatus},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="isWhitelist != null">#{isWhitelist},</if>
            <if test="quantity != null">#{quantity},</if>
            <if test="units != null">#{units},</if>
            <if test="paymentReceivingTime != null">#{paymentReceivingTime},</if>
            <if test="epc != null">#{epc},</if>
            <if test="epcReplenishLength != null">#{epcReplenishLength},</if>
            <if test="lifeExpectancy != null">#{lifeExpectancy},</if>
            <if test="lifeUnits != null">#{lifeUnits},</if>
            <if test="startDate != null">#{startDate},</if>
            <if test="reservedColumnJ != null">#{reservedColumnJ},</if>
         </trim>
    </insert>

    <update id="updateTbAssetInformation" parameterType="TbAssetInformation">
        update tb_asset_information
        <trim prefix="SET" suffixOverrides=",">
            <if test="code != null">code = #{code},</if>
            <if test="name != null">name = #{name},</if>
            <if test="number != null and number != ''">number = #{number},</if>
            <if test="imageUrl != null">image_url = #{imageUrl},</if>
            <if test="categoryNumber != null">category_number = #{categoryNumber},</if>
            <if test="specificationsModel != null and specificationsModel != ''">specifications_model = #{specificationsModel},</if>
            <if test="abcCategory != null">abc_category = #{abcCategory},</if>
            <if test="manageStatus != null">manage_status = #{manageStatus},</if>
            <if test="userDepartment != null">user_department = #{userDepartment},</if>
            <if test="department != null">department = #{department},</if>
            <if test="responsiblePerson != null">responsible_person = #{responsiblePerson},</if>
            <if test="locationNumber != null">location_number = #{locationNumber},</if>
            <if test="property != null">property = #{property},</if>
            <if test="purchaseDate != null">purchase_date = #{purchaseDate},</if>
            <if test="commissioningDate != null">commissioning_date = #{commissioningDate},</if>
            <if test="originalValue != null">original_value = #{originalValue},</if>
            <if test="durableYears != null">durable_years = #{durableYears},</if>
            <if test="netValue != null">net_value = #{netValue},</if>
            <if test="residualValue != null">residual_value = #{residualValue},</if>
            <if test="accumulatedDepreciation != null">accumulated_depreciation = #{accumulatedDepreciation},</if>
            <if test="lastDepreciationDate != null">last_depreciation_date = #{lastDepreciationDate},</if>
            <if test="depreciationMethod != null">depreciation_method = #{depreciationMethod},</if>
            <if test="contractNumber != null">contract_number = #{contractNumber},</if>
            <if test="factoryNumber != null">factory_number = #{factoryNumber},</if>
            <if test="manufacturer != null">manufacturer = #{manufacturer},</if>
            <if test="supplier != null">supplier = #{supplier},</if>
            <if test="purpose != null">purpose = #{purpose},</if>
            <if test="maintenanceDate != null">maintenance_date = #{maintenanceDate},</if>
            <if test="maintenanceTel != null">maintenance_tel = #{maintenanceTel},</if>
            <if test="maintenanceUser != null">maintenance_user = #{maintenanceUser},</if>
            <if test="corporation != null">corporation = #{corporation},</if>
            <if test="recordStatus != null">record_status = #{recordStatus},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="isWhitelist != null">is_whitelist = #{isWhitelist},</if>
            <if test="quantity != null">quantity = #{quantity},</if>
            <if test="units != null">units = #{units},</if>
            <if test="paymentReceivingTime != null">payment_receiving_time = #{paymentReceivingTime},</if>
            <if test="epc != null">epc= #{epc},</if>
            <if test="epcReplenishLength != null">epc_replenish_length = #{epcReplenishLength},</if>
            <if test="lifeExpectancy != null">life_expectancy = #{lifeExpectancy},</if>
            <if test="lifeUnits != null">life_units = #{lifeUnits},</if>
            <if test="startDate != null">start_date = #{startDate},</if>
            <if test="reservedColumnJ != null">reserved_column_j = #{reservedColumnJ},</if>
        </trim>
        where id = #{id}
    </update>

    <update id="updateProperty" parameterType="TbAssetInformation">
        update tb_asset_information set manage_status = #{manageStatus} where number = #{number}
    </update>

    <delete id="deleteTbAssetInformationById" parameterType="Long">
        delete from tb_asset_information where id = #{id}
    </delete>

    <delete id="deleteTbAssetInformationByIds" parameterType="String">
        delete from tb_asset_information where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>