|
楼主 |
发表于 2015-3-20 09:30:48
|
显示全部楼层
本帖最后由 chaierkid 于 2015-3-20 09:34 编辑
SELECT tabWBSItem.*,tabItemNotation.fWBSItemID as fWBSItemID,tabItemNotation.fNotationInfo as fNotationInfo,tabItemNotation.fNotationName as fNotationName,tabWBSItemState,tabWBSItemState.sProcessState as sProcessState,tabWBSItemState.sExamineState as sExamineState,tabWBSItemState.sAttentionLevel as sAttentionLevel,tabWBSItemState.sImportDegree as sImportDegree,tabWBSItem as tabWBSItem1,tabWBSItem.version as version,tabWBSItem.fItemName as fItemName,tabWBSItem.fInstruction as fInstruction,tabWBSItem.fMissionPrincipal as fMissionPrincipal,tabWBSItem.fMissionMinitor as fMissionMinitor,tabWBSItem.fExamineState as fExamineState,tabWBSItem.fStartDate as fStartDate,tabWBSItem.festimatedFinishDate as festimatedFinishDate,tabWBSItem.fEndDate as fEndDate,tabWBSItem.fProcessState as fProcessState,tabWBSItem.fProcessInstruction as fProcessInstruction,tabWBSItem.fCreateTime as fCreateTime,tabWBSItem.fEditTime as fEditTime,tabWBSItem.fIsDelete as fIsDelete,tabWBSItem.fIsShow as fIsShow,tabWBSItem.fState as fState,tabWBSItem.fDescription as fDescription,tabWBSItem.fParentNode as fParentNode,tabWBSItem.fChildNode as fChildNode,tabWBSItem.fNodeType as fNodeType,tabWBSItem.fLevel as fLevel,tabWBSItem.fExamineInfo as fExamineInfo,tabWBSItem.fAttentionLevel as fAttentionLevel,tabWBSItem.fImportDegree as fImportDegree,tabWBSItem.fNotationImage as fNotationImage,tabWBSItem.fCreateItemPerson as fCreateItemPerson,tabWBSItem.fUpdateField as fUpdateField,case when fExamineState + fProcessState = 8 then '已完成' when fStartDate is null AND festimatedFinishDate is null then '正常' when :currentDate() > festimatedFinishDate then '已过期' when fStartDate = festimatedFinishDate then '快过期' when ( ( getYear(festimatedFinishDate) - getYear(:currentDate()) ) * 365 + ( getMonth(festimatedFinishDate) - getMonth(:currentDate()) ) * 30 + ( getDay(festimatedFinishDate) - getDay(:currentDate()) ) ) * 1.0 / ( ( getYear(festimatedFinishDate) - getYear(fStartDate) ) * 365 + ( getMonth(festimatedFinishDate) - getMonth(fStartDate) ) * 30 + ( getDay(festimatedFinishDate) - getDay(fStartDate) ) ) <= 0.2 then '快过期' else '正常' end as fImage FROM tabWBSItem tabWBSItem optional join tabItemNotation tabItemNotation on tabItemNotation.fWBSItemID = tabWBSItem optional join tabWBSItemState tabWBSItemState on tabWBSItemState.fWBSItemId = tabWBSItem WHERE ( not tabWBSItem in ('_is_root_8090F41FCAB54BF19E8201CD0258A7D6') ) AND ((tabWBSItem.fIsDelete = 0 and tabWBSItem.fIsShow = 1) AND (fParentNode is null)) ORDER BY fCreateTime ASC |
|