• 点评删除和编辑


    ALTER PROC [dbo].[PTS_DeleteOrUpdateWorkRemark]
    @ID int,
    @UserName nvarchar(50),
    @CommondType int,
    @RemarkScore float,
    @Remark text
    AS
    BEGIN
        DECLARE @ReportOwn nvarchar(50),@Reviewer nvarchar(50),@TempCount int,@UpLeader1 nvarchar(50),@UpLeader2 nvarchar(50)
        SET @TempCount=0;
        SELECT @ReportOwn=UserName FROM PTS_WorkRemark INNER JOIN PTS_WorkReport ON PTS_WorkRemark.ReportID=PTS_WorkReport.ID
        WHERE PTS_WorkRemark.ID=@ID;
        SELECT @Reviewer=Reviewer FROM PTS_WorkRemark WHERE ID=@ID;
        BEGIN
            IF @Reviewer<>@UserName
                SELECT 11;    --不是自己的点评,不能操作
            ELSE IF @ReportOwn=@UserName
                SELECT 1;    --自评不能操作
            ELSE
                BEGIN
                    SELECT @UpLeader1=Name from person where Name in(select superior FROM subgroup WHERE junior=@UserName
                    and treelevel=1) and Coding in (1,2);
                    SELECT @UpLeader2=Name from person where Name in(select superior FROM subgroup WHERE junior=@UpLeader1
                    and treelevel=1) and Coding in (1,2);
                    SELECT @TempCount=Count(1) FROM PTS_WorkRemark WHERE Reviewer IN(ISNULL(@UpLeader1,'NULL'),ISNULL(@UpLeader2,'NULL'))
                    and ReportID=(SELECT ReportID FROM PTS_WorkRemark WHERE ID=@ID)
                    IF @TempCount>0
                        BEGIN
                            SELECT 2;        ---上级领导已评,不能操作
                        END
                    ELSE
                        BEGIN
                            IF @CommondType=0
                                BEGIN
                                    DELETE FROM PTS_WorkRemark WHERE ID=@ID
                                    IF @@ERROR<>0
                                        SELECT 3;  --删除失败
                                    ELSE
                                        SELECT 4;  --删除成功
                                END
                            ELSE IF @CommondType=1
                                BEGIN
                                    IF @RemarkScore=-1
                                        SELECT 5;    --可以编辑
                                    ELSE
                                        BEGIN
                                            UPDATE PTS_WorkRemark SET RemarkScore=@RemarkScore,Remark=@Remark WHERE ID=@ID
                                            IF @@ERROR<>0
                                                SELECT 6   --编辑失败
                                            ELSE
                                                SELECT 7   --编辑成功
                                        END
                                END
                        END
                END
        END
    END
  • 相关阅读:
    C#的注释
    为知笔记发布到博客,css设置
    eclipse创建springboot项目的三种方法
    创建maven父项目以及子项目
    C# 快捷键(总结)
    idea 项目转 eclipse项目
    freemarker常见语法大全
    Spring Boot Freemarker特别篇之contextPath【从零开始学Spring Boot
    Spring mvc请求处理流程详解(一)之视图解析
    React+SpringBoot项目部署
  • 原文地址:https://www.cnblogs.com/kedarui/p/3584237.html
Copyright © 2020-2023  润新知