<?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.unis.base.server.dao.FacilityDao" >

    <!--设备报废-->
    <resultMap id="BaseResultMap" type="com.unis.base.common.vo.DsbbfxxVO">
        <result column="ID" property="id" jdbcType="DECIMAL" />
        <result column="SBBH" property="sbbh" jdbcType="VARCHAR" />
        <result column="SBYQMC" property="sbyqmc" jdbcType="VARCHAR" />
        <result column="KDDM" property="kddm" jdbcType="VARCHAR" />
        <result column="SBFL" property="sbfl" jdbcType="VARCHAR" />
        <result column="SBFLBH" property="sbflbh" jdbcType="VARCHAR" />
        <result column="SSFL" property="ssfl" jdbcType="VARCHAR" />
        <result column="CGSJ" property="cgsj" jdbcType="TIMESTAMP" />
        <result column="RYBH" property="rybh" jdbcType="VARCHAR" />
        <result column="RYXM" property="ryxm" jdbcType="VARCHAR" />
        <result column="SYNX" property="synx" jdbcType="VARCHAR" />
        <result column="SSBM" property="ssbm" jdbcType="VARCHAR" />
        <result column="SBXH" property="sbxh" jdbcType="VARCHAR" />
        <result column="STATUS" property="status" jdbcType="DECIMAL" />
        <result column="CREATOR" property="creator" jdbcType="VARCHAR" />
        <result column="CREATOR_CODE" property="creatorCode" jdbcType="VARCHAR" />
        <result column="CREATE_DATE" property="createDate" jdbcType="TIMESTAMP" />
        <result column="REFRESHER" property="refresher" jdbcType="VARCHAR" />
        <result column="REFRESHER_CODE" property="refresherCode" jdbcType="VARCHAR" />
        <result column="REFRESH_TIME" property="refreshTime" jdbcType="TIMESTAMP" />
        <result column="REMARK" property="remark" jdbcType="VARCHAR" />

        <result column="QYMC" property="qymc" jdbcType="VARCHAR" />
        <result column="FDDBR" property="fddbr" jdbcType="VARCHAR" />
        <result column="BGDH" property="bgdh" jdbcType="VARCHAR" />
        <result column="KDMC" property="kdmc" jdbcType="VARCHAR" />
        <result column="KDDZ" property="kddz" jdbcType="VARCHAR" />
        <result column="SBSL" property="sbsl" jdbcType="VARCHAR" />

    </resultMap>


    <!--设备领用-->
    <resultMap id="BaseReceiveMap" type="com.unis.base.common.vo.DsblyxxVO" >
        <result column="ID" property="id" jdbcType="DECIMAL" /><!--主键-->
        <result column="SBBH" property="sbbh" jdbcType="VARCHAR" /><!--设备编号-->
        <result column="SBYQMC" property="sbyqmc" jdbcType="VARCHAR" /><!--设备仪器名称-->
        <result column="KDDM" property="kddm" jdbcType="VARCHAR" /><!--所属库点编号-->
        <result column="SBFL" property="sbfl" jdbcType="VARCHAR" /><!--设备分类-->
        <result column="SBFLBH" property="sbflbh" jdbcType="VARCHAR" /><!--设备分类编码-->
        <result column="SSFL" property="ssfl" jdbcType="VARCHAR" /><!--设施分类，1：设备，2：设施，3：仪器-->
        <result column="SBGGXH" property="sbggxh" jdbcType="VARCHAR" />
        <result column="SBSQR" property="sbsqr" jdbcType="VARCHAR" /><!--设备申请人-->
        <result column="SBSQSJ" property="sbsqsj" jdbcType="TIMESTAMP" /><!--设备申请时间-->
        <result column="SBSQBM" property="sbsqbm" jdbcType="VARCHAR" /><!--设备申请部门-->
        <result column="SBSQSL" property="sbsqsl" jdbcType="VARCHAR" /><!--设备申请数量-->
        <result column="SBSQDQKC" property="sbsqdqkc" jdbcType="VARCHAR" /><!--设备申请当前库存-->
        <result column="SBDJ" property="sbdj" jdbcType="VARCHAR" /><!--sbdj-->
        <result column="SQDWBH" property="sqdwbh" jdbcType="VARCHAR" /><!--申请单位代码-->
        <result column="SQDWMC" property="sqdwmc" jdbcType="VARCHAR" /><!--申请单位名称-->
        <result column="SBSQSM" property="sbsqsm" jdbcType="VARCHAR" /><!--设备申请说明-->
        <result column="SBGHH" property="sbghh" jdbcType="VARCHAR" /><!--设备归还设备号-->
        <result column="SBGHSL" property="sbghsl" jdbcType="VARCHAR" /><!--设备归还数量-->
        <result column="SBGHR" property="sbghr" jdbcType="VARCHAR" /><!--设备归还人-->
        <result column="SBGHBM" property="sbghbm" jdbcType="VARCHAR" /><!--设备归还部门-->
        <result column="SBSYSC" property="sbsysc" jdbcType="VARCHAR" /><!--设备使用时长-->
        <result column="SBGHSJ" property="sbghsj" jdbcType="TIMESTAMP" /><!--设备归还时间-->
        <result column="SBGHJCR" property="sbghjcr" jdbcType="VARCHAR" /><!--设备归还检查人-->
        <result column="SBGHJLR" property="sbghjlr" jdbcType="VARCHAR" /><!--设备归还记录人-->
        <result column="SBGHSM" property="sbghsm" jdbcType="VARCHAR" /><!--设备归还说明-->
        <result column="SBXH" property="sbxh" jdbcType="VARCHAR" /><!--设备型号-->
        <result column="SBLYR" property="sblyr" jdbcType="VARCHAR" /><!--设备领用人-->
        <result column="SBLYSJ" property="sblysj" jdbcType="TIMESTAMP" /><!--设备领用时间-->

        <result column="STATUS" property="status" jdbcType="DECIMAL" />
        <result column="CREATOR" property="creator" jdbcType="VARCHAR" />
        <result column="CREATOR_CODE" property="creatorCode" jdbcType="VARCHAR" />
        <result column="CREATE_DATE" property="createDate" jdbcType="TIMESTAMP" />
        <result column="REFRESHER" property="refresher" jdbcType="VARCHAR" />
        <result column="REFRESHER_CODE" property="refresherCode" jdbcType="VARCHAR" />
        <result column="REFRESH_TIME" property="refreshTime" jdbcType="TIMESTAMP" />
        <result column="REMARK" property="remark" jdbcType="VARCHAR" />

        <result column="QYMC" property="qymc" jdbcType="VARCHAR" />
        <result column="FDDBR" property="fddbr" jdbcType="VARCHAR" />
        <result column="BGDH" property="bgdh" jdbcType="VARCHAR" />
        <result column="KDMC" property="kdmc" jdbcType="VARCHAR" />
        <result column="KDDZ" property="kddz" jdbcType="VARCHAR" />
        <result column="SBSL" property="sbsl" jdbcType="VARCHAR" />
    </resultMap>

    <!--设备入库-->
    <resultMap id="BaseStorageMap" type="com.unis.base.common.vo.DSbxxsjyVO" >
        <result column="SBBH" property="sbbh" jdbcType="VARCHAR" />
        <result column="SBYQMC" property="sbyqmc" jdbcType="VARCHAR" />
        <result column="KDDM" property="kddm" jdbcType="VARCHAR" />
        <result column="SBGGXH" property="sbggxh" jdbcType="VARCHAR" />
        <result column="SBMS" property="sbms" jdbcType="VARCHAR" />
        <result column="SBZT" property="sbzt" jdbcType="VARCHAR" />
        <result column="SBFL" property="sbfl" jdbcType="VARCHAR" />
        <result column="SCCJ" property="sccj" jdbcType="VARCHAR" />
        <result column="CGJG" property="cgjg" jdbcType="VARCHAR" />
        <result column="SBGLZ" property="sbglz" jdbcType="VARCHAR" />
        <result column="EDGZSJ" property="edgzsj" jdbcType="VARCHAR" />
        <result column="DCGZSJ" property="dcgzsj" jdbcType="VARCHAR" />
        <result column="CGSJ" property="cgsj" jdbcType="VARCHAR" />
        <result column="YJJDRQ" property="yjjdrq" jdbcType="VARCHAR" />
        <result column="LJGZSJ" property="ljgzsj" jdbcType="VARCHAR" />
        <result column="SYSM" property="sysm" jdbcType="VARCHAR" />
        <result column="YJBFRQ" property="yjbfrq" jdbcType="VARCHAR" />
        <result column="SBZP" property="sbzp" jdbcType="VARCHAR" />
        <result column="RYBH" property="rybh" jdbcType="VARCHAR" />
        <result column="RYXM" property="ryxm" jdbcType="VARCHAR" />
        <result column="DJR" property="djr" jdbcType="VARCHAR" />
        <result column="WHYY" property="whyy" jdbcType="VARCHAR" />
        <result column="WHSJ" property="whsj" jdbcType="VARCHAR" />
        <result column="SFBA" property="sfba" jdbcType="DECIMAL" />
        <result column="SZDWMC" property="szdwmc" jdbcType="VARCHAR" />
        <result column="SZDWDM" property="szdwdm" jdbcType="VARCHAR" />
        <result column="JSZT" property="jszt" jdbcType="VARCHAR" />
        <result column="SBSL" property="sbsl" jdbcType="DECIMAL" />
        <result column="JSCS" property="jscs" jdbcType="VARCHAR" />
        <result column="SBLX" property="sblx" jdbcType="DECIMAL" />
        <result column="MQZT" property="mqzt" jdbcType="DECIMAL" />
        <result column="SFZC" property="sfzc" jdbcType="DECIMAL" />
        <result column="CCBM" property="ccbm" jdbcType="VARCHAR" />
        <result column="SBBM" property="sbbm" jdbcType="VARCHAR" />
        <result column="QYRQ" property="qyrq" jdbcType="DATE" />
        <result column="SSFL" property="ssfl" jdbcType="DECIMAL" />
        <result column="JG_ID" property="jgId" jdbcType="VARCHAR" />
        <result column="FZD" property="fzd" jdbcType="VARCHAR" />
        <result column="SBDWMC" property="sbdwmc" jdbcType="VARCHAR" />
        <result column="ZCBH" property="zcbh" jdbcType="VARCHAR" />
        <result column="SCRQ" property="scrq" jdbcType="DATE" />
        <result column="RKRQ" property="rkrq" jdbcType="DATE" />
        <result column="PZR" property="pzr" jdbcType="VARCHAR" />
        <result column="CGR" property="cgr" jdbcType="VARCHAR" />
        <result column="WXDH" property="wxdh" jdbcType="VARCHAR" />
        <result column="BXQX" property="bxqx" jdbcType="VARCHAR" />
        <result column="SBAZR" property="sbazr" jdbcType="VARCHAR"/>

        <result column="STATUS" property="status" jdbcType="VARCHAR" />
        <result column="CREATOR" property="creator" jdbcType="VARCHAR" />
        <result column="CREATOR_CODE" property="creatorCode" jdbcType="VARCHAR" />
        <result column="CREATE_DATE" property="createDate" jdbcType="TIMESTAMP" />
        <result column="REFRESHER" property="refresher" jdbcType="VARCHAR" />
        <result column="REFRESHER_CODE" property="refresherCode" jdbcType="VARCHAR" />
        <result column="REFRESH_TIME" property="refreshTime" jdbcType="TIMESTAMP" />
        <result column="REMARK" property="remark" jdbcType="VARCHAR" />

        <result column="QYMC" property="qymc" jdbcType="VARCHAR" />
        <result column="FDDBR" property="fddbr" jdbcType="VARCHAR" />
        <result column="BGDH" property="bgdh" jdbcType="VARCHAR" />
        <result column="KDMC" property="kdmc" jdbcType="VARCHAR" />
        <result column="KDDZ" property="kddz" jdbcType="VARCHAR" />
    </resultMap>


    <!--设备维护-->
    <resultMap id="BaseVindicateMap" type="com.unis.base.common.vo.DsbwhxxVO" >
        <result column="ID" property="id" jdbcType="DECIMAL" /><!--主键-->
        <result column="SBBH" property="sbbh" jdbcType="VARCHAR" /><!--设备编号-->
        <result column="SBYQMC" property="sbyqmc" jdbcType="VARCHAR" /><!--设备仪器名称-->
        <result column="KDDM" property="kddm" jdbcType="VARCHAR" /><!--所属库点编号-->
        <result column="SBFL" property="sbfl" jdbcType="VARCHAR" /><!--设备分类-->
        <result column="SBFLBH" property="sbflbh" jdbcType="VARCHAR" /><!--设备分类编码-->
        <result column="SSFL" property="ssfl" jdbcType="VARCHAR" /><!--设施分类，1：设备，2：设施，3：仪器-->
        <result column="WHFS" property="whfs" jdbcType="VARCHAR" /><!--维护方式-->
        <result column="WHFY" property="whfy" jdbcType="VARCHAR" /><!--维护费用-->
        <result column="WHRY" property="whry" jdbcType="TIMESTAMP" /><!--维护人员-->
        <result column="WHSM" property="whsm" jdbcType="VARCHAR" /><!--维护说明-->
        <result column="WHRLXFS" property="whrlxfs" jdbcType="VARCHAR" /><!--维护人联系方式-->
        <result column="WHDW" property="whdw" jdbcType="VARCHAR" /><!--维护单位-->
        <result column="SBLX" property="sblx" jdbcType="VARCHAR" />

        <result column="STATUS" property="status" jdbcType="DECIMAL" />
        <result column="CREATOR" property="creator" jdbcType="VARCHAR" />
        <result column="CREATOR_CODE" property="creatorCode" jdbcType="VARCHAR" />
        <result column="CREATE_DATE" property="createDate" jdbcType="TIMESTAMP" />
        <result column="REFRESHER" property="refresher" jdbcType="VARCHAR" />
        <result column="REFRESHER_CODE" property="refresherCode" jdbcType="VARCHAR" />
        <result column="REFRESH_TIME" property="refreshTime" jdbcType="TIMESTAMP" />
        <result column="REMARK" property="remark" jdbcType="VARCHAR" />

        <result column="QYMC" property="qymc" jdbcType="VARCHAR" />
        <result column="FDDBR" property="fddbr" jdbcType="VARCHAR" />
        <result column="BGDH" property="bgdh" jdbcType="VARCHAR" />
        <result column="KDMC" property="kdmc" jdbcType="VARCHAR" />
        <result column="KDDZ" property="kddz" jdbcType="VARCHAR" />
        <result column="SBSL" property="sbsl" jdbcType="VARCHAR" />
    </resultMap>

    <!--设备维修-->
    <resultMap id="BaseMaintainMap" type="com.unis.base.common.vo.DSbwxxxVO" >
        <result column="ID" property="id" jdbcType="DECIMAL" /><!-- 主键 -->
        <result column="SBBH" property="sbbh" jdbcType="VARCHAR" /><!-- 设备编号 -->
        <result column="SBYQMC" property="sbyqmc" jdbcType="VARCHAR" /><!-- 设备仪器名称 -->
        <result column="KDDM" property="kddm" jdbcType="VARCHAR" /><!-- 库点代码 -->
        <result column="SBFL" property="sbfl" jdbcType="VARCHAR" /><!-- 设备分类 -->
        <result column="SBFLBH" property="sbflbh" jdbcType="VARCHAR" /><!-- 设备分类编号 -->
        <result column="SSFL" property="ssfl" jdbcType="VARCHAR" /><!-- 设施分类，1：设备，2：设施，3：仪器 -->
        <result column="SBGZ" property="sbgz" jdbcType="VARCHAR" /><!-- 设备故障 -->
        <result column="SXR" property="sxr" jdbcType="VARCHAR" /><!-- 送修人 -->
        <result column="WXDW" property="wxdw" jdbcType="VARCHAR" /><!-- 维修单位 -->
        <result column="WXFY" property="wxfy" jdbcType="VARCHAR" /><!-- 维修费用 -->
        <result column="WXSM" property="wxsm" jdbcType="VARCHAR" /><!-- 维修说明 -->
        <result column="WHRLXFS" property="whrlxfs" jdbcType="VARCHAR" /><!-- 维修人联系方式 -->
        <result column="QY" property="qy" jdbcType="VARCHAR" /><!-- 区域 -->
        <result column="SFBX" property="sfbx" jdbcType="VARCHAR" /><!-- 是否保修 -->
        <result column="WXSJ" property="wxsj" jdbcType="TIMESTAMP" /><!-- 维修时间 -->
        <result column="SBLX" property="sblx" jdbcType="VARCHAR" /><!-- 设备类型 -->
        <result column="WXFS" property="wxfs" jdbcType="VARCHAR" /><!-- 维修方式 -->

        <result column="FZR" property="fzr" jdbcType="VARCHAR" /><!-- 负责人 -->
        <result column="STATUS" property="status" jdbcType="DECIMAL" /><!-- 状态默认为1 -->
        <result column="CREATOR" property="creator" jdbcType="VARCHAR" /><!-- 创建人 -->
        <result column="CREATOR_CODE" property="creatorCode" jdbcType="VARCHAR" /><!-- 创建人编号 -->
        <result column="CREATE_DATE" property="createDate" jdbcType="TIMESTAMP" /><!-- 创建时间 -->
        <result column="REFRESH_TIME" property="refreshTime" jdbcType="TIMESTAMP" /><!-- 刷新时间 -->
        <result column="REFRESHER" property="refresher" jdbcType="VARCHAR" /><!-- 刷新人 -->
        <result column="REFRESHER_CODE" property="refresherCode" jdbcType="VARCHAR" /><!-- 刷新人编号 -->
        <result column="REMARK" property="remark" jdbcType="VARCHAR" /><!-- 备注 -->

        <result column="QYMC" property="qymc" jdbcType="VARCHAR" />
        <result column="FDDBR" property="fddbr" jdbcType="VARCHAR" />
        <result column="BGDH" property="bgdh" jdbcType="VARCHAR" />
        <result column="KDMC" property="kdmc" jdbcType="VARCHAR" />
        <result column="KDDZ" property="kddz" jdbcType="VARCHAR" />
        <result column="SBSL" property="sbsl" jdbcType="VARCHAR" />
    </resultMap>

    <!--设备申购-->
    <resultMap id="BaseSubscribeMap" type="com.unis.base.common.vo.DSbsgxxVO" >
        <result column="ID" property="id" jdbcType="DECIMAL" /><!-- 主键 -->
        <result column="SBBH" property="sbbh" jdbcType="VARCHAR" /><!-- 设备编号 -->
        <result column="SBYQMC" property="sbyqmc" jdbcType="VARCHAR" /><!-- 设备仪器名称 -->
        <result column="KDDM" property="kddm" jdbcType="VARCHAR" /><!-- 库点代码 -->
        <result column="SBFL" property="sbfl" jdbcType="VARCHAR" /><!-- 设备分类 -->
        <result column="SBFLBH" property="sbflbh" jdbcType="VARCHAR" /><!-- 设备分类编号 -->
        <result column="SSFL" property="ssfl" jdbcType="VARCHAR" /><!-- 设施分类，1：设备，2：设施，3：仪器 -->
        <result column="SBXH" property="sbxh" jdbcType="VARCHAR" /><!-- 设备型号 -->
        <result column="SBSQR" property="sbsqr" jdbcType="VARCHAR" /><!-- 设备申请人-->
        <result column="SBSQBM" property="sbsqbm" jdbcType="VARCHAR" /><!-- 设备申请部门 -->
        <result column="SQDWBH" property="sqdwbh" jdbcType="VARCHAR" /><!-- 设备申请单位代码 -->
        <result column="SQDWMC" property="sqdwmc" jdbcType="VARCHAR" /><!-- 设备申请单位名称-->
        <result column="SBDJ" property="sbdj" jdbcType="VARCHAR" /><!-- 单价-->
        <result column="SBSL" property="sbsl" jdbcType="VARCHAR" /><!-- 数量-->
        <result column="SBZJ" property="sbzj" jdbcType="VARCHAR" /><!-- 总价 -->
        <result column="SBSQSJ" property="sbsqsj" jdbcType="TIMESTAMP" /><!-- 申请时间 -->

        <result column="STATUS" property="status" jdbcType="DECIMAL" /><!-- 状态默认为1 -->
        <result column="CREATOR" property="creator" jdbcType="VARCHAR" /><!-- 创建人 -->
        <result column="CREATOR_CODE" property="creatorCode" jdbcType="VARCHAR" /><!-- 创建人编号 -->
        <result column="CREATE_DATE" property="createDate" jdbcType="TIMESTAMP" /><!-- 创建时间 -->
        <result column="REFRESH_TIME" property="refreshTime" jdbcType="TIMESTAMP" /><!-- 刷新时间 -->
        <result column="REFRESHER" property="refresher" jdbcType="VARCHAR" /><!-- 刷新人 -->
        <result column="REFRESHER_CODE" property="refresherCode" jdbcType="VARCHAR" /><!-- 刷新人编号 -->
        <result column="REMARK" property="remark" jdbcType="VARCHAR" /><!-- 备注 -->

        <result column="QYMC" property="qymc" jdbcType="VARCHAR" />
        <result column="FDDBR" property="fddbr" jdbcType="VARCHAR" />
        <result column="BGDH" property="bgdh" jdbcType="VARCHAR" />
        <result column="KDMC" property="kdmc" jdbcType="VARCHAR" />
        <result column="KDDZ" property="kddz" jdbcType="VARCHAR" />


    </resultMap>

    <!--统计分析-->
    <resultMap id="BaseSbtjMap" type="com.unis.base.common.vo.DSbtjfxVO">
        <result column="sbbh" property="sbbh" jdbcType="VARCHAR" />
        <result column="sbyqmc" property="sbyqmc" jdbcType="VARCHAR" />
        <result column="kddm" property="kddm" jdbcType="VARCHAR" />
        <result column="kdmc" property="kdmc" jdbcType="VARCHAR" />
        <result column="sbfl" property="sbfl" jdbcType="VARCHAR" />
        <result column="qymc" property="qymc" jdbcType="VARCHAR" />
        <result column="qyxz" property="qyxz" jdbcType="VARCHAR" />
        <result column="rksl" property="rksl" jdbcType="VARCHAR" />
        <result column="lysl" property="lysl" jdbcType="VARCHAR" />
        <result column="wxsl" property="wxsl" jdbcType="VARCHAR" />
        <result column="bfsl" property="bfsl" jdbcType="VARCHAR" />
        <result column="sgsl" property="sgsl" jdbcType="VARCHAR" />
        <result column="tyshxydm" property="tyshxydm" jdbcType="VARCHAR" />
    </resultMap>



    <!--设备申购-->
    <sql id="Subscribe_List">
        sg.SBBH,sg.SBYQMC,sg.KDDM,sg.SBFL,sg.SBFLBH,sg.SSFL,sg.SBXH,sg.SBSQR,sg.SBSQBM,sg.SQDWBH,sg.SQDWMC,sg.SBDJ,sg.SBSL,sg.SBZJ,sg.SBSQSJ,sg.REMARK
    </sql>

    <!--设备维修-->
    <sql id="Maintain_List">
        wx.SBBH, wx.SBYQMC, wx.KDDM, wx.SBFL, wx.SBFLBH, wx.SSFL, wx.SBGZ, wx.SXR, wx.WXDW, wx.WXFY, wx.WXSM, wx.WHRLXFS, wx.QY, wx.SFBX,
        wx.WXSJ, wx.SBLX, wx.WXFS, wx.FZR, wx.REMARK
    </sql>

    <!--设备维护-->
    <sql id="Vindicate_List">
        wh.SBBH,wh.SBYQMC,wh.KDDM,wh.SBFL,wh.SBFLBH,wh.SSFL,wh.WHFS,wh.WHFY,wh.WHRY,wh.WHSM,wh.WHRLXFS,wh.REMARK,wh.WHDW,wh.SBLX
    </sql>

    <!--设备领用-->
    <sql id="Receive_List">
        ly.SBBH,ly.SBYQMC,ly.KDDM,ly.SBFL,ly.SBFLBH,ly.SSFL,ly.SBGGXH,ly.SBSQR,ly.SBSQSJ,ly.SBSQBM,ly.SBSQSL,ly.SBSQDQKC,ly.SBDJ,
        ly.SQDWBH,ly.SQDWMC,ly.SBSQSM,ly.REMARK,
        ly.SBGHH,ly.SBGHSL,ly.SBGHR,ly.SBGHBM,ly.SBSYSC,ly.SBGHSJ,ly.SBGHJCR,ly.SBGHSM,ly.SBXH,ly.SBLYR,ly.SBLYSJ,ly.SBGHJLR
    </sql>

    <!--设备报废-->
    <sql id="Scrap_List">
        bf.SBBH,bf.SSFL,bf.KDDM,bf.SBFL,bf.SBFLBH,bf.SBYQMC,bf.SSBM,bf.RYBH,bf.RYXM,bf.CGSJ,bf.SYNX,bf.REMARK,bf.SBXH
    </sql>

    <!--设备入库-->
    <sql id="Storage_List">
        rk.SBBH,rk.SBYQMC,rk.KDDM,rk.SBGGXH,rk.SBMS,rk.SBZT,rk.SBFL,rk.SCCJ,rk.CGJG,rk.SBGLZ,rk.EDGZSJ,rk.DCGZSJ,rk.CGSJ,
        rk.YJJDRQ,rk.LJGZSJ,rk.SYSM,rk.YJBFRQ,rk.SBZP,rk.RYBH,rk.RYXM,rk.DJR,rk.WHYY,rk.WHSJ,rk.SFBA,rk.SZDWMC,rk.SZDWDM,
        rk.JSZT,rk.SBSL,rk.JSCS,rk.SBLX,rk.MQZT,rk.SFZC,rk.CCBM,rk.SBBM,rk.QYRQ,rk.SSFL,rk.JG_ID,
        rk.FZD,rk.SBDWMC,rk.ZCBH,rk.SCRQ,rk.RKRQ,rk.REMARK,rk.PZR,rk.CGR,rk.WXDH,rk.BXQX,rk.SBAZR
    </sql>

    <!--设备报废-->
    <select id="findFacility" resultMap="BaseResultMap"  >
        SELECT  qy.QYMC as qymc ,
                kd.KDMC as kdmc ,
                bf.SBFL as sbfl ,
                bf.SBYQMC as sbyqmc ,
          count(1) as sbsl
          FROM D_SBBFXX bf,D_KDXXSJY kd,TZ_SLQY qy
        <where>
            bf.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM AND
            bf.STATUS = 1
            <!--设施分类-->
            <if test='vo.sbfl != null and vo.sbfl != ""' >
                and	bf.SBFL LIKE concat(CONCAT('%',#{vo.sbfl,jdbcType=VARCHAR}) ,'%')
            </if>
            <!-- 设备名称 -->
            <if test='vo.sbyqmc != null and vo.sbyqmc != ""' >
                and	bf.SBYQMC LIKE concat(CONCAT('%',#{vo.sbyqmc,jdbcType=VARCHAR}) ,'%')
            </if>
            <!--企业名称-->
            <if test='vo.qymc != null and vo.qymc != ""' >
                and	qy.QYMC LIKE concat(CONCAT('%',#{vo.qymc,jdbcType=VARCHAR}) ,'%')
            </if>
            <!--企业性质-->
            <if test='vo.qyxz != null and vo.qyxz != ""' >
                and	qy.QYXZ LIKE concat(CONCAT('%',#{vo.qyxz,jdbcType=VARCHAR}) ,'%')
            </if>
            AND bf.SSFL = #{lx,jdbcType=INTEGER}
            GROUP BY qy.QYMC , kd.KDMC , bf.SBYQMC , bf.SBFL
        </where>
    </select>
    
    <!--设备报废记录详情-->
    <select id="findFacilityById" resultMap="BaseResultMap" >
        SELECT
        <include refid="Scrap_List" />,kd.KDMC as kdmc,kd.KDDZ as kddz,qy.QYMC as qymc,qy.FDDBR as fddbr,qy.BGDH as bgdh
        FROM
        D_SBBFXX bf,D_KDXXSJY kd,TZ_SLQY qy
        <where>
            bf.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM
            AND qy.QYMC = #{vo.qymc,jdbcType=VARCHAR}
            AND kd.KDMC = #{vo.kdmc,jdbcType=VARCHAR}
            AND bf.SBFL = #{vo.sbfl,jdbcType=VARCHAR}
            AND bf.SBYQMC = #{vo.sbyqmc,jdbcType=VARCHAR}
        </where>
    </select>

    <!--设备维护-->
    <select id="findVindicate" resultMap="BaseVindicateMap">
        SELECT  qy.QYMC as qymc ,
                kd.KDMC as kdmc ,
                wh.SBFL as sbfl ,
                wh.SBYQMC as sbyqmc ,
        count(1) as sbsl
        FROM D_SBWHXX wh,D_KDXXSJY kd,TZ_SLQY qy
        <where>
            wh.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM AND
            wh.STATUS = 1
            <!--设施分类-->
            <if test='vo.sbfl != null and vo.sbfl != ""' >
                and	wh.SBFL LIKE concat(CONCAT('%',#{vo.sbfl,jdbcType=VARCHAR}) ,'%')
            </if>
            <!-- 设备名称 -->
            <if test='vo.sbyqmc != null and vo.sbyqmc != ""' >
                and	wh.SBYQMC LIKE concat(CONCAT('%',#{vo.sbyqmc,jdbcType=VARCHAR}) ,'%')
            </if>
            <!--企业名称-->
            <if test='vo.qymc != null and vo.qymc != ""' >
                and	qy.QYMC LIKE concat(CONCAT('%',#{vo.qymc,jdbcType=VARCHAR}) ,'%')
            </if>
            <!--企业性质-->
            <if test='vo.qyxz != null and vo.qyxz != ""' >
                and	qy.QYXZ LIKE concat(CONCAT('%',#{vo.qyxz,jdbcType=VARCHAR}) ,'%')
            </if>
            AND wh.SSFL = #{lx,jdbcType=INTEGER}
            GROUP BY qy.QYMC , kd.KDMC , wh.SBYQMC , wh.SBFL
        </where>
    </select>

    <!--设备维护详情-->
    <select id="findVindicateById" resultMap="BaseVindicateMap" >
        SELECT
        <include refid="Vindicate_List" />,kd.KDMC,kd.KDDZ,qy.QYMC,qy.FDDBR,qy.BGDH
        FROM
        D_SBWHXX wh,D_KDXXSJY kd,TZ_SLQY qy
        <where>
            wh.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM
            AND qy.QYMC = #{vo.qymc,jdbcType=VARCHAR}
            AND kd.KDMC = #{vo.kdmc,jdbcType=VARCHAR}
            AND wh.SBFL = #{vo.sbfl,jdbcType=VARCHAR}
            AND wh.SBYQMC = #{vo.sbyqmc,jdbcType=VARCHAR}
        </where>
    </select>

    <!--设备维修-->
    <select id="findMaintain" resultMap="BaseMaintainMap">
        SELECT  qy.QYMC as qymc ,
                kd.KDMC as kdmc ,
                wx.SBFL as sbfl ,
                wx.SBYQMC as sbyqmc ,
                count(1) as sbsl
        FROM D_SBWXXX wx,D_KDXXSJY kd,TZ_SLQY qy
        <where>
            wx.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM AND
            wx.STATUS = 1
            <!--设施分类-->
            <if test='vo.sbfl != null and vo.sbfl != ""' >
                and	wx.SBFL LIKE concat(CONCAT('%',#{vo.sbfl,jdbcType=VARCHAR}) ,'%')
            </if>
            <!-- 设备名称 -->
            <if test='vo.sbyqmc != null and vo.sbyqmc != ""' >
                and	wx.SBYQMC LIKE concat(CONCAT('%',#{vo.sbyqmc,jdbcType=VARCHAR}) ,'%')
            </if>
            <!--企业名称-->
            <if test='vo.qymc != null and vo.qymc != ""' >
                and	qy.QYMC LIKE concat(CONCAT('%',#{vo.qymc,jdbcType=VARCHAR}) ,'%')
            </if>
            <!--企业性质-->
            <if test='vo.qyxz != null and vo.qyxz != ""' >
                and	qy.QYXZ LIKE concat(CONCAT('%',#{vo.qyxz,jdbcType=VARCHAR}) ,'%')
            </if>
            AND wx.SSFL = #{lx,jdbcType=INTEGER}
            GROUP BY qy.QYMC , kd.KDMC , wx.SBYQMC , wx.SBFL
        </where>
    </select>

    <!--设备维修详情-->
    <select id="findMaintainById" resultMap="BaseMaintainMap" >
        SELECT
        <include refid="Maintain_List" />,kd.KDMC,kd.KDDZ,qy.QYMC,qy.FDDBR,qy.BGDH
        FROM
        D_SBWXXX wx,D_KDXXSJY kd,TZ_SLQY qy
        <where>
            wx.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM
            AND qy.QYMC = #{vo.qymc,jdbcType=VARCHAR}
            AND kd.KDMC = #{vo.kdmc,jdbcType=VARCHAR}
            AND wx.SBFL = #{vo.sbfl,jdbcType=VARCHAR}
            AND wx.SBYQMC = #{vo.sbyqmc,jdbcType=VARCHAR}
        </where>
    </select>


    <!--设备领用-->
    <select id="findReceive" resultMap="BaseReceiveMap" >
        SELECT  qy.QYMC as qymc ,
                kd.KDMC as kdmc ,
                ly.SBFL as sbfl ,
                ly.SBYQMC as sbyqmc ,
                count(1) as sbsl
        FROM D_SBLYXX ly,D_KDXXSJY kd,TZ_SLQY qy
        <where>
            ly.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM AND
            ly.STATUS = 1
            <!--设施分类-->
            <if test='vo.sbfl != null and vo.sbfl != ""' >
                and	ly.SBFL LIKE concat(CONCAT('%',#{vo.sbfl,jdbcType=VARCHAR}) ,'%')
            </if>
            <!-- 设备名称 -->
            <if test='vo.sbyqmc != null and vo.sbyqmc != ""' >
                and	ly.SBYQMC LIKE concat(CONCAT('%',#{vo.sbyqmc,jdbcType=VARCHAR}) ,'%')
            </if>
            <!--企业名称-->
            <if test='vo.qymc != null and vo.qymc != ""' >
                and	qy.QYMC LIKE concat(CONCAT('%',#{vo.qymc,jdbcType=VARCHAR}) ,'%')
            </if>
            <!--企业性质-->
            <if test='vo.qyxz != null and vo.qyxz != ""' >
                and	qy.QYXZ LIKE concat(CONCAT('%',#{vo.qyxz,jdbcType=VARCHAR}) ,'%')
            </if>
            AND ly.SSFL = #{lx,jdbcType=INTEGER}
            GROUP BY qy.QYMC , kd.KDMC , ly.SBYQMC , ly.SBFL
        </where>
    </select>

    <!--设备领用详情-->
    <select id="findReceiveById" resultMap="BaseReceiveMap" >
        SELECT
        <include refid="Receive_List" />,kd.KDMC,kd.KDDZ,qy.QYMC,qy.FDDBR,qy.BGDH
        FROM
        D_SBLYXX ly,D_KDXXSJY kd,TZ_SLQY qy
        <where>
            ly.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM AND ly.SBSQR is not null
            AND qy.QYMC = #{vo.qymc,jdbcType=VARCHAR}
            AND kd.KDMC = #{vo.kdmc,jdbcType=VARCHAR}
            AND ly.SBFL = #{vo.sbfl,jdbcType=VARCHAR}
            AND ly.SBYQMC = #{vo.sbyqmc,jdbcType=VARCHAR}
        </where>
    </select>

    <!--设备归还-->
    <select id="findGuiHuan" resultMap="BaseReceiveMap" >
        SELECT
        <include refid="Receive_List" />,kd.KDMC,kd.KDDZ,qy.QYMC,qy.FDDBR,qy.BGDH
        FROM
        D_SBLYXX ly,D_KDXXSJY kd,TZ_SLQY qy
        <where>
            ly.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM AND ly.SBGHR is not null
            AND qy.QYMC = #{vo.qymc,jdbcType=VARCHAR}
            AND kd.KDMC = #{vo.kdmc,jdbcType=VARCHAR}
            AND ly.SBFL = #{vo.sbfl,jdbcType=VARCHAR}
            AND ly.SBYQMC = #{vo.sbyqmc,jdbcType=VARCHAR}
        </where>
    </select>

    <!--设备入库-->
    <select id="findStorage" resultMap="BaseStorageMap" >
        SELECT  qy.QYMC as qymc ,
                kd.KDMC as kdmc ,
                rk.SBFL as sbfl ,
                rk.SBYQMC as sbyqmc ,
                sum(rk.SBSL) as sbsl
        FROM D_SBXXSJY rk,D_KDXXSJY kd,TZ_SLQY qy
        <where>
            rk.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM AND
            rk.STATUS = 1
            <!--设施分类-->
            <if test='vo.sbfl != null and vo.sbfl != ""' >
                and	rk.SBFL LIKE concat(CONCAT('%',#{vo.sbfl,jdbcType=VARCHAR}) ,'%')
            </if>
            <!-- 设备名称 -->
            <if test='vo.sbyqmc != null and vo.sbyqmc != ""' >
                and	rk.SBYQMC LIKE concat(CONCAT('%',#{vo.sbyqmc,jdbcType=VARCHAR}) ,'%')
            </if>
            <!--企业名称-->
            <if test='vo.qymc != null and vo.qymc != ""' >
                and	qy.QYMC LIKE concat(CONCAT('%',#{vo.qymc,jdbcType=VARCHAR}) ,'%')
            </if>
            <!--库点名称-->
            <if test='vo.kdmc != null and vo.kdmc != ""' >
                and	kd.KDMC LIKE concat(CONCAT('%',#{vo.kdmc,jdbcType=VARCHAR}) ,'%')
            </if>
            AND rk.SSFL = #{lx,jdbcType=INTEGER}
            GROUP BY qy.QYMC , kd.KDMC , rk.SBYQMC ,rk.SBFL
        </where>
    </select>

    <!--设备入库详情-->
    <select id="findStorageById" resultMap="BaseStorageMap" >
        SELECT
        <include refid="Storage_List" />,kd.KDMC,kd.KDDZ,qy.QYMC,qy.FDDBR,qy.BGDH
        FROM
        D_SBXXSJY rk,D_KDXXSJY kd,TZ_SLQY qy
        <where>
            rk.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM
            AND qy.QYMC = #{vo.qymc,jdbcType=VARCHAR}
            AND kd.KDMC = #{vo.kdmc,jdbcType=VARCHAR}
            AND rk.SBFL = #{vo.sbfl,jdbcType=VARCHAR}
            AND rk.SBYQMC = #{vo.sbyqmc,jdbcType=VARCHAR}
        </where>
    </select>


    <!--设备申购-->
    <select id="findPurchase" resultMap="BaseSubscribeMap" >
        SELECT  qy.QYMC as qymc ,
                kd.KDMC as kdmc ,
                sg.SBFL as sbfl ,
                sg.SBYQMC as sbyqmc ,
                sum(sg.sbsl) as sbsl
        FROM D_SBSGXX sg,D_KDXXSJY kd,TZ_SLQY qy
        <where>
            sg.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM AND
            sg.STATUS = 1
            <!--设施分类-->
            <if test='vo.sbfl != null and vo.sbfl != ""' >
                and	sg.SBFL LIKE concat(CONCAT('%',#{vo.sbfl,jdbcType=VARCHAR}) ,'%')
            </if>
            <!-- 设备名称 -->
            <if test='vo.sbyqmc != null and vo.sbyqmc != ""' >
                and	sg.SBYQMC LIKE concat(CONCAT('%',#{vo.sbyqmc,jdbcType=VARCHAR}) ,'%')
            </if>
            <!--企业名称-->
            <if test='vo.qymc != null and vo.qymc != ""' >
                and	qy.QYMC LIKE concat(CONCAT('%',#{vo.qymc,jdbcType=VARCHAR}) ,'%')
            </if>
            <!--企业性质-->
            <if test='vo.qyxz != null and vo.qyxz != ""' >
                and	qy.QYXZ LIKE concat(CONCAT('%',#{vo.qyxz,jdbcType=VARCHAR}) ,'%')
            </if>
            AND sg.SSFL = #{lx,jdbcType=INTEGER}
            GROUP BY qy.QYMC , kd.KDMC , sg.SBYQMC , sg.SBFL
        </where>
    </select>

    <!--设备申购详情-->
    <select id="findPurchaseById" resultMap="BaseSubscribeMap" >
        SELECT
        <include refid="Subscribe_List" />,kd.KDMC,kd.KDDZ,qy.QYMC,qy.FDDBR,qy.BGDH
        FROM
        D_SBSGXX sg,D_KDXXSJY kd,TZ_SLQY qy
        <where>
            sg.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM
            AND qy.QYMC = #{vo.qymc,jdbcType=VARCHAR}
            AND kd.KDMC = #{vo.kdmc,jdbcType=VARCHAR}
            AND sg.SBFL = #{vo.sbfl,jdbcType=VARCHAR}
            AND sg.SBYQMC = #{vo.sbyqmc,jdbcType=VARCHAR}
        </where>
    </select>


    <!--机械设备统计-->
    <select id="findSbtjfx" resultMap="BaseSbtjMap" >
        <if test="lx == 1">
            SELECT  sb.tyshxydm as tyshxydm,
            sb.kdmc as kdmc ,
            MAX(sb.KDDM) as kddm,
            sb.sbyqmc as sbyqmc ,
            sb.sbfl as sbfl,
            SUM(sb.sbsl) as rksl,
            COUNT(wx.SBYQMC) as wxsl,
            COUNT(bf.SBYQMC) as bfsl
            FROM
            (SELECT  qy.TYSHXYDM as tyshxydm ,
            kd.KDMC as kdmc ,
            rk.KDDM as kddm,
            rk.SBFL as sbfl ,
            rk.SBYQMC as sbyqmc ,
            rk.SBSL as sbsl
            FROM D_SBXXSJY rk,D_KDXXSJY kd,TZ_SLQY qy  where
            rk.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM AND rk.SSFL=1 AND  rk.STATUS = 1
            <where>
                <!--设施分类-->
                <if test='vo.sbfl != null and vo.sbfl != ""' >
                    and	rk.SBFL LIKE concat(CONCAT('%',#{vo.sbfl,jdbcType=VARCHAR}) ,'%')
                </if>
                <!-- 设备名称 -->
                <if test='vo.sbyqmc != null and vo.sbyqmc != ""' >
                    and	rk.SBYQMC LIKE concat(CONCAT('%',#{vo.sbyqmc,jdbcType=VARCHAR}) ,'%')
                </if>
                <!--企业名称-->
                <if test='vo.qymc != null and vo.qymc != ""' >
                    and	qy.QYMC LIKE concat(CONCAT('%',#{vo.qymc,jdbcType=VARCHAR}) ,'%')
                </if>
                <!--库点名称-->
                <if test='vo.kdmc != null and vo.kdmc != ""' >
                    and	kd.KDMC LIKE concat(CONCAT('%',#{vo.kdmc,jdbcType=VARCHAR}) ,'%')
                </if>
            </where>
            ) sb
            LEFT JOIN D_SBWXXX wx ON sb.SBYQMC=wx.SBYQMC
            LEFT JOIN D_SBBFXX bf ON sb.SBYQMC=bf.SBYQMC
            GROUP BY  sb.TYSHXYDM , sb.KDMC , sb.SBYQMC , sb.SBFL
        </if>
        <if test="lx == 2">
            SELECT
            sb.TYSHXYDM as tyshxydm,
            sb.KDMC as kdmc ,
            MAX(sb.KDDM) as kddm,
            sb.SBYQMC as sbyqmc ,
            sb.SBFL as sbfl,
            SUM(rk.SBSL) as rksl,
            SUM(sb.SBSL) as sgsl
            FROM  (SELECT  qy.TYSHXYDM as tyshxydm ,
            kd.KDMC as kdmc ,
            rk.KDDM as kddm,
            rk.SBFL as sbfl ,
            rk.SBYQMC as sbyqmc ,
            rk.SBSL as sbsl
            FROM D_SBSGXX rk,D_KDXXSJY kd,TZ_SLQY qy  where
            rk.KDDM=kd.KDDM AND kd.TYSHXYDM=qy.TYSHXYDM AND rk.SSFL=3 AND  rk.STATUS = 1
            <where>
                <!--企业名称-->
                <if test='vo.qymc != null and vo.qymc != ""' >
                    and	qy.QYMC LIKE concat(CONCAT('%',#{vo.qymc,jdbcType=VARCHAR}) ,'%')
                </if>
                <!--库点名称-->
                <if test='vo.kdmc != null and vo.kdmc != ""' >
                    and	kd.KDMC LIKE concat(CONCAT('%',#{vo.kdmc,jdbcType=VARCHAR}) ,'%')
                </if>
                <!--设施分类-->
                <if test='vo.sbfl != null and vo.sbfl != ""' >
                    and	rk.SBFL LIKE concat(CONCAT('%',#{vo.sbfl,jdbcType=VARCHAR}) ,'%')
                </if>
                <!-- 设备名称 -->
                <if test='vo.sbyqmc != null and vo.sbyqmc != ""' >
                    and	rk.SBYQMC LIKE concat(CONCAT('%',#{vo.sbyqmc,jdbcType=VARCHAR}) ,'%')
                </if>
            </where>
            ) sb
            LEFT JOIN D_SBXXSJY rk ON rk.SBYQMC=sb.SBYQMC
            GROUP BY  sb.TYSHXYDM , sb.KDMC , sb.SBYQMC , sb.SBFL
        </if>

    </select>


    <select id="findQymc" resultType="java.lang.String">
        SELECT QYMC FROM TZ_SLQY WHERE TYSHXYDM = #{tyshxydm}
    </select>

    <!--<select id="findKddm" resultType="java.lang.String">
        SELECT KDDM FROM D_KDXXSJY WHERE KDMC=#{kdmc}
    </select>-->

    <select id="findSblysl" resultType="java.lang.Integer">
        <if test="lx == 1">
            SELECT (lyc.lysl-lyc.ghsl) as lycount
            FROM (SELECT SUM(ly.SBSQSL) as lysl ,ifnull(SUM( ly.SBGHSL),0) as ghsl,ly.SBYQMC as sbyqmc,ly.KDDM as kddm,ly.SBFL as sbfl FROM D_SBLYXX ly
            WHERE
            ly.SSFL = 1 AND ly.SBYQMC=#{sbyqmc} AND
            ly.KDDM=#{kddm} AND
            ly.SBFL=#{sbfl}
            GROUP BY ly.KDDM , ly.SBYQMC , ly.SBFL) lyc
        </if>
        <if test="lx == 2">
            SELECT (lyc.lysl-lyc.ghsl) as lycount
            FROM (SELECT SUM(ly.SBSQSL) as lysl ,ifnull(SUM( ly.SBGHSL),0) as ghsl,ly.SBYQMC as sbyqmc,ly.KDDM as kddm,ly.SBFL as sbfl FROM D_SBLYXX ly
            WHERE
            ly.SSFL = 3 AND ly.SBYQMC=#{sbyqmc} AND
            ly.KDDM=#{kddm} AND
            ly.SBFL=#{sbfl}
            GROUP BY ly.KDDM , ly.SBYQMC , ly.SBFL) lyc
        </if>

    </select>







</mapper>