<?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.system.mapper.VAssetlogMapper">

    <resultMap type="com.ruoyi.system.domain.VAssetlog" id="VAssetlogMap">
        <result property="id" column="Id" jdbcType="INTEGER"/>
        <result property="batchid" column="BatchId" jdbcType="INTEGER"/>
        <result property="codeid" column="CodeId" jdbcType="INTEGER"/>
        <result property="created" column="Created" jdbcType="TIMESTAMP"/>
        <result property="username" column="UserName" jdbcType="VARCHAR"/>
        <result property="userid" column="UserId" jdbcType="INTEGER"/>
        <result property="name" column="Name" jdbcType="VARCHAR"/>
        <result property="assetno" column="AssetNo" jdbcType="VARCHAR"/>
        <result property="assettype" column="AssetType" jdbcType="VARCHAR"/>
        <result property="assettypeid" column="AssetTypeId" jdbcType="INTEGER"/>
        <result property="size" column="Size" jdbcType="VARCHAR"/>
        <result property="model" column="Model" jdbcType="VARCHAR"/>
        <result property="brand" column="Brand" jdbcType="VARCHAR"/>
        <result property="buyed" column="Buyed" jdbcType="TIMESTAMP"/>
        <result property="madeat" column="MadeAt" jdbcType="TIMESTAMP"/>
        <result property="assetunitid" column="AssetUnitId" jdbcType="INTEGER"/>
        <result property="assetunit" column="AssetUnit" jdbcType="VARCHAR"/>
        <result property="quantity" column="Quantity" jdbcType="INTEGER"/>
        <result property="unitprice" column="UnitPrice" jdbcType="NUMERIC"/>
        <result property="totalprice" column="TotalPrice" jdbcType="NUMERIC"/>
        <result property="company" column="Company" jdbcType="VARCHAR"/>
        <result property="companyid" column="CompanyId" jdbcType="INTEGER"/>
        <result property="department" column="Department" jdbcType="VARCHAR"/>
        <result property="departmentid" column="DepartmentId" jdbcType="INTEGER"/>
        <result property="savecompany" column="SaveCompany" jdbcType="VARCHAR"/>
        <result property="savecompanyid" column="SaveCompanyId" jdbcType="INTEGER"/>
        <result property="savedepartment" column="SaveDepartment" jdbcType="VARCHAR"/>
        <result property="savedepartmentid" column="SaveDepartmentId" jdbcType="INTEGER"/>
        <result property="location" column="Location" jdbcType="VARCHAR"/>
        <result property="locationid" column="LocationId" jdbcType="INTEGER"/>
        <result property="used" column="Used" jdbcType="VARCHAR"/>
        <result property="usedid" column="UsedId" jdbcType="INTEGER"/>
        <result property="duty" column="Duty" jdbcType="VARCHAR"/>
        <result property="dutyid" column="DutyId" jdbcType="INTEGER"/>
        <result property="assetstate" column="AssetState" jdbcType="VARCHAR"/>
        <result property="assetstateid" column="AssetStateId" jdbcType="INTEGER"/>
        <result property="assetsource" column="AssetSource" jdbcType="VARCHAR"/>
        <result property="assetsourceid" column="AssetSourceId" jdbcType="INTEGER"/>
        <result property="postingdate" column="PostingDate" jdbcType="TIMESTAMP"/>
        <result property="predictyear" column="PredictYear" jdbcType="INTEGER"/>
        <result property="discount" column="Discount" jdbcType="VARCHAR"/>
        <result property="serialnumber" column="SerialNumber" jdbcType="VARCHAR"/>
        <result property="ischecked" column="IsChecked" jdbcType="VARCHAR"/>
        <result property="financeno" column="FinanceNo" jdbcType="VARCHAR"/>
        <result property="financetype" column="FinanceType" jdbcType="VARCHAR"/>
        <result property="originalno" column="OriginalNo" jdbcType="VARCHAR"/>
        <result property="factoryno" column="FactoryNo" jdbcType="VARCHAR"/>
        <result property="memo" column="Memo" jdbcType="VARCHAR"/>
        <result property="repairat" column="RepairAt" jdbcType="TIMESTAMP"/>
        <result property="takestock" column="TakeStock" jdbcType="VARCHAR"/>
        <result property="gone" column="Gone" jdbcType="INTEGER"/>
        <result property="state" column="state" jdbcType="INTEGER"/>
        <result property="scrapat" column="ScrapAt" jdbcType="TIMESTAMP"/>
        <result property="scrapway" column="ScrapWay" jdbcType="VARCHAR"/>
        <result property="typepath" column="TypePath" jdbcType="VARCHAR"/>
        <result property="locationpath" column="LocationPath" jdbcType="VARCHAR"/>
        <result property="companypath" column="CompanyPath" jdbcType="VARCHAR"/>
        <result property="photo" column="Photo" jdbcType="VARCHAR"/>
        <result property="refuse" column="Refuse" jdbcType="VARCHAR"/>
        <result property="formula" column="Formula" jdbcType="INTEGER"/>
        <result property="guid" column="Guid" jdbcType="INTEGER"/>
        <result property="parentid" column="ParentId" jdbcType="INTEGER"/>
        <result property="copyid" column="CopyId" jdbcType="INTEGER"/>
        <result property="jiti" column="Jiti" jdbcType="TIMESTAMP"/>
        <result property="para1" column="Para1" jdbcType="VARCHAR"/>
        <result property="approvalid" column="ApprovalId" jdbcType="INTEGER"/>
        <result property="receive" column="Receive" jdbcType="INTEGER"/>
        <result property="prevDepartment" column="Prev_Department" jdbcType="VARCHAR"/>
        <result property="prevCompany" column="Prev_Company" jdbcType="VARCHAR"/>
        <result property="prevDuty" column="Prev_Duty" jdbcType="VARCHAR"/>
        <result property="prevDutyid" column="Prev_DutyId" jdbcType="INTEGER"/>
        <result property="store" column="Store" jdbcType="VARCHAR"/>
        <result property="beforemonth" column="BeforeMonth" jdbcType="INTEGER"/>
        <result property="beforedepreciation" column="BeforeDepreciation" jdbcType="NUMERIC"/>
        <result property="prevDepid" column="Prev_DepId" jdbcType="INTEGER"/>
        <result property="newplace" column="NewPlace" jdbcType="VARCHAR"/>
        <result property="mainassetno" column="MainAssetNo" jdbcType="VARCHAR"/>
        <result property="tax" column="Tax" jdbcType="INTEGER"/>
        <result property="usefor" column="UseFor" jdbcType="VARCHAR"/>
    </resultMap>

    <!--查询单个-->
    <select id="queryById" resultMap="VAssetlogMap">
        select Id,
               BatchId,
               CodeId,
               Created,
               UserName,
               UserId,
               Name,
               AssetNo,
               AssetType,
               AssetTypeId,
               Size,
               Model,
               Brand,
               Buyed,
               MadeAt,
               AssetUnitId,
               AssetUnit,
               Quantity,
               UnitPrice,
               TotalPrice,
               Company,
               CompanyId,
               Department,
               DepartmentId,
               SaveCompany,
               SaveCompanyId,
               SaveDepartment,
               SaveDepartmentId,
               Location,
               LocationId,
               Used,
               UsedId,
               Duty,
               DutyId,
               AssetState,
               AssetStateId,
               AssetSource,
               AssetSourceId,
               PostingDate,
               PredictYear,
               Discount,
               SerialNumber,
               IsChecked,
               FinanceNo,
               FinanceType,
               OriginalNo,
               FactoryNo,
               Memo,
               RepairAt,
               TakeStock,
               Gone,
               state,
               ScrapAt,
               ScrapWay,
               TypePath,
               LocationPath,
               CompanyPath,
               Photo,
               Refuse,
               Formula,
               Guid,
               ParentId,
               CopyId,
               Jiti,
               Para1,
               ApprovalId,
               Receive,
               Prev_Department,
               Prev_Company,
               Prev_Duty,
               Prev_DutyId,
               Store,
               BeforeMonth,
               BeforeDepreciation,
               Prev_DepId,
               NewPlace,
               MainAssetNo,
               Tax,
               UseFor

        from v_AssetLog
    </select>

    <!--查询指定行数据-->
    <select id="queryAllByLimit" resultMap="VAssetlogMap">
        select
        Id,
        BatchId,
        CodeId,
        Created,
        UserName,
        UserId,
        Name,
        AssetNo,
        AssetType,
        AssetTypeId,
        Size,
        Model,
        Brand,
        Buyed,
        MadeAt,
        AssetUnitId,
        AssetUnit,
        Quantity,
        UnitPrice,
        TotalPrice,
        Company,
        CompanyId,
        Department,
        DepartmentId,
        SaveCompany,
        SaveCompanyId,
        SaveDepartment,
        SaveDepartmentId,
        Location,
        LocationId,
        Used,
        UsedId,
        Duty,
        DutyId,
        AssetState,
        AssetStateId,
        AssetSource,
        AssetSourceId,
        PostingDate,
        PredictYear,
        Discount,
        SerialNumber,
        IsChecked,
        FinanceNo,
        FinanceType,
        OriginalNo,
        FactoryNo,
        Memo,
        RepairAt,
        TakeStock,
        Gone,
        state,
        ScrapAt,
        ScrapWay,
        TypePath,
        LocationPath,
        CompanyPath,
        Photo,
        Refuse,
        Formula,
        Guid,
        ParentId,
        CopyId,
        Jiti,
        Para1,
        ApprovalId,
        Receive,
        Prev_Department,
        Prev_Company,
        Prev_Duty,
        Prev_DutyId,
        Store,
        BeforeMonth,
        BeforeDepreciation,
        Prev_DepId,
        NewPlace,
        MainAssetNo,
        Tax,
        UseFor

        from v_AssetLog
        <where>
            <if test="id != null">
                and Id = #{id}
            </if>
            <if test="batchid != null">
                and BatchId = #{batchid}
            </if>
            <if test="codeid != null">
                and CodeId = #{codeid}
            </if>
            <if test="created != null">
                and Created = #{created}
            </if>
            <if test="username != null and username != ''">
                and UserName = #{username}
            </if>
            <if test="userid != null">
                and UserId = #{userid}
            </if>
            <if test="name != null and name != ''">
                and Name = #{name}
            </if>
            <if test="assetno != null and assetno != ''">
                and AssetNo = #{assetno}
            </if>
            <if test="assettype != null and assettype != ''">
                and AssetType = #{assettype}
            </if>
            <if test="assettypeid != null">
                and AssetTypeId = #{assettypeid}
            </if>
            <if test="size != null and size != ''">
                and Size = #{size}
            </if>
            <if test="model != null and model != ''">
                and Model = #{model}
            </if>
            <if test="brand != null and brand != ''">
                and Brand = #{brand}
            </if>
            <if test="buyed != null">
                and Buyed = #{buyed}
            </if>
            <if test="madeat != null">
                and MadeAt = #{madeat}
            </if>
            <if test="assetunitid != null">
                and AssetUnitId = #{assetunitid}
            </if>
            <if test="assetunit != null and assetunit != ''">
                and AssetUnit = #{assetunit}
            </if>
            <if test="quantity != null">
                and Quantity = #{quantity}
            </if>
            <if test="unitprice != null">
                and UnitPrice = #{unitprice}
            </if>
            <if test="totalprice != null">
                and TotalPrice = #{totalprice}
            </if>
            <if test="company != null and company != ''">
                and Company = #{company}
            </if>
            <if test="companyid != null">
                and CompanyId = #{companyid}
            </if>
            <if test="department != null and department != ''">
                and Department = #{department}
            </if>
            <if test="departmentid != null">
                and DepartmentId = #{departmentid}
            </if>
            <if test="savecompany != null and savecompany != ''">
                and SaveCompany = #{savecompany}
            </if>
            <if test="savecompanyid != null">
                and SaveCompanyId = #{savecompanyid}
            </if>
            <if test="savedepartment != null and savedepartment != ''">
                and SaveDepartment = #{savedepartment}
            </if>
            <if test="savedepartmentid != null">
                and SaveDepartmentId = #{savedepartmentid}
            </if>
            <if test="location != null and location != ''">
                and Location = #{location}
            </if>
            <if test="locationid != null">
                and LocationId = #{locationid}
            </if>
            <if test="used != null and used != ''">
                and Used = #{used}
            </if>
            <if test="usedid != null">
                and UsedId = #{usedid}
            </if>
            <if test="duty != null and duty != ''">
                and Duty = #{duty}
            </if>
            <if test="dutyid != null">
                and DutyId = #{dutyid}
            </if>
            <if test="assetstate != null and assetstate != ''">
                and AssetState = #{assetstate}
            </if>
            <if test="assetstateid != null">
                and AssetStateId = #{assetstateid}
            </if>
            <if test="assetsource != null and assetsource != ''">
                and AssetSource = #{assetsource}
            </if>
            <if test="assetsourceid != null">
                and AssetSourceId = #{assetsourceid}
            </if>
            <if test="postingdate != null">
                and PostingDate = #{postingdate}
            </if>
            <if test="predictyear != null">
                and PredictYear = #{predictyear}
            </if>
            <if test="discount != null and discount != ''">
                and Discount = #{discount}
            </if>
            <if test="serialnumber != null and serialnumber != ''">
                and SerialNumber = #{serialnumber}
            </if>
            <if test="ischecked != null and ischecked != ''">
                and IsChecked = #{ischecked}
            </if>
            <if test="financeno != null and financeno != ''">
                and FinanceNo = #{financeno}
            </if>
            <if test="financetype != null and financetype != ''">
                and FinanceType = #{financetype}
            </if>
            <if test="originalno != null and originalno != ''">
                and OriginalNo = #{originalno}
            </if>
            <if test="factoryno != null and factoryno != ''">
                and FactoryNo = #{factoryno}
            </if>
            <if test="memo != null and memo != ''">
                and Memo = #{memo}
            </if>
            <if test="repairat != null">
                and RepairAt = #{repairat}
            </if>
            <if test="takestock != null and takestock != ''">
                and TakeStock = #{takestock}
            </if>
            and Gone = 0
            and state != 3

            <if test="scrapat != null">
                and ScrapAt = #{scrapat}
            </if>
            <if test="scrapway != null and scrapway != ''">
                and ScrapWay = #{scrapway}
            </if>
            <if test="typepath != null and typepath != ''">
                and TypePath = #{typepath}
            </if>
            <if test="locationpath != null and locationpath != ''">
                and LocationPath = #{locationpath}
            </if>
            <if test="companypath != null and companypath != ''">
                and CompanyPath = #{companypath}
            </if>
            <if test="photo != null and photo != ''">
                and Photo = #{photo}
            </if>
            <if test="refuse != null and refuse != ''">
                and Refuse = #{refuse}
            </if>
            <if test="formula != null">
                and Formula = #{formula}
            </if>

            and Guid = 0

            <if test="parentid != null">
                and ParentId = #{parentid}
            </if>
            <if test="copyid != null">
                and CopyId = #{copyid}
            </if>
            <if test="jiti != null">
                and Jiti = #{jiti}
            </if>
            <if test="para1 != null and para1 != ''">
                and Para1 = #{para1}
            </if>
            <if test="approvalid != null">
                and ApprovalId = #{approvalid}
            </if>
            <if test="receive != null">
                and Receive = #{receive}
            </if>
            <if test="prevDepartment != null and prevDepartment != ''">
                and Prev_Department = #{prevDepartment}
            </if>
            <if test="prevCompany != null and prevCompany != ''">
                and Prev_Company = #{prevCompany}
            </if>
            <if test="prevDuty != null and prevDuty != ''">
                and Prev_Duty = #{prevDuty}
            </if>
            <if test="prevDutyid != null">
                and Prev_DutyId = #{prevDutyid}
            </if>
            <if test="store != null and store != ''">
                and Store = #{store}
            </if>
            <if test="beforemonth != null">
                and BeforeMonth = #{beforemonth}
            </if>
            <if test="beforedepreciation != null">
                and BeforeDepreciation = #{beforedepreciation}
            </if>
            <if test="prevDepid != null">
                and Prev_DepId = #{prevDepid}
            </if>
            <if test="newplace != null and newplace != ''">
                and NewPlace = #{newplace}
            </if>
            <if test="mainassetno != null and mainassetno != ''">
                and MainAssetNo = #{mainassetno}
            </if>
            <if test="tax != null">
                and Tax = #{tax}
            </if>
            <if test="usefor != null and usefor != ''">
                and UseFor = #{usefor}
            </if>
        </where>
    </select>

    <!--统计总行数-->
    <select id="count" resultType="java.lang.Long">
        select count(1)
        from v_AssetLog
        <where>
            <if test="id != null">
                and Id = #{id}
            </if>
            <if test="batchid != null">
                and BatchId = #{batchid}
            </if>
            <if test="codeid != null">
                and CodeId = #{codeid}
            </if>
            <if test="created != null">
                and Created = #{created}
            </if>
            <if test="username != null and username != ''">
                and UserName = #{username}
            </if>
            <if test="userid != null">
                and UserId = #{userid}
            </if>
            <if test="name != null and name != ''">
                and Name = #{name}
            </if>
            <if test="assetno != null and assetno != ''">
                and AssetNo = #{assetno}
            </if>
            <if test="assettype != null and assettype != ''">
                and AssetType = #{assettype}
            </if>
            <if test="assettypeid != null">
                and AssetTypeId = #{assettypeid}
            </if>
            <if test="size != null and size != ''">
                and Size = #{size}
            </if>
            <if test="model != null and model != ''">
                and Model = #{model}
            </if>
            <if test="brand != null and brand != ''">
                and Brand = #{brand}
            </if>
            <if test="buyed != null">
                and Buyed = #{buyed}
            </if>
            <if test="madeat != null">
                and MadeAt = #{madeat}
            </if>
            <if test="assetunitid != null">
                and AssetUnitId = #{assetunitid}
            </if>
            <if test="assetunit != null and assetunit != ''">
                and AssetUnit = #{assetunit}
            </if>
            <if test="quantity != null">
                and Quantity = #{quantity}
            </if>
            <if test="unitprice != null">
                and UnitPrice = #{unitprice}
            </if>
            <if test="totalprice != null">
                and TotalPrice = #{totalprice}
            </if>
            <if test="company != null and company != ''">
                and Company = #{company}
            </if>
            <if test="companyid != null">
                and CompanyId = #{companyid}
            </if>
            <if test="department != null and department != ''">
                and Department = #{department}
            </if>
            <if test="departmentid != null">
                and DepartmentId = #{departmentid}
            </if>
            <if test="savecompany != null and savecompany != ''">
                and SaveCompany = #{savecompany}
            </if>
            <if test="savecompanyid != null">
                and SaveCompanyId = #{savecompanyid}
            </if>
            <if test="savedepartment != null and savedepartment != ''">
                and SaveDepartment = #{savedepartment}
            </if>
            <if test="savedepartmentid != null">
                and SaveDepartmentId = #{savedepartmentid}
            </if>
            <if test="location != null and location != ''">
                and Location = #{location}
            </if>
            <if test="locationid != null">
                and LocationId = #{locationid}
            </if>
            <if test="used != null and used != ''">
                and Used = #{used}
            </if>
            <if test="usedid != null">
                and UsedId = #{usedid}
            </if>
            <if test="duty != null and duty != ''">
                and Duty = #{duty}
            </if>
            <if test="dutyid != null">
                and DutyId = #{dutyid}
            </if>
            <if test="assetstate != null and assetstate != ''">
                and AssetState = #{assetstate}
            </if>
            <if test="assetstateid != null">
                and AssetStateId = #{assetstateid}
            </if>
            <if test="assetsource != null and assetsource != ''">
                and AssetSource = #{assetsource}
            </if>
            <if test="assetsourceid != null">
                and AssetSourceId = #{assetsourceid}
            </if>
            <if test="postingdate != null">
                and PostingDate = #{postingdate}
            </if>
            <if test="predictyear != null">
                and PredictYear = #{predictyear}
            </if>
            <if test="discount != null and discount != ''">
                and Discount = #{discount}
            </if>
            <if test="serialnumber != null and serialnumber != ''">
                and SerialNumber = #{serialnumber}
            </if>
            <if test="ischecked != null and ischecked != ''">
                and IsChecked = #{ischecked}
            </if>
            <if test="financeno != null and financeno != ''">
                and FinanceNo = #{financeno}
            </if>
            <if test="financetype != null and financetype != ''">
                and FinanceType = #{financetype}
            </if>
            <if test="originalno != null and originalno != ''">
                and OriginalNo = #{originalno}
            </if>
            <if test="factoryno != null and factoryno != ''">
                and FactoryNo = #{factoryno}
            </if>
            <if test="memo != null and memo != ''">
                and Memo = #{memo}
            </if>
            <if test="repairat != null">
                and RepairAt = #{repairat}
            </if>
            <if test="takestock != null and takestock != ''">
                and TakeStock = #{takestock}
            </if>
            and Gone = 0
            and state != 3

            <if test="scrapat != null">
                and ScrapAt = #{scrapat}
            </if>
            <if test="scrapway != null and scrapway != ''">
                and ScrapWay = #{scrapway}
            </if>
            <if test="typepath != null and typepath != ''">
                and TypePath = #{typepath}
            </if>
            <if test="locationpath != null and locationpath != ''">
                and LocationPath = #{locationpath}
            </if>
            <if test="companypath != null and companypath != ''">
                and CompanyPath = #{companypath}
            </if>
            <if test="photo != null and photo != ''">
                and Photo = #{photo}
            </if>
            <if test="refuse != null and refuse != ''">
                and Refuse = #{refuse}
            </if>
            <if test="formula != null">
                and Formula = #{formula}
            </if>

            and Guid = 0

            <if test="parentid != null">
                and ParentId = #{parentid}
            </if>
            <if test="copyid != null">
                and CopyId = #{copyid}
            </if>
            <if test="jiti != null">
                and Jiti = #{jiti}
            </if>
            <if test="para1 != null and para1 != ''">
                and Para1 = #{para1}
            </if>
            <if test="approvalid != null">
                and ApprovalId = #{approvalid}
            </if>
            <if test="receive != null">
                and Receive = #{receive}
            </if>
            <if test="prevDepartment != null and prevDepartment != ''">
                and Prev_Department = #{prevDepartment}
            </if>
            <if test="prevCompany != null and prevCompany != ''">
                and Prev_Company = #{prevCompany}
            </if>
            <if test="prevDuty != null and prevDuty != ''">
                and Prev_Duty = #{prevDuty}
            </if>
            <if test="prevDutyid != null">
                and Prev_DutyId = #{prevDutyid}
            </if>
            <if test="store != null and store != ''">
                and Store = #{store}
            </if>
            <if test="beforemonth != null">
                and BeforeMonth = #{beforemonth}
            </if>
            <if test="beforedepreciation != null">
                and BeforeDepreciation = #{beforedepreciation}
            </if>
            <if test="prevDepid != null">
                and Prev_DepId = #{prevDepid}
            </if>
            <if test="newplace != null and newplace != ''">
                and NewPlace = #{newplace}
            </if>
            <if test="mainassetno != null and mainassetno != ''">
                and MainAssetNo = #{mainassetno}
            </if>
            <if test="tax != null">
                and Tax = #{tax}
            </if>
            <if test="usefor != null and usefor != ''">
                and UseFor = #{usefor}
            </if>
        </where>
    </select>


</mapper>

