1. 【强制】在存储过程中所有的重命名使用一下规范,在所有的命名上需要使用[]将重命名的部分框起来,将变量按照功能进行划分,并进行注释
~~~
SELECT
[ProjectCaseStepPointAID] = ISNULL(PFile.ProjectCaseStepPointAID, -1)
,[MyFileAID] = ISNULL(PFile.FileAID, 0)
,[ProjectStepPointFileAID] = PSPF.AID
,[模板文件名] = F1.Name
,[上传文件名] = PFile.name
--【显示】
,[文件名称] = PSPF.Memo
,[文件模板] = F1.Path
,[我上传的文件] = PFile.Path
--【控制】
,[CanInsert] = CASE WHEN @UserOK = @UserAID THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END
FROM ProjectStepPointFile AS PSPF
INNER JOIN Files AS F1 ON F1.AID = PSPF.FileAID
LEFT JOIN (
SELECT PCSPF.ProjectCaseStepPointAID
,PCSPF.ProjectStepPointFileAID
,PCSPF.FileAID
,F2.Path
,F2.Name
FROM ProjectCaseStepPointFile AS PCSPF
INNER JOIN Files AS F2 ON F2.AID = PCSPF.FileAID
WHERE PCSPF.ProjectCaseStepPointAID = @ProjectCaseStepPointAID
) AS PFile ON PFile.ProjectStepPointFileAID = PSPF.AID
WHERE PSPF.ProjectStepPointAID = (
SELECT t1.ProjectStepPointAID
FROM ProjectCaseStepPoint AS t1
WHERE t1.AID = @ProjectCaseStepPointAID
)
~~~
2. 【强制】注释不能写英文,不能写语法注释,只能写业务或者逻辑注释,模块前的第一行必须写这个模块的注释,不能使用SELECT *,常量必须定义在最顶部
3. 【强制】在存储过程中关键词的大小写规范上,只能使用同一种风格,要不全部大写,要不全部小写,严禁混用
~~~
正确:SELECT * FROM Users AS U WHERE U.Name LIKE '%云南易用软件%'
错误:SELECT * FROM Users as u WHERE u.sex = 1
~~~