<?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="reservedColumnB"    column="reserved_column_b"    />
        <result property="reservedColumnC"    column="reserved_column_c"    />
        <result property="reservedColumnD"    column="reserved_column_d"    />
        <result property="reservedColumnE"    column="reserved_column_e"    />
        <result property="reservedColumnF"    column="reserved_column_f"    />
        <result property="reservedColumnG"    column="reserved_column_g"    />
        <result property="reservedColumnH"    column="reserved_column_h"    />
        <result property="reservedColumnI"    column="reserved_column_i"    />
        <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, reserved_column_b, reserved_column_c, reserved_column_d, reserved_column_e, reserved_column_f, reserved_column_g, reserved_column_h, reserved_column_i, reserved_column_j from tb_asset_information
    </sql>

    <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 = #{locationNumber}</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="reservedColumnB != null  and reservedColumnB != ''"> and reserved_column_b = #{reservedColumnB}</if>
            <if test="reservedColumnC != null  and reservedColumnC != ''"> and reserved_column_c = #{reservedColumnC}</if>
            <if test="reservedColumnD != null  and reservedColumnD != ''"> and reserved_column_d = #{reservedColumnD}</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="reservedColumnG != null  and reservedColumnG != ''"> and reserved_column_g = #{reservedColumnG}</if>
            <if test="reservedColumnH != null  and reservedColumnH != ''"> and reserved_column_h = #{reservedColumnH}</if>
            <if test="reservedColumnI != null  and reservedColumnI != ''"> and reserved_column_i = #{reservedColumnI}</if>
            <if test="reservedColumnJ != null  and reservedColumnJ != ''"> and reserved_column_j = #{reservedColumnJ}</if>
        </where>
    </select>
    
    <select id="selectTbAssetInformationById" parameterType="Long" resultMap="TbAssetInformationResult">
        <include refid="selectTbAssetInformationVo"/>
        where id = #{id}
    </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="reservedColumnB != null">reserved_column_b,</if>
            <if test="reservedColumnC != null">reserved_column_c,</if>
            <if test="reservedColumnD != null">reserved_column_d,</if>
            <if test="reservedColumnE != null">reserved_column_e,</if>
            <if test="reservedColumnF != null">reserved_column_f,</if>
            <if test="reservedColumnG != null">reserved_column_g,</if>
            <if test="reservedColumnH != null">reserved_column_h,</if>
            <if test="reservedColumnI != null">reserved_column_i,</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="reservedColumnB != null">#{reservedColumnB},</if>
            <if test="reservedColumnC != null">#{reservedColumnC},</if>
            <if test="reservedColumnD != null">#{reservedColumnD},</if>
            <if test="reservedColumnE != null">#{reservedColumnE},</if>
            <if test="reservedColumnF != null">#{reservedColumnF},</if>
            <if test="reservedColumnG != null">#{reservedColumnG},</if>
            <if test="reservedColumnH != null">#{reservedColumnH},</if>
            <if test="reservedColumnI != null">#{reservedColumnI},</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="reservedColumnB != null">reserved_column_b = #{reservedColumnB},</if>
            <if test="reservedColumnC != null">reserved_column_c = #{reservedColumnC},</if>
            <if test="reservedColumnD != null">reserved_column_d = #{reservedColumnD},</if>
            <if test="reservedColumnE != null">reserved_column_e = #{reservedColumnE},</if>
            <if test="reservedColumnF != null">reserved_column_f = #{reservedColumnF},</if>
            <if test="reservedColumnG != null">reserved_column_g = #{reservedColumnG},</if>
            <if test="reservedColumnH != null">reserved_column_h = #{reservedColumnH},</if>
            <if test="reservedColumnI != null">reserved_column_i = #{reservedColumnI},</if>
            <if test="reservedColumnJ != null">reserved_column_j = #{reservedColumnJ},</if>
        </trim>
        where id = #{id}
    </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>