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.
744 lines
37 KiB
744 lines
37 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.EamMapper">
|
|
|
|
|
|
<select id="eamAdminSearch" parameterType="com.xujie.sys.modules.pms.data.EamAdminData" resultType="com.xujie.sys.modules.pms.data.EamAdminData">
|
|
SELECT Site,AdminID,AdminName,Phone,Department,Email,Tel,LevelID,MesUser,Active,CreatedDate FROM eam_admin
|
|
<where>
|
|
<if test="query.site != null and query.site != ''">
|
|
AND site = #{query.site}
|
|
</if>
|
|
<if test="query.adminID != null and query.adminID != ''">
|
|
AND adminID like '%' + #{query.adminID} +'%'
|
|
</if>
|
|
<if test="query.adminName != null and query.adminName != ''">
|
|
AND adminName like '%' + #{query.adminName}+'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="eamFamilySearch" parameterType="com.xujie.sys.modules.pms.data.EamFamilyData" resultType="com.xujie.sys.modules.pms.data.EamFamilyData">
|
|
SELECT Site,FamilyID,FamilyDesc,Active FROM eam_family
|
|
<where>
|
|
<if test="query.site != null and query.site != ''">
|
|
AND site = #{query.site}
|
|
</if>
|
|
<if test="query.familyID != null and query.familyID != ''">
|
|
AND familyID like '%' + #{query.familyID} +'%'
|
|
</if>
|
|
<if test="query.familyDesc != null and query.familyDesc != ''">
|
|
AND familyDesc like '%' + #{query.familyDesc} +'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamGroupSearch" parameterType="com.xujie.sys.modules.pms.data.EamGroupData" resultType="com.xujie.sys.modules.pms.data.EamGroupData">
|
|
SELECT Site,GroupID,GroupDesc,Active FROM eam_group
|
|
<where>
|
|
<if test="query.site != null and query.site != ''">
|
|
AND site = #{query.site}
|
|
</if>
|
|
<if test="query.groupID != null and query.groupID != ''">
|
|
AND groupID like '%' + #{query.groupID}
|
|
</if>
|
|
<if test="query.groupDesc != null and query.groupDesc != ''">
|
|
AND groupDesc like '%' + #{query.groupDesc}
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamLocationSearch" parameterType="com.xujie.sys.modules.pms.data.EamLocationData" resultType="com.xujie.sys.modules.pms.data.EamLocationData">
|
|
SELECT Site,LocationID,LocationName,Active FROM eam_location
|
|
<where>
|
|
<if test="query.site != null and query.site != ''">
|
|
AND site = #{query.site}
|
|
</if>
|
|
<if test="query.locationID != null and query.locationID != ''">
|
|
AND locationID like '%' + #{query.locationID} +'%'
|
|
</if>
|
|
<if test="query.locationName != null and query.locationName != ''">
|
|
AND locationName like '%' + #{query.locationName} +'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamManufacturerSearch" parameterType="com.xujie.sys.modules.pms.data.EamManufacturerData" resultType="com.xujie.sys.modules.pms.data.EamManufacturerData">
|
|
SELECT Site,ManufacturerID,ManufacturerName,Active,Contact,Phone,Address,Email,Remark FROM eam_manufacturer
|
|
<where>
|
|
<if test="query.site != null and query.site != ''">
|
|
AND site = #{query.site}
|
|
</if>
|
|
<if test="query.manufacturerID != null and query.manufacturerID != ''">
|
|
AND manufacturerID like '%' + #{query.manufacturerID} +'%'
|
|
</if>
|
|
<if test="query.manufacturerName != null and query.manufacturerName != ''">
|
|
AND manufacturerName like '%' + #{query.manufacturerName} +'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamAdminLevelSearch" parameterType="com.xujie.sys.modules.pms.data.EamAdminLevelData" resultType="com.xujie.sys.modules.pms.data.EamAdminLevelData">
|
|
SELECT Site,AdminLevelID,AdminLevelDesc,Active FROM eam_adminLevel
|
|
<where>
|
|
<if test="query.site != null and query.site != ''">
|
|
AND site = #{query.site}
|
|
</if>
|
|
<if test="query.adminLevelID != null and query.adminLevelID != ''">
|
|
AND adminLevelID like '%' + #{query.adminLevelID} +'%'
|
|
</if>
|
|
<if test="query.adminLevelDesc != null and query.adminLevelDesc != ''">
|
|
AND adminLevelDesc like '%' + #{query.adminLevelDesc}+'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="eamSupplierSearch" parameterType="com.xujie.sys.modules.pms.data.EamSupplierData" resultType="com.xujie.sys.modules.pms.data.EamSupplierData">
|
|
SELECT Site,SupplierID,SupplierName,[Group],Active,Contact,Phone,Address,Email,Remark FROM eam_supplier
|
|
<where>
|
|
<if test="query.site != null and query.site != ''">
|
|
AND site = #{query.site}
|
|
</if>
|
|
<if test="query.supplierID != null and query.supplierID != ''">
|
|
AND supplierID like '%' + #{query.supplierID} +'%'
|
|
</if>
|
|
<if test="query.supplierName != null and query.supplierName != ''">
|
|
AND supplierName like '%' + #{query.supplierName} +'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="searchItemAvailable" resultType="com.xujie.sys.modules.pms.data.EamPropertiesItemAvailableData">
|
|
SELECT ItemNo,ValueNo,AvailableValue,CreatedDate,CreatedBy,ItemType
|
|
from eam_properties_item_available where itemNo=#{itemNo} and ItemType=#{itemType}
|
|
</select>
|
|
|
|
|
|
<select id="getItemValueNo" resultType="Double">
|
|
SELECT isnull( max(valueNo),0)+1 from eam_properties_item_available where itemNo=#{itemNo} and ItemType=#{itemType}
|
|
</select>
|
|
<select id="getItemValueNoForPlan" resultType="Double">
|
|
SELECT isnull( max(valueNo),0)+1 from eam_workPlan_item_available where itemNo=#{itemNo} and ItemType=#{itemType} and site=#{site} and PlanID=#{planID}
|
|
</select>
|
|
<insert id="saveItemAvailable">
|
|
insert into eam_properties_item_available (ItemNo,ValueNo,AvailableValue,CreatedDate,CreatedBy,ItemType)
|
|
values(#{itemNo},#{valueNo},#{availableValue},GetDate(),#{createdBy},#{itemType})
|
|
</insert>
|
|
|
|
<update id="updateItemAvailable">
|
|
update eam_properties_item_available set AvailableValue=#{availableValue} where itemNo=#{itemNo} and ItemType=#{itemType} and ValueNo=#{valueNo}
|
|
</update>
|
|
|
|
<delete id="deleteItemAvailable">
|
|
delete from eam_properties_item_available where itemNo=#{itemNo} and ItemType=#{itemType} and ValueNo=#{valueNo}
|
|
</delete>
|
|
|
|
<select id="eamPropertiesModelSearch" parameterType="com.xujie.sys.modules.pms.data.EamPropertiesModelHeaderData" resultType="com.xujie.sys.modules.pms.data.EamPropertiesModelHeaderData">
|
|
SELECT function_type,code_no,code_desc,active,created_date,created_by,update_date,update_by,delflag,version FROM eam_properties_model_header
|
|
<where>
|
|
|
|
<if test="query.codeNo != null and query.codeNo != ''">
|
|
AND code_no like '%' + #{query.codeNo} +'%'
|
|
</if>
|
|
<if test="query.codeDesc != null and query.codeDesc != ''">
|
|
AND code_desc like '%' + #{query.codeDesc}+'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
and function_type =#{query.functionType}
|
|
</where>
|
|
</select>
|
|
|
|
<insert id="eamPropertiesModelSave" >
|
|
insert into eam_properties_model_header (function_type,code_no,code_desc,active,created_date,created_by,delflag,version)
|
|
values(#{functionType},#{codeNo},#{codeDesc},#{active},GetDate(),#{userId},'N',0)
|
|
</insert>
|
|
|
|
<update id="eamPropertiesModelEdit">
|
|
update eam_properties_model_header set version=version+1,code_desc=#{codeDesc},active=#{active},created_by=#{userId},created_date=GetDate() where function_type=#{functionType}
|
|
and code_no=#{codeNo}
|
|
</update>
|
|
|
|
<select id="checkPropertiesModel" resultType="EamPropertiesModelHeaderData">
|
|
SELECT function_type,code_no,code_desc,active,created_date,created_by,update_date,update_by,delflag,version FROM eam_properties_model_header
|
|
where function_type=#{functionType} and code_no=#{codeNo}
|
|
</select>
|
|
|
|
<delete id="eamPropertiesModelDelete" >
|
|
delete from eam_properties_model_header where function_type=#{functionType} and code_no=#{codeNo}
|
|
</delete>
|
|
|
|
<select id="searchModalDetails" resultType="EamPropertiesModelDetailData">
|
|
SELECT a.function_type,a.code_no,a.properties_item_no itemNo,a.seq_no,b.ItemDesc
|
|
,b.DefaultValue,b.ValueType,b.ValueType_DB,b.ValueChooseFlag,b.MaxValue,
|
|
b.MinValue,b.ItemRemark,b.ItemType
|
|
FROM eam_properties_model_detail a
|
|
left join eam_properties_item b on a.function_type=b.itemType and a.properties_item_no=b.itemNo
|
|
where a.function_type=#{functionType} and a.code_no=#{codeNo}
|
|
</select>
|
|
<select id="checkItem" resultType="EamPropertiesModelDetailData">
|
|
SELECT ItemDesc FROM eam_properties_item
|
|
where itemType=#{functionType} and itemNo=#{itemNo}
|
|
</select>
|
|
<select id="checkModalDetails" resultType="EamPropertiesModelDetailData">
|
|
SELECT a.function_type,a.code_no,a.properties_item_no itemNo,a.seq_no FROM eam_properties_model_detail a
|
|
where a.function_type=#{functionType} and a.code_no=#{codeNo} and properties_item_no=#{itemNo}
|
|
</select>
|
|
<select id="getModalDetailSeqNo" resultType="Integer">
|
|
SELECT isnull( max(seq_no),0)+1 from eam_properties_model_detail where function_type=#{functionType} and code_no=#{codeNo}
|
|
</select>
|
|
<insert id="saveModalDetails" >
|
|
insert into eam_properties_model_detail (function_type,code_no,properties_item_no,seq_no,created_date,created_by,delflag,version)
|
|
values(#{functionType},#{codeNo},#{itemNo},#{seqNo},GetDate(),#{userId},'N',0)
|
|
</insert>
|
|
|
|
|
|
<delete id="deleteModalDetails" >
|
|
delete from eam_properties_model_detail where function_type=#{functionType} and code_no=#{codeNo} and properties_item_no=#{itemNo}
|
|
</delete>
|
|
|
|
|
|
<select id="eamWorkPlanSearch" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
SELECT a.Site,a.PlanID,a.PlanDesc,a.ObjectID,a.FunctionType,a.PropertiesCode,a.Operator,a.PlanPeriod,a.Status,
|
|
a.PlanStartDate,a.PlanEndDate,a.CreatedDate,a.CreatedBy,a.UpdateDate,a.UpdateBy,a.Version,a.Remark
|
|
,a.NextWorkDate,b.ObjectDesc,c.adminName,d.code_desc
|
|
|
|
FROM eam_workPlan a
|
|
left join eam_object b on a.Site=b.Site and a.ObjectID=b.ObjectID
|
|
left join eam_admin c on a.Site=c.Site and a.operator=c.AdminID
|
|
left join eam_properties_model_header d on a.FunctionType=d.function_type and a.PropertiesCode=d.code_no
|
|
<where>
|
|
AND a.DeleteFlag='N'
|
|
AND a.FunctionType = #{query.functionType}
|
|
<if test="query.planID != null and query.planID != ''">
|
|
AND a.PlanID like '%' + #{query.planID} +'%'
|
|
</if>
|
|
<if test="query.planDesc != null and query.planDesc != ''">
|
|
AND a.PlanDesc like '%' + #{query.planDesc}+'%'
|
|
</if>
|
|
<if test="query.objectID != null and query.objectID != ''">
|
|
AND a.ObjectID like '%' + #{query.objectID} +'%'
|
|
</if>
|
|
<if test="query.status != null and query.status != ''">
|
|
AND a.status = #{query.status}
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND a.PlanStartDate >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} >= a.PlanStartDate
|
|
</if>
|
|
|
|
</where>
|
|
</select>
|
|
|
|
<select id="searchPlanItems" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanItemData">
|
|
SELECT a.Site,a.PlanID,a.ItemNo,a.ItemDesc,a.DefaultValue,a.ValueType,a.ValueType_DB,a.ValueChooseFlag,a.UpdateDate,a.UpdateBy,
|
|
a.MaxValue,a.MinValue,a.ItemRemark,a.ItemType,a.CreatedDate,a.CreatedBy
|
|
FROM eam_workPlan_item a
|
|
|
|
where a.PlanID=#{planID} and a.Site=#{site} and a.ItemType=#{functionType}
|
|
</select>
|
|
|
|
<select id="searchPlanItemAvailable" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanItemAvailableData">
|
|
SELECT a.Site,a.PlanID,a.ItemNo,a.ItemType,a.ValueNo,a.AvailableValue,a.CreatedDate,a.CreatedBy,a.UpdateDate,a.UpdateBy
|
|
|
|
from eam_workPlan_item_available a where a.PlanID=#{planID} and a.itemNo=#{itemNo} and a.site=#{site} and a.ItemType=#{itemType}
|
|
</select>
|
|
|
|
<update id="updatePlanItems">
|
|
update eam_workPlan_item set DefaultValue=#{defaultValue},ValueType=#{valueType},ValueType_DB=#{valueTypeDb}
|
|
,ValueChooseFlag=#{valueChooseFlag},UpdateDate=GetDate(),UpdateBy=#{createdBy},MaxValue=#{maxValue,jdbcType=FLOAT},MinValue=#{minValue,jdbcType=FLOAT},
|
|
ItemRemark=#{itemRemark}
|
|
where site=#{site} and planID=#{planID} and ItemType=#{itemType}
|
|
and ItemNo=#{itemNo}
|
|
</update>
|
|
<update id="updatePlanItemsForNull">
|
|
update eam_workPlan_item set DefaultValue=#{defaultValue},ValueType=#{valueType},ValueType_DB=#{valueTypeDb}
|
|
,ValueChooseFlag=#{valueChooseFlag},UpdateDate=GetDate(),UpdateBy=#{createdBy},MaxValue=null,MinValue=null,
|
|
ItemRemark=#{itemRemark}
|
|
where site=#{site} and planID=#{planID} and ItemType=#{itemType}
|
|
and ItemNo=#{itemNo}
|
|
</update>
|
|
|
|
|
|
<insert id="saveItemAvailableForPlan">
|
|
insert into eam_workPlan_item_available (Site,PlanID,ItemNo,ValueNo,AvailableValue,CreatedDate,CreatedBy,ItemType)
|
|
values(#{site},#{planID},#{itemNo},#{valueNo},#{availableValue},GetDate(),#{createdBy},#{itemType})
|
|
</insert>
|
|
|
|
<update id="updateItemAvailableForPlan">
|
|
update eam_workPlan_item_available set AvailableValue=#{availableValue},updateBy=#{createdBy},updateDate=GetDate()
|
|
where itemNo=#{itemNo} and ItemType=#{itemType} and ValueNo=#{valueNo} AND site=#{site} and planID=#{planID}
|
|
</update>
|
|
|
|
|
|
<delete id="deletePlanItemAvailable">
|
|
delete from eam_workPlan_item_available where itemNo=#{itemNo} and ItemType=#{itemType} and ValueNo=#{valueNo} AND site=#{site} and planID=#{planID}
|
|
</delete>
|
|
|
|
<select id="objectIDBlur" resultType="com.xujie.sys.modules.pms.data.EamObjectData">
|
|
select objectID,ObjectDesc from eam_object where active='Y' and Site=#{site} and ObjectID=#{objectID}
|
|
</select>
|
|
<select id="modalCodeBlur" resultType="com.xujie.sys.modules.pms.data.EamPropertiesModelHeaderData">
|
|
select code_no,code_desc from eam_properties_model_header where active='Y' and function_type=#{functionType} and code_no=#{codeNo}
|
|
</select>
|
|
|
|
|
|
<select id="eamWorkOrderSearch" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
SELECT a.Site,a.OrderNo,a.PlanID,a.PropertiesCode,a.ObjectID,a.Status,a.PlanOperator,a.ActualOperator,a.PlanDate,a.ActualDate,
|
|
a.FunctionType,a.CreateDate,a.CreateBy,a.Remark,a.StartTime,a.EndTime,a.WorkTime,dbo.eam_Get_eamAdminName(a.Site,a.PlanOperator) PlanOperatorName,
|
|
dbo.eam_Get_eamAdminName(a.Site,a.ActualOperator) ActualOperatorName ,dbo.eam_Get_eamObjectDesc(a.Site,a.ObjectID) ObjectDesc
|
|
,dbo.eam_Get_eam_properties_CodeDesc(a.FunctionType,a.PropertiesCode) codeDesc,a.result
|
|
FROM eam_workOrder a
|
|
|
|
<where>
|
|
and a.Site=#{query.site}
|
|
<if test="query.orderNo != null and query.orderNo != ''">
|
|
AND a.OrderNo like '%' + #{query.orderNo} +'%'
|
|
</if>
|
|
<if test="query.planID != null and query.planID != ''">
|
|
AND a.PlanID like '%' + #{query.planID} +'%'
|
|
</if>
|
|
<if test="query.objectID != null and query.objectID != ''">
|
|
AND a.ObjectID like '%' + #{query.objectID} +'%'
|
|
</if>
|
|
<if test="query.planOperator != null and query.planOperator != ''">
|
|
AND a.PlanOperator like '%' + #{query.planOperator} +'%'
|
|
</if>
|
|
<if test="query.status != null and query.status != ''">
|
|
AND a.status=#{query.status}
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND a.PlanDate > #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} > a.PlanDate
|
|
</if>
|
|
and a.FunctionType =#{query.functionType}
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamWorkOrderSearchForDefect" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
SELECT a.Site,a.OrderNo,a.PlanID,a.ObjectID,a.Status,a.PlanOperator,a.ActualOperator,a.PlanDate,a.ActualDate,
|
|
a.FunctionType,a.CreateDate,a.CreateBy,a.Remark,a.StartTime,a.EndTime,a.WorkTime,dbo.eam_Get_eamAdminName(a.Site,a.PlanOperator) PlanOperatorName,
|
|
dbo.eam_Get_eamAdminName(a.Site,a.ActualOperator) ActualOperatorName,b.DefectID,c.DefectDesc,dbo.eam_Get_eamObjectDesc(a.Site,a.ObjectID) ObjectDesc
|
|
,dbo.eam_Get_eam_properties_CodeDesc(a.FunctionType,a.PropertiesCode) codeDesc,a.result
|
|
FROM eam_workOrder a left join eam_defect_feedBack b on a.site=b.site and a.PlanID=b.feedBackID
|
|
left join eam_defect c on b.DefectID=c.DefectID
|
|
|
|
<where>
|
|
and a.Site=#{query.site}
|
|
<if test="query.orderNo != null and query.orderNo != ''">
|
|
AND a.OrderNo like '%' + #{query.orderNo} +'%'
|
|
</if>
|
|
<if test="query.planID != null and query.planID != ''">
|
|
AND a.PlanID like '%' + #{query.planID} +'%'
|
|
</if>
|
|
<if test="query.objectID != null and query.objectID != ''">
|
|
AND a.ObjectID like '%' + #{query.objectID} +'%'
|
|
</if>
|
|
<if test="query.planOperator != null and query.planOperator != ''">
|
|
AND a.PlanOperator like '%' + #{query.planOperator} +'%'
|
|
</if>
|
|
<if test="query.status != null and query.status != ''">
|
|
AND a.status=#{query.status}
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND a.PlanDate > #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} > a.PlanDate
|
|
</if>
|
|
and a.FunctionType =#{query.functionType}
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamDefectSearch" parameterType="com.xujie.sys.modules.pms.data.EamDefectData" resultType="com.xujie.sys.modules.pms.data.EamDefectData">
|
|
SELECT DefectID,DefectDesc,Active FROM eam_defect
|
|
<where>
|
|
|
|
<if test="query.defectID != null and query.defectID != ''">
|
|
AND defectID like '%' + #{query.defectID} + '%'
|
|
</if>
|
|
<if test="query.defectDesc != null and query.defectDesc != ''">
|
|
AND defectDesc like '%' + #{query.defectDesc} + '%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
order by id
|
|
</select>
|
|
|
|
<select id="eamObjectDefectSearch" parameterType="com.xujie.sys.modules.pms.data.EamObjectDefectInData" resultType="com.xujie.sys.modules.pms.data.EamObjectDefectInData">
|
|
SELECT a.site,a.ObjectID,a.DefectID,a.Active,a.id,b.ObjectDesc,c.DefectDesc FROM eam_object_defect a
|
|
left join eam_object b on a.site=b.site and a.ObjectID=b.ObjectID
|
|
left join eam_defect c on a.DefectID=c.DefectID
|
|
<where>
|
|
|
|
<if test="query.objectID != null and query.objectID != ''">
|
|
AND a.ObjectID like '%' + #{query.objectID} + '%'
|
|
</if>
|
|
<if test="query.objectDesc != null and query.objectDesc != ''">
|
|
AND b.ObjectDesc like '%' + #{query.objectDesc} + '%'
|
|
</if>
|
|
<if test="query.defectID != null and query.defectID != ''">
|
|
AND a.defectID like '%' + #{query.defectID} + '%'
|
|
</if>
|
|
<if test="query.defectDesc != null and query.defectDesc != ''">
|
|
AND c.defectDesc like '%' + #{query.defectDesc} + '%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND a.active = #{query.active}
|
|
</if>
|
|
</where>
|
|
order by a.id
|
|
</select>
|
|
<select id="getObjectList" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData" resultType="com.xujie.sys.modules.pms.data.EamObjectInData">
|
|
SELECT a.Site,a.ObjectID,a.ObjectDesc,a.LocationID,a.FamilyID,a.GroupID,b.FamilyDesc
|
|
from eam_object a left join eam_family b on a.site=b.site and a.familyID=b.familyID
|
|
<where>
|
|
|
|
<if test="objectID != null and objectID != ''">
|
|
AND a.ObjectID like '%' + #{objectID} + '%'
|
|
</if>
|
|
<if test="objectDesc != null and objectDesc != ''">
|
|
AND a.ObjectDesc like '%' + #{objectDesc} + '%'
|
|
</if>
|
|
<if test="familyID != null and familyID != ''">
|
|
AND a.FamilyID like '%' + #{familyID} + '%'
|
|
</if>
|
|
and a.site=#{site} and a.active='Y'
|
|
</where>
|
|
|
|
</select>
|
|
|
|
<select id="checkEamFamilyDelete" resultType="com.xujie.sys.modules.pms.data.EamObjectData">
|
|
SELECT site ,objectID from eam_object where site=#{site} and FamilyID=#{familyID}
|
|
</select>
|
|
|
|
<select id="checkEamGroupDelete" resultType="com.xujie.sys.modules.pms.data.EamObjectData">
|
|
SELECT site ,objectID from eam_object where site=#{site} and GroupID=#{groupID}
|
|
</select>
|
|
|
|
<select id="checkEamLocationDelete" resultType="com.xujie.sys.modules.pms.data.EamObjectData">
|
|
SELECT site ,objectID from eam_object where site=#{site} and LocationID=#{locationID}
|
|
</select>
|
|
|
|
<select id="eamWorkPlanItemSearchForReport" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderItemInData">
|
|
SELECT Site,#{orderNo} as orderNo,ItemNo,ItemDesc,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,MaxValue,MinValue,
|
|
ItemRemark,ItemType
|
|
from eam_workPlan_item where site=#{site} and planID=#{planID}
|
|
</select>
|
|
|
|
<select id="checkEamOrderStatus" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
SELECT Site,status,OrderNo from eam_workOrder where site=#{site} and orderNo=#{orderNo}
|
|
|
|
</select>
|
|
|
|
<select id="getAdminIDWithMesUser" resultType="com.xujie.sys.modules.pms.data.EamAdminData">
|
|
SELECT adminID from eam_admin where site=#{site} and mesUser=#{mesUser} and active='Y'
|
|
</select>
|
|
<update id="updateDefectResult" >
|
|
update eam_defect_feedBack set Status=#{result},FinishDate=GetDate() where Site=#{site} and FeedBackID=#{planID}
|
|
</update>
|
|
<update id="reportWorkOrder" >
|
|
update eam_workOrder set Status='已完工' ,ActualOperator=#{actualOperator},ActualDate=GetDate(),Remark=#{remark},
|
|
WorkTime=#{workTime},result=#{result,jdbcType=VARCHAR} where site=#{site} and orderNo=#{orderNo}
|
|
</update>
|
|
<insert id="saveWorkOrderItem">
|
|
INSERT into eam_workOrder_item (Site,OrderNo,ItemNo,ItemDesc,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,MaxValue,MinValue,ItemRemark,ItemType,
|
|
TextValue,NumberValue,CreatedDate,CreatedBy,FinishFlag)values
|
|
(#{site},#{orderNo},#{itemNo},#{itemDesc},#{defaultValue},#{valueType},#{valueTypeDb},
|
|
#{valueChooseFlag},#{maxValue,jdbcType=DOUBLE},#{minValue,jdbcType=DOUBLE},#{itemRemark,jdbcType=VARCHAR},#{itemType}
|
|
,#{textValue,jdbcType=VARCHAR},#{numberValue,jdbcType=DOUBLE},GetDate(),#{createdBy},#{finishFlag})
|
|
</insert>
|
|
<update id="closePlanWithCheck">
|
|
update eam_workPlan set status='已结束' where site=#{site} and PlanID=#{planID} and GetDate() > PlanEndDate
|
|
</update>
|
|
<update id="updatePlanNextDate">
|
|
update eam_workPlan set NextWorkDate=(select top 1 PlanDate from eam_workOrder where site
|
|
=#{site} and PlanID=#{planID} and PlanDate>GetDate() and status='未开工' order by PlanDate) where site=#{site} and PlanID=#{planID}
|
|
</update>
|
|
|
|
<select id="eamWorkOrderReportSearch" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderItemInData">
|
|
SELECT Site,OrderNo,ItemNo,ItemDesc,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,MaxValue,MinValue,ItemRemark,ItemType,
|
|
TextValue,NumberValue,CreatedDate,CreatedBy,FinishFlag from eam_workOrder_item where site=#{site} and orderNo=#{orderNo}
|
|
</select>
|
|
|
|
<update id="cancelOrder">
|
|
update eam_workOrder set Status='已取消' where site=#{site} and orderNo=#{orderNo}
|
|
</update>
|
|
|
|
<select id="checkPlanStatus" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
SELECT Site,Status from eam_workPlan where site=#{site} and PlanID=#{planID} and deleteFlag='N'
|
|
</select>
|
|
|
|
<update id="planOrder">
|
|
update eam_workPlan set Status='已计划',NextWorkDate=null where site=#{site} and PlanID=#{planID} and deleteFlag='N'
|
|
</update>
|
|
<update id="cancelPlan">
|
|
update eam_workPlan set Status='已取消',NextWorkDate=null where site=#{site} and PlanID=#{planID} and deleteFlag='N'
|
|
</update>
|
|
|
|
<update id="cancelOrderWithPlanID">
|
|
update eam_workOrder set Status='已取消' where site=#{site} and PlanID=#{planID} and status='未开工'
|
|
</update>
|
|
<update id="deleteOrderDetailWithPlanID">
|
|
delete from eam_workOrder_item where site=#{site} and OrderNo in
|
|
(select OrderNo from eam_workOrder where site=#{site} and PlanID=#{planID} and status='未开工' and PlanDate > GetDate() - 1 )
|
|
|
|
</update>
|
|
|
|
<update id="deleteOrderWithPlanID">
|
|
delete from eam_workOrder where site=#{site} and PlanID=#{planID} and status='未开工' and PlanDate > GetDate() - 1
|
|
|
|
</update>
|
|
|
|
<update id="updateOrderPlanOperator">
|
|
update eam_workOrder set PlanOperator=#{planOperator} where site=#{site} and orderNo=#{orderNo}
|
|
</update>
|
|
|
|
<select id="getSpareSelectList" resultType="com.xujie.sys.modules.pms.data.PartSpareInData">
|
|
select a.site ,a.part_no,a.part_description,a.spec ,b.resource_id objectID from part_spare a
|
|
left join resource_spare b on a.site=b.site and a.part_no=b.part_no and resource_id=#{objectID}
|
|
<where>
|
|
|
|
<if test="partNo != null and partNo != ''">
|
|
AND a.part_no like '%' + #{partNo} + '%'
|
|
</if>
|
|
<if test="partDescription != null and partDescription != ''">
|
|
AND a.part_description like '%' + #{partDescription} + '%'
|
|
</if>
|
|
|
|
and a.site=#{site} and a.active='Y'
|
|
</where>
|
|
</select>
|
|
|
|
<select id="checkPartSpare" resultType="com.xujie.sys.modules.pms.data.PartSpareInData">
|
|
select part_no from resource_spare where site=#{site} and resource_id=#{objectID} and part_no=#{partNo}
|
|
</select>
|
|
|
|
<insert id="savePartSpare" >
|
|
INSERT Into resource_spare (resource_id,part_no,delflag,version,site)
|
|
values(#{objectID},#{partNo},'',0,#{site})
|
|
</insert>
|
|
|
|
<delete id="deletePartSpare">
|
|
delete from resource_spare where resource_id=#{objectID} and site=#{site}
|
|
</delete>
|
|
|
|
<insert id="copyPartSpare" >
|
|
INSERT Into resource_spare (resource_id,part_no,delflag,version,site)
|
|
select #{objectID},part_no,delflag,0,site from resource_spare where resource_id=#{oldObjectID} and site=#{site}
|
|
</insert>
|
|
|
|
<select id="getWorkPlanDataWithObjectID" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
SELECT a.Site,a.PlanID,a.PlanDesc,a.ObjectID,a.FunctionType,a.PropertiesCode,a.Operator,a.PlanPeriod,a.Status,
|
|
a.PlanStartDate,a.PlanEndDate,a.CreatedDate,a.CreatedBy,a.UpdateDate,a.UpdateBy,a.Version,a.Remark
|
|
,a.NextWorkDate,b.ObjectDesc,c.adminName,d.code_desc
|
|
|
|
FROM eam_workPlan a
|
|
left join eam_object b on a.Site=b.Site and a.ObjectID=b.ObjectID
|
|
left join eam_admin c on a.Site=c.Site and a.operator=c.AdminID
|
|
left join eam_properties_model_header d on a.FunctionType=d.function_type and a.PropertiesCode=d.code_no
|
|
where a.site=#{site} and a.ObjectID=#{objectID} and a.FunctionType=#{functionType} and a.DeleteFlag='N'
|
|
and status in ('已计划','进行中')
|
|
</select>
|
|
|
|
<select id="getObjectItemList" resultType="com.xujie.sys.modules.pms.data.EamObjectItemInData">
|
|
SELECT a.site,a.objectID,a.ItemNo,a.DefaultValue,a.ValueType,a.ValueType_DB,a.ValueChooseFlag,a.CreatedDate,a.CreatedBy,
|
|
a.MaxValue,a.MinValue,a.ItemType,b.ItemDesc,b.ItemRemark from eam_object_item a left join eam_properties_item b
|
|
on a.ItemNo=b.ItemNo and a.ItemType=b.ItemType
|
|
where a.site=#{site} and a.ObjectID=#{objectID}
|
|
and a.ItemType=#{itemType}
|
|
</select>
|
|
|
|
<select id="getDefectWithObject" resultType="com.xujie.sys.modules.pms.data.EamObjectDefectInData">
|
|
SELECT a.site,a.ObjectID,a.DefectID,a.Active,a.id,b.DefectDesc
|
|
from eam_object_defect a left join eam_defect b
|
|
on a.DefectID=b.DefectID
|
|
where a.site=#{site} and a.ObjectID=#{objectID}
|
|
|
|
</select>
|
|
|
|
<select id="checkEamObjectItemData" resultType="com.xujie.sys.modules.pms.data.EamObjectItemInData">
|
|
select site,objectID,ItemNo,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,CreatedDate,CreatedBy,MaxValue,MinValue,
|
|
ItemType from eam_object_item where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} and ItemNo=#{itemNo}
|
|
</select>
|
|
|
|
<insert id="saveNewEamObjectItem" >
|
|
insert into eam_object_item (site,objectID,ItemNo,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,CreatedDate,CreatedBy,MaxValue,MinValue,
|
|
ItemType) values(#{site},#{objectID},#{itemNo},#{defaultValue},#{valueType},#{valueTypeDb},#{valueChooseFlag},GetDate(),#{userId},#{maxValue,jdbcType=DOUBLE},#{minValue,jdbcType=DOUBLE},#{itemType})
|
|
</insert>
|
|
|
|
<update id="editEamObjectItem">
|
|
update eam_object_item set DefaultValue=#{defaultValue},ValueType=#{valueType},ValueType_DB=#{valueTypeDb}
|
|
,ValueChooseFlag=#{valueChooseFlag},MaxValue=#{maxValue,jdbcType=FLOAT},MinValue=#{minValue,jdbcType=FLOAT}
|
|
|
|
where site=#{site} and objectID=#{objectID} and ItemType=#{itemType}
|
|
and ItemNo=#{itemNo}
|
|
</update>
|
|
|
|
<delete id="deleteObjectItem">
|
|
delete from eam_object_item where site=#{site} and objectID=#{objectID} and ItemType=#{itemType}
|
|
and ItemNo=#{itemNo}
|
|
</delete>
|
|
|
|
<insert id="saveNewEamObjectItemAvailable">
|
|
insert into eam_object_item_available (Site,ObjectID,ItemNo,ItemType,ValueNo,AvailableValue,CreatedDate,CreatedBy)
|
|
select #{site},#{objectID},ItemNo,ItemType,ValueNo,AvailableValue,GetDate() ,#{userId} from eam_properties_item_available
|
|
where ItemNo=#{itemNo} and ItemType=#{itemType}
|
|
</insert>
|
|
|
|
<delete id="deleteEamObjectItemAvailable">
|
|
delete from eam_object_item_available where site=#{site} and objectID=#{objectID} and ItemType=#{itemType}
|
|
and ItemNo=#{itemNo}
|
|
</delete>
|
|
<select id="searchObjectItemAvailable" resultType="com.xujie.sys.modules.pms.data.EamObjectItemAvailableData">
|
|
select Site,ObjectID,ItemNo,ItemType,ValueNo,AvailableValue from eam_object_item_available
|
|
where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} and ItemNo=#{itemNo}
|
|
</select>
|
|
<select id="getItemValueNoForObject" resultType="Double">
|
|
SELECT isnull( max(valueNo),0)+1 from eam_object_item_available where itemNo=#{itemNo} and ItemType=#{itemType} and site=#{site} and objectID=#{objectID}
|
|
</select>
|
|
|
|
<insert id="saveObjectItemAvailable">
|
|
insert into eam_object_item_available(Site,ObjectID,ItemNo,ItemType,ValueNo,AvailableValue,CreatedDate,CreatedBy)
|
|
values(#{site},#{objectID},#{itemNo},#{itemType},#{valueNo},#{availableValue},GetDate(),#{createdBy})
|
|
</insert>
|
|
<update id="updateObjectItemAvailable">
|
|
update eam_object_item_available set AvailableValue=#{availableValue},updateDate=GetDate(),updateBy=#{createdBy}
|
|
where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} and ItemNo=#{itemNo} and ValueNo=#{valueNo}
|
|
</update>
|
|
|
|
<delete id="deleteObjectItemAvailable">
|
|
delete from eam_object_item_available where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} and ItemNo=#{itemNo} and ValueNo=#{valueNo}
|
|
</delete>
|
|
|
|
<delete id="deleteObjectItemForCopy">
|
|
delete from eam_object_item where site=#{site} and objectID=#{objectID} and ItemType=#{itemType}
|
|
</delete>
|
|
<delete id="deleteObjectItemAvailableForCopy">
|
|
delete from eam_object_item_available where site=#{site} and objectID=#{objectID} and ItemType=#{itemType}
|
|
</delete>
|
|
<insert id="copyObjectItem" >
|
|
insert into eam_object_item (site,objectID,ItemNo,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,CreatedDate,CreatedBy,MaxValue,MinValue,
|
|
ItemType)
|
|
select #{site},#{objectID},ItemNo,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,GetDate(),#{createBy},MaxValue,MinValue,ItemType
|
|
from eam_object_item where site=#{site} and objectID=#{oldObjectID} and ItemType=#{itemType}
|
|
</insert>
|
|
<insert id="copyObjectItemAvailable">
|
|
insert into eam_object_item_available(Site,ObjectID,ItemNo,ItemType,ValueNo,AvailableValue,CreatedDate,CreatedBy)
|
|
select #{site},#{objectID},ItemNo,ItemType,ValueNo,AvailableValue,GetDate(),#{createBy}
|
|
from eam_object_item_available where site=#{site} and objectID=#{oldObjectID} and ItemType=#{itemType}
|
|
</insert>
|
|
<delete id="deleteObjectDefectForCopy">
|
|
delete from eam_object_defect where site=#{site} and objectID=#{objectID}
|
|
</delete>
|
|
|
|
<insert id="copyObjectDefect">
|
|
insert into eam_object_defect(site,ObjectID,DefectID,Active)
|
|
select #{site},#{objectID},DefectID,Active
|
|
from eam_object_defect where site=#{site} and objectID=#{oldObjectID}
|
|
</insert>
|
|
|
|
<select id="eamFeedBackSearch" resultType="com.xujie.sys.modules.pms.data.EamDefectFeedBackInData">
|
|
select a.Site,a.FeedBackID,a.FeedBackDesc,a.ObjectID,a.DefectID,a.FunctionType,a.PlanOperator,a.ActualOperator,a.Status,
|
|
a.PlanDate,a.Remark,a.deleteFlag,a.CreatedDate,a.CreatedBy,a.UpdateDate,a.UpdateBy,a.Version,a.DefectDate,
|
|
dbo.eam_Get_eamAdminName(a.Site,a.PlanOperator) PlanOperatorName,b.defectDesc,
|
|
dbo.eam_Get_eamAdminName(a.Site,a.ActualOperator) ActualOperatorName ,dbo.eam_Get_eamObjectDesc(a.Site,a.ObjectID) ObjectDesc,FinishDate
|
|
from eam_defect_feedBack a
|
|
left join eam_defect b
|
|
on a.DefectID=b.DefectID
|
|
<where>
|
|
and a.Site=#{query.site}
|
|
|
|
<if test="query.feedBackID != null and query.feedBackID != ''">
|
|
AND a.feedBackID like '%' + #{query.feedBackID} +'%'
|
|
</if>
|
|
<if test="query.defectDesc != null and query.defectDesc != ''">
|
|
AND b.defectDesc like '%' + #{query.defectDesc} +'%'
|
|
</if>
|
|
<if test="query.objectID != null and query.objectID != ''">
|
|
AND a.ObjectID like '%' + #{query.objectID} +'%'
|
|
</if>
|
|
<if test="query.planOperator != null and query.planOperator != ''">
|
|
AND a.PlanOperator like '%' + #{query.planOperator} +'%'
|
|
</if>
|
|
<if test="query.status != null and query.status != ''">
|
|
AND a.status=#{query.status}
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND a.defectDate > #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} > a.defectDate
|
|
</if>
|
|
and a.FunctionType =#{query.functionType}
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamFeedBackCheck" resultType="com.xujie.sys.modules.pms.data.EamDefectFeedBackInData">
|
|
select Site,FeedBackID,FeedBackDesc,ObjectID,DefectID,Status from eam_defect_feedBack where FeedBackID=#{feedBackID} and site=#{site}
|
|
</select>
|
|
|
|
|
|
<update id="cancelFeedBack" >
|
|
update eam_defect_feedBack set status='已取消' where FeedBackID=#{feedBackID} and site=#{site}
|
|
|
|
</update>
|
|
|
|
<update id="updateFeedBack">
|
|
update eam_defect_feedBack set status='已下达',PlanOperator=#{planOperator},UpdateDate=GetDate(),UpdateBy=#{updateBy} where FeedBackID=#{feedBackID} and site=#{site}
|
|
</update>
|
|
|
|
<insert id="saveDefectOrder">
|
|
INSERT INTO eam_workOrder(Site,OrderNo,PlanID,PropertiesCode,ObjectID,Status,PlanOperator,PlanDate,FunctionType,CreateDate,CreateBy)
|
|
values( #{site}
|
|
,( select 'X'+ Right( '0000000000'+ convert(VARCHAR(10),isnull(max(convert(INT,SUBSTRING(OrderNo,3,10))),0)+1),8) from eam_workOrder where site=#{site} and FunctionType='C' )
|
|
,#{feedBackID},'',#{objectID},'未开工',#{planOperator},#{planDate},'C',GetDate(),#{userId} )
|
|
</insert>
|
|
|
|
<select id="getItemLists" resultType="com.xujie.sys.modules.pms.data.EamPropertiesItemData">
|
|
select a.itemNo,a.ItemDesc
|
|
from eam_properties_item a
|
|
left join eam_properties_model_detail b on b.function_type=#{functionType} and b.code_no=#{codeNo} and
|
|
b.properties_item_no = a.ItemNo
|
|
where a.ItemType=#{functionType} and b.code_no is null
|
|
</select>
|
|
|
|
<select id="getModelItemLists" resultType="com.xujie.sys.modules.pms.data.EamPropertiesItemData">
|
|
select a.properties_item_no itemNo,b.ItemDesc
|
|
from eam_properties_model_detail a left join eam_properties_item b on a.properties_item_no = b.ItemNo
|
|
|
|
where a.code_no=#{codeNo} and a.function_type=#{functionType}
|
|
</select>
|
|
<delete id="deleteObjectFile">
|
|
delete from sys_oss where id=#{id}
|
|
</delete>
|
|
</mapper>
|