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.
 
 
 
 
 
 

115 lines
4.3 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.ObjectID,
eo.ObjectDesc,
eo.LocationID,
el.LocationName,
eo.FamilyID,
ef.FamilyDesc,
eo.GroupID,
eg.GroupDesc,
eo.SupplierID,
es.SupplierName,
eo.manufacturerID,
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,
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
LEFT JOIN eam_family as ef ON eo.site = ef.site and eo.FamilyID = ef.FamilyID
LEFT JOIN eam_supplier as es ON eo.site = es.site and eo.SupplierID = es.SupplierID
LEFT JOIN eam_group as eg ON eo.site = eg.site and eo.GroupID = eg.GroupID
LEFT JOIN resource as res ON eo.site = res.site and eo.resourceID = res.resource_id
<where>
eo.site = #{query.site}
<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>
</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, 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}, #{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}
where site = #{site}
AND ObjectID = #{objectID}
</update>
<!--删除设备清单的信息-->
<delete id="deleteEamObject">
delete from eam_object
where site = #{site} AND ObjectID = #{objectID}
</delete>
<select id="getFileData" resultType="SysOssEntity">
select url,file_name,new_file_name from sys_oss where id = #{id}
</select>
</mapper>