O
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

129 lines
5.9 KiB

<?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.xujie.sys.modules.pms.mapper.EamObjectMapper">
<!--查询设备清单的接口-->
<select id="getEamObjectList" parameterType="EamObjectData" resultType="EamObjectData">
SELECT * FROM (
SELECT DISTINCT
eo.Site,
eo.bu_no,
dbo.get_bu_desc(eo.site, eo.bu_no) as buDesc,
eo.ObjectID,
eo.ObjectDesc,
eo.LocationID,
el.LocationName,
eo.FamilyID,
ef.FamilyDesc,
eo.GroupID,
eg.GroupDesc,
eo.SupplierID,
es.SupplierName,
eo.ManufacturerID,
em.ManufacturerName,
eo.SeqNo,
eo.PurchessDate,
eo.Active,
eo.CreateDate,
eo.CreateBy,
eo.update_date,
eo.update_by,
eo.ClosedDate,
eo.ClosedBy,
eo.resourceID,
res.resource_desc,
eo.dept_id,
sd.department_name as deptName,
dbo.eam_Get_nextPlanDate(eo.Site, eo.ObjectID,'A') nextCDate,
dbo.eam_Get_nextPlanDate(eo.Site, eo.ObjectID,'B') nextMDate,
eo.asset_no,
eo.asset_remark
FROM eam_object as eo
LEFT JOIN eam_location as el ON eo.site = el.site and eo.LocationID = el.LocationID and eo.bu_no = el.bu_no
LEFT JOIN eam_family as ef ON eo.site = ef.site and eo.FamilyID = ef.FamilyID and eo.bu_no = ef.bu_no
LEFT JOIN eam_supplier as es ON eo.site = es.site and eo.SupplierID = es.SupplierID and eo.bu_no = es.bu_no
LEFT JOIN eam_group as eg ON eo.site = eg.site and eo.GroupID = eg.GroupID and eo.bu_no = eg.bu_no
LEFT JOIN resource as res ON eo.site = res.site and eo.resourceID = res.resource_id
LEFT JOIN eam_manufacturer as em ON eo.site = em.site and eo.ManufacturerID = em.ManufacturerID and eo.bu_no = em.bu_no
LEFT JOIN sys_department as sd ON eo.site = sd.site and eo.dept_id = sd.department_id and eo.bu_no = sd.bu_no
<where>
eo.site in (select site from eam_access_site where username = #{query.userName})
and (eo.site + '-' + eo.bu_no) in (select (a.site + '-' + a.bu_no) from AccessBu as a left join eam_access_site as b on a.site = b.site and a.username = b.username where a.username = #{query.userName})
<if test="query.buDesc != null and query.buDesc != ''">
AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
</if>
<if test="query.objectID != null and query.objectID != ''">
AND eo.ObjectID like '%' + #{query.objectID} +'%'
</if>
<if test="query.objectDesc != null and query.objectDesc != ''">
AND eo.ObjectDesc like '%' + #{query.objectDesc} +'%'
</if>
<if test="query.resourceID != null and query.resourceID != ''">
AND eo.resourceID like '%' + #{query.resourceID} +'%'
</if>
<if test="query.locationName != null and query.locationName != ''">
AND el.LocationName like '%' + #{query.locationName} +'%'
</if>
<if test="query.familyDesc != null and query.familyDesc != ''">
AND ef.FamilyDesc like '%' + #{query.familyDesc} +'%'
</if>
<if test="query.active != null and query.active != ''">
AND eo.active = #{query.active}
</if>
<if test="query.sonId != null and query.sonId != ''">
AND ef.son_id like '%' + #{query.sonId} +'%'
</if>
</where>
) as temp
</select>
<!--查询设备清单按照设备的id-->
<select id="getEamObjectByObjectId" parameterType="EamObjectData" resultType="EamObjectData">
SELECT Site, ObjectID, ObjectDesc, LocationID, FamilyID, GroupID, SupplierID, manufacturerID, SeqNo,
PurchessDate, Active, CreateDate, CreateBy, ClosedDate, ClosedBy,resourceID
FROM eam_object
<where>
AND site = #{site} AND ObjectID = #{objectID}
</where>
</select>
<!--插入设备清单的数据-->
<insert id="insertEamObject">
insert into eam_object
(Site, bu_no, ObjectID, ObjectDesc, LocationID, FamilyID, GroupID, SupplierID, ManufacturerID, SeqNo, PurchessDate, Active, CreateDate, CreateBy, resourceID, update_date, update_by, dept_id, asset_no, asset_remark)
values(#{site}, #{buNo}, #{objectID}, #{objectDesc}, #{locationID}, #{familyID}, #{groupID}, #{supplierID}, #{manufacturerID}, #{seqNo}, #{purchessDate}, #{active}, #{createDate}, #{createBy}, #{resourceID}, getDate(), #{updateBy}, #{deptID}, #{assetNo}, #{assetRemark})
</insert>
<!--修改设备清单的数据-->
<update id="updateEamObject">
update eam_object
set ObjectDesc = #{objectDesc},
LocationID = #{locationID},
FamilyID = #{familyID},
GroupID = #{groupID},
SupplierID = #{supplierID},
ManufacturerID = #{manufacturerID},
SeqNo = #{seqNo},
PurchessDate = #{purchessDate},
Active = #{active},
resourceID = #{resourceID},
update_date = getDate(),
update_by = #{updateBy},
dept_id = #{deptID},
asset_no = #{assetNo},
asset_remark = #{assetNo}
where site = #{site} and bu_no = #{buNo} AND ObjectID = #{objectID}
</update>
<!--删除设备清单的信息-->
<delete id="deleteEamObject">
delete from eam_object
where site = #{site} AND ObjectID = #{objectID} and bu_no = #{buNo}
</delete>
<select id="getFileData" resultType="SysOssEntity">
select url,file_name,new_file_name from sys_oss where id = #{id}
</select>
</mapper>