 /**
 ** 送签单表 视图
 **/
IF EXISTS(SELECT 1 FROM sys.views WHERE name='View_ORDER_INORDER') 
   DROP VIEW View_ORDER_INORDER
GO 
CREATE VIEW View_ORDER_INORDER
AS

SELECT   dbo.ORDER_INORDER.CREATORID,dbo.ORDER_INORDER.ID AS id, dbo.ORDER_INORDER.INORDERCODE AS inOrderCode, 
                dbo.ORDER_INORDER.ORDERTYPE AS orderType, 
				dbo.ORDER_INORDER.ORDERSTATUS AS orderStatus, 
				dbo.ORDER_INORDER.OrderStatusId AS OrderStatusId, 
                dbo.ORDER_INORDER.TOTALNUM AS totalNum, dbo.ORDER_INORDER.DONENUM AS DoneNum, 
                dbo.ORDER_INORDER.UNLINENUM AS unLineNum, dbo.ORDER_INORDER.TOTALWEIGHT AS totalWeight, 
                dbo.ORDER_INORDER.UPDATETIME AS updateTime, dbo.ORDER_INORDER.ISFINISH AS isFinish, 
                dbo.ORDER_INORDER.DOTIME AS doTime, dbo.BASE_ITEM.ITEMNAME AS itemName, 
                dbo.BASE_ITEM.ITEMDES AS itemDes, dbo.BASE_ITEM.WEIGHT AS itemWeight, 
                dbo.BASE_ITEM.ITEMTYPE AS itemTYpe, dbo.BASE_ITEM.PRICE AS price, dbo.ORDER_INORDER.ENABLE AS enable, 
                dbo.BASE_ITEM.CREATELINE AS createLine, SYS_USER_1.USERNAME AS createName, 
                dbo.ORDER_INORDER.CLASSNO AS classNo, dbo.ORDER_INORDER.STATUS AS status, 
                dbo.SYS_USER.USERNAME AS checkerName, SYS_USER_2.USERNAME AS senderName,
				dbo.ORDER_INORDER.allFinishedNum,dbo.ORDER_INORDER.CheckTime,dbo.ORDER_INORDER.CheckResult
				,dbo.ORDER_INORDER.CheckRemark	,dbo.ORDER_INORDER.SendTime,dbo.ORDER_INORDER.CHECKERID,dbo.ORDER_INORDER.createTime,
SYS_USER_Update.USERNAME AS updateName
FROM      dbo.ORDER_INORDER LEFT JOIN
                dbo.SYS_USER AS SYS_USER_2 ON dbo.ORDER_INORDER.SENDERID = SYS_USER_2.ID LEFT JOIN
                dbo.SYS_USER ON dbo.ORDER_INORDER.CHECKERID = dbo.SYS_USER.ID LEFT OUTER JOIN
                dbo.SYS_USER AS SYS_USER_1 ON dbo.ORDER_INORDER.CREATORID = SYS_USER_1.ID LEFT OUTER JOIN
                dbo.BASE_ITEM ON dbo.ORDER_INORDER.ITEMID = dbo.BASE_ITEM.ID
							LEFT OUTER JOIN
                dbo.SYS_USER AS SYS_USER_Update ON dbo.ORDER_INORDER.UpdateUserId = SYS_USER_Update.ID 
   

GO



 /**
 ** 用户列表 视图
 **/
IF EXISTS(SELECT 1 FROM sys.views WHERE name='View_SYS_USER') 
   DROP VIEW View_SYS_USER
GO 
CREATE VIEW View_SYS_USER
AS

SELECT   dbo.SYS_USER.ID AS id, dbo.SYS_USER.USERNAME AS userName, 
                dbo.SYS_USER.USERTRUENAME AS userTrueName, dbo.SYS_USER.PASSWORD AS passWord, 
                dbo.SYS_ROLE.ROLENAME AS roleName, dbo.SYS_USER.ENABLE AS enable, 
                dbo.SYS_USER.UPDATETIME AS updateTime, dbo.SYS_DEPT.DEPTNAME AS deptName, 
                SYS_USER_1.USERNAME AS createName,dbo.SYS_USER.IsWeldingAuditGroup
FROM      dbo.SYS_DEPT RIGHT OUTER JOIN
                dbo.SYS_USER AS SYS_USER_1 RIGHT OUTER JOIN
                dbo.SYS_USER ON SYS_USER_1.ID = dbo.SYS_USER.CREATORID ON 
                dbo.SYS_DEPT.ID = dbo.SYS_USER.DEPTID LEFT OUTER JOIN
                dbo.SYS_ROLE LEFT OUTER JOIN
                dbo.SYS_USER_VS_ROLE ON dbo.SYS_ROLE.ID = dbo.SYS_USER_VS_ROLE.ROLEID ON 
                dbo.SYS_USER.ID = dbo.SYS_USER_VS_ROLE.USERID
   

GO



