Пример #1
0
 def reset(self, userId, currentAuth):
     """
     重置用户密码 111111
     """
     count = 0
     try:
         besql = """
             SELECT 1 FROM man_auth_user
             WHERE USER_ID='{}'
             AND USER_PWD='96e79218965eb72c92a549dd5a330112';
             """.format(userId)
         res = PySQL.execute(besql)
         if res > 0:
             Utils.log('愿密码已为默认值')
             return True
         sql = """
             UPDATE man_auth_user
             SET USER_PWD=Default
             WHERE USER_ID='{}'
             AND USER_AUTH >= '{}';
             """.format(userId, currentAuth)
         Utils.log(sql)  # print log
         count = PySQL.execute(sql)
         print(count)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #2
0
 def status(self, bugId, status, currentUser):
     """
     查询调试记录列表
     """
     try:
         bugSQL = """
             UPDATE man_pro_bug
             SET
                 BUG_STATUS='{status}',
                 HANDLE_BY='{handleBy}',
                 HANDLE_TIME='{handleTime}'
             WHERE BUG_ID='{bugId}';
             """.format(status='created' if status == 'reset' else status,
                        handleBy=currentUser,
                        handleTime=Utils.getLocalTime(),
                        bugId=bugId)
         recordSQL = """
             INSERT INTO man_bug_record(
                 ID,
                 BUG_ID,
                 BUG_STATUS,
                 HANDLE_BY,
                 HANDLE_TIME
             )VALUES(
                 '{}','{}','{}','{}','{}'
             );
             """.format(Utils.makeId(), bugId, status, currentUser,
                        Utils.getLocalTime())
         Utils.log('更新问题状态SQL', bugSQL)
         Utils.log('插入调试记录SQL', recordSQL)
         return PySQL.execute(bugSQL) > 0 and PySQL.execute(recordSQL) > 0
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
         return False
Пример #3
0
 def list(self, page, size, proName, userName, modName, limitTime,
          currentUser):
     """
     查询分配任务记录
     """
     start = (int(page) - 1) * int(size)
     try:
         sql = """
             SELECT task.*, member.PRO_NAME, member.USER_NAME
             FROM man_pro_task AS task
                 LEFT JOIN man_pro_member AS member
                 ON task.PRO_ID = member.PRO_ID
                 AND task.USER_ID = member.USER_ID
             WHERE 1=1
             {}{}{}{}{}
             ORDER BY MODULE_END ASC, CREATE_TIME DESC
             LIMIT {start}, {size};
             """.format(
             ' AND PRO_NAME like "%{}%"'.format(proName) if proName else '',
             ' AND USER_NAME like "%{}%"'.format(userName)
             if userName else '',
             ' AND MODULE_NAME like "%{}%"'.format(modName)
             if modName else '',
             ' AND MODULE_END <= "{}"'.format(limitTime)
             if limitTime else '',
             ' AND USER_CREATOR = "{}"'.format(currentUser)
             if currentUser else '',
             start=start,
             size=size)
         Utils.log('查询数据库任务列表SQL', sql)
         list = PySQL.get(sql)
         sqlTotal = """
             SELECT COUNT(1)
             FROM man_pro_task AS task
                 LEFT JOIN man_pro_member AS member
                 ON task.PRO_ID = member.PRO_ID
                 AND task.USER_ID = member.USER_ID
             WHERE 1=1
             {}{}{}{}{}
             """.format(
             ' AND PRO_NAME like "%{}%"'.format(proName) if proName else '',
             ' AND USER_NAME like "%{}%"'.format(userName)
             if userName else '',
             ' AND MODULE_NAME = "{}"'.format(modName) if modName else '',
             ' AND MODULE_END <= "{}"'.format(limitTime)
             if limitTime else '',
             ' AND USER_CREATOR = "{}"'.format(currentUser)
             if currentUser else '',
         )
         total = PySQL.count(sqlTotal)
         return list, total
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
         return [], 0
Пример #4
0
    def getList(self, page, size, proId, userCreator, userId, userName):
        """
        查询数据库 user 列表
        """
        start = (int(page) - 1) * int(size)
        try:
            sql = """
                SELECT user.*
                FROM man_auth_user AS user
                WHERE (user.USER_CREATOR='{userCreator}' OR user.USER_ID='{userCreator}')
                {id}{name}
                AND user.USER_ID NOT IN (
                    SELECT member.USER_ID
                    FROM man_pro_member AS member
                    WHERE member.USER_CREATOR='{userCreator}'
                    AND member.PRO_ID='{proId}'
                )
                ORDER BY USER_ID
                LIMIT {start}, {size};
                """.format(
                userCreator=userCreator,
                proId=proId,
                id=' AND USER_ID like "%{}%"'.format(userId) if userId else '',
                name=' AND USER_NAME like "%{}%"'.format(userName)
                if userName else '',
                start=start,
                size=size)

            sqlTotal = """
                SELECT COUNT(1)
                FROM man_auth_user AS user
                WHERE (user.USER_CREATOR='{userCreator}' OR user.USER_ID='{userCreator}')
                {id}{name}
                AND user.USER_ID NOT IN (
                    SELECT member.USER_ID
                    FROM man_pro_member AS member
                    WHERE member.USER_CREATOR='{userCreator}'
                    AND member.PRO_ID='{proId}'
                )
                ORDER BY USER_ID;
                """.format(
                userCreator=userCreator,
                proId=proId,
                id=' AND USER_ID like "%{}%"'.format(userId) if userId else '',
                name=' AND USER_NAME like "%{}%"'.format(userName)
                if userName else '')
            Utils.log('查询项目成员列表 {}'.format(sql))
            list = PySQL.get(sql)
            total = PySQL.count(sqlTotal)
            return list, total
        except Exception as e:
            print('ERROR {}'.format(e))
            Utils.log('ERROR {}'.format(e))
            return [], 0
Пример #5
0
 def getList(self, page, size, userId, userName, userAuth, userLogin,
             userCreator):
     """
     查询数据库用户列表
     """
     start = (int(page) - 1) * int(size)
     try:
         sql = """
             SELECT USER_ID,USER_NAME,USER_AUTH,USER_LOGIN,USER_CREATOR,USER_CRE_TIME
             FROM man_auth_user
             WHERE 1=1
             {}{}{}{}{}{}
             ORDER BY USER_AUTH, USER_ID
             LIMIT {start}, {size};
             """.format(
             ' AND USER_ID like "%{}%"'.format(userId) if userId else '',
             ' AND USER_Name like "%{}%"'.format(userName)
             if userName else '',
             ' AND USER_AUTH = "{}"'.format(userAuth) if userAuth else '',
             ' AND USER_LOGIN = "******"'.format(userLogin)
             if userLogin else '',
             ' AND USER_CREATOR = "{}"'.format(userCreator)
             if userCreator and userCreator != 'admin' else '',
             ' OR USER_ID = "{}"'.format(userCreator)
             if userCreator and userCreator != 'admin' else '',
             start=start,
             size=size)
         Utils.log('查询数据库用户列表SQL', sql)
         list = PySQL.get(sql)
         sqlTotal = """
             SELECT COUNT(1) FROM man_auth_user
             WHERE 1=1
             {}{}{}{}{}{};
             """.format(
             ' AND USER_ID like "%{}%"'.format(userId) if userId else '',
             ' AND USER_Name like "%{}%"'.format(userName)
             if userName else '',
             ' AND USER_AUTH = "{}"'.format(userAuth) if userAuth else '',
             ' AND USER_LOGIN = "******"'.format(userLogin)
             if userLogin else '',
             ' AND USER_CREATOR = "{}"'.format(userCreator)
             if userCreator and userCreator != 'admin' else '',
             ' OR USER_ID = "{}"'.format(userCreator)
             if userCreator and userCreator != 'admin' else '',
         )
         total = PySQL.count(sqlTotal)
         return list, total
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
         return [], 0
Пример #6
0
 def getInfo(self, page, size, proId, userId, userName):
     """
     查询数据库 project-user 列表
     """
     start = (int(page) - 1) * int(size)
     try:
         sql = """
             SELECT mem.*, task.MODULE_ID, task.MODULE_NAME
             FROM man_pro_member AS mem
             LEFT JOIN man_pro_task AS task
             ON mem.PRO_ID = task.PRO_ID
             AND mem.USER_ID = task.USER_ID
             WHERE mem.PRO_ID='{proId}'
             {id}{name}
             ORDER BY mem.USER_ID
             LIMIT {start}, {size};
             """.format(
             proId=proId,
             id=' AND mem.USER_ID like "%{}%"'.format(userId)
             if userId else '',
             name=' AND mem.USER_NAME like "%{}%"'.format(userName)
             if userName else '',
             start=start,
             size=size)
         sqlTotal = """
             SELECT COUNT(1)
             FROM man_pro_member AS mem
             LEFT JOIN man_pro_task AS task
             ON mem.PRO_ID = task.PRO_ID
             AND mem.USER_ID = task.USER_ID
             WHERE mem.PRO_ID='{proId}'
             {id}{name}
             ORDER BY mem.USER_ID
             LIMIT {start}, {size};
             """.format(
             proId=proId,
             id=' AND mem.USER_ID like "%{}%"'.format(userId)
             if userId else '',
             name=' AND mem.USER_NAME like "%{}%"'.format(userName)
             if userName else '',
             start=start,
             size=size)
         list = PySQL.get(sql)
         total = PySQL.count(sqlTotal)
         Utils.log('查询项目成员负责模块 {}'.format(sql))
         return list, total
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
         return [], 0
Пример #7
0
 def insert(self, proId, proName, modId, modName, bugTitle, bugLevel,
            bugDes, userId, currentUser):
     """
     添加新建问题记录
     """
     count = 0
     try:
         bugId = Utils.makeId()
         sql = """
             INSERT INTO man_pro_bug(
                 BUG_ID,
                 PRO_ID,
                 PRO_NAME,
                 MODULE_ID,
                 MODULE_NAME,
                 BUG_TITLE,
                 BUG_LEVEL,
                 BUG_DES,
                 CREATE_BY,
                 CREATE_TIME,
                 HANDLE_BY,
                 HANDLE_TIME
             )VALUES(
                 '{}','{}','{}','{}','{}','{}','{}','{}','{}','{}','{}','{}'
             );
             """.format(bugId, proId, proName, modId, modName, bugTitle,
                        bugLevel, bugDes, currentUser, Utils.getLocalTime(),
                        userId if userId else currentUser,
                        Utils.getLocalTime())
         recordSQL = """
             INSERT INTO man_bug_record(
                 ID,
                 BUG_ID,
                 BUG_STATUS,
                 HANDLE_BY,
                 HANDLE_TIME
             )VALUES(
                 '{}','{}','{}','{}','{}'
             );
             """.format(Utils.makeId(), bugId, 'created', currentUser,
                        Utils.getLocalTime())
         Utils.log('打印新建问题SQL', sql)  # print log
         count = PySQL.execute(sql)
         PySQL.execute(recordSQL)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #8
0
 def append(self, proId, proName, userCreator, allUsers):
     """
     添加 project 记录
     """
     count = 0
     try:
         tmp = []
         for u in allUsers:
             tmp.append("('{}','{}','{}','{}','{}')".format(
                 proId, proName, u['userId'], u['userName'], userCreator))
         t = ",".join(tmp)
         Utils.log(t)
         sql = """
             INSERT INTO man_pro_member(
                 PRO_ID,
                 PRO_NAME,
                 USER_ID,
                 USER_NAME,
                 USER_CREATOR
             )VALUES
             {};
             """.format(t)
         Utils.log('打印创建项目SQL', sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #9
0
 def insert(self, proId, userId, modId, modName, modDes, modStart, modEnd):
     """
     添加分配任务记录
     """
     count = 0
     try:
         sql = """
             INSERT INTO man_pro_task(
                 PRO_ID,
                 USER_ID,
                 MODULE_ID,
                 MODULE_NAME,
                 MODULE_DES,
                 MODULE_START,
                 MODULE_END,
                 CREATE_TIME
             )VALUES(
                 '{}','{}','{}','{}','{}','{}','{}','{}'
             );
             """.format(proId, userId, modId, modName, modDes, modStart,
                        modEnd, Utils.getLocalTime())
         Utils.log('打印创建项目SQL', sql)
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #10
0
 def insert(self, proName, proType, proUse, proDes, userCreator):
     """
     添加 project 记录
     """
     count = 0
     try:
         sql = """
             INSERT INTO man_pro_info(
                 PRO_ID,
                 PRO_NAME,
                 PRO_TYPE,
                 PRO_LEADER,
                 PRO_USE,
                 PRO_CRE_TIME,
                 PRO_DES
             )VALUES(
                 '{}','{}','{}','{}','{}','{}','{}'
             );
             """.format(self.makeProId(), proName, proType, userCreator,
                        proUse, Utils.getLocalTime(), proDes)
         Utils.log('打印创建项目SQL', sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #11
0
 def insert(self, userId, userName, userAuth, userLogin, userCreator):
     """
     添加用户记录
     """
     count = 0
     try:
         sql = """
             INSERT INTO man_auth_user(
                 USER_ID,
                 USER_NAME,
                 USER_AUTH,
                 USER_LOGIN,
                 USER_CREATOR,
                 USER_CRE_TIME
             )VALUES(
                 '{}','{}','{}','{}','{}','{}'
             );
             """.format(userId, userName, userAuth, userLogin, userCreator,
                        Utils.getLocalTime())
         Utils.log('添加用户记录SQL', sql)
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #12
0
 def inset(self, fileName, projectId, projectName, uploadBy):
     """
     上传文件信息入库
     """
     count = 0
     try:
         sql = """
             INSERT INTO man_pro_file(
                 ID,
                 FILE_NAME,
                 PRO_ID,
                 PRO_NAME,
                 UPLOAD_BY,
                 UPLOAD_TIME
             )VALUES(
                 '{}','{}','{}','{}','{}','{}'
             );
             """.format(Utils.makeId(), fileName, projectId, projectName,
                        uploadBy, Utils.getLocalTime())
         Utils.log('打印上传文件信息入库SQL', sql)
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #13
0
 def checkLogin(self, id, pwd):
     """
     检查登录信息,验证账户密码是否正确
     """
     try:
         sql = "SELECT * FROM man_auth_user WHERE USER_LOGIN='******' AND USER_ID='{0}' AND USER_PWD='{1}';".format(
             id, pwd)
         sqlTotal = "SELECT COUNT(1) FROM man_auth_user WHERE USER_LOGIN='******' AND USER_ID='{0}' AND USER_PWD='{1}';".format(
             id, pwd)
         list = PySQL.get(sql)
         total = PySQL.count(sqlTotal)
         return list, total
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
         return [], 0
Пример #14
0
 def list(self, page, size, proName, fileName, uploadStart, uploadEnd,
          userCreator):
     """
     查询上传服务器的文件列表
     """
     start = (int(page) - 1) * int(size)
     try:
         sql = """
             SELECT file.*, CONCAT( '{downPath}', file.FILE_NAME ) AS FILE_URL
             FROM man_pro_file AS file
             WHERE 1=1
             {}{}{}
             ORDER BY UPLOAD_TIME DESC
             LIMIT {start}, {size};
             """.format(
             ' AND PRO_Name like "%{}%"'.format(proName) if proName else '',
             ' AND FILE_NAME like "%{}%"'.format(fileName)
             if fileName else '',
             ' AND UPLOAD_TIME BETWEEN "{}" AND "{}"'.format(
                 uploadStart, uploadEnd)
             if uploadStart and uploadEnd else '',
             downPath=DOWNLOAD_HOST,
             start=start,
             size=size)
         sqlTotal = """
             SELECT COUNT(1)
             FROM man_pro_file AS file
             WHERE 1=1
             {}{}{}
             ORDER BY UPLOAD_TIME DESC;
             """.format(
             ' AND PRO_Name like "%{}%"'.format(proName) if proName else '',
             ' AND FILE_NAME like "%{}%"'.format(fileName)
             if fileName else '',
             ' AND UPLOAD_TIME BETWEEN "{}" AND "{}"'.format(
                 uploadStart, uploadEnd)
             if uploadStart and uploadEnd else '',
         )
         Utils.log('查询数据库上传服务器的文件列表SQL', sql)
         list = PySQL.get(sql)
         total = PySQL.count(sqlTotal)
         return list, total
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
         return [], 0
Пример #15
0
 def getList(self, page, size, proId, proName, proType, proUse,
             userCreator):
     """
     查询数据库 project 列表
     """
     start = (int(page) - 1) * int(size)
     try:
         sql = """
             SELECT info.*,type.TYPE_TEXT
             FROM man_pro_info AS info, man_pro_type AS type
             WHERE info.PRO_TYPE=type.TYPE_ID
             {}{}{}{}{}
             ORDER BY PRO_ID
             LIMIT {start}, {size};
             """.format(
             ' AND PRO_ID like "%{}%"'.format(proId) if proId else '',
             ' AND PRO_Name like "%{}%"'.format(proName) if proName else '',
             ' AND PRO_TYPE = "{}"'.format(proType) if proType else '',
             ' AND PRO_USE = "{}"'.format(proUse) if proUse else '',
             ' AND PRO_LEADER = "{}"'.format(userCreator)
             if userCreator else '',
             start=start,
             size=size)
         Utils.log('查询数据库 project 列表SQL', sql)
         list = PySQL.get(sql)
         sqlTotal = """
             SELECT COUNT(1)
             FROM man_pro_info AS info, man_pro_type AS type
             WHERE info.PRO_TYPE=type.TYPE_ID
             {}{}{}{}{}
             ORDER BY PRO_ID;
             """.format(
             ' AND PRO_ID like "%{}%"'.format(proId) if proId else '',
             ' AND PRO_NAME like "%{}%"'.format(proName) if proName else '',
             ' AND PRO_TYPE = "{}"'.format(proType) if proType else '',
             ' AND PRO_USE = "{}"'.format(proUse) if proUse else '',
             ' AND PRO_LEADER = "{}"'.format(userCreator)
             if userCreator else '')
         total = PySQL.count(sqlTotal)
         return list, total
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
         return [], 0
Пример #16
0
 def valid(self, proId):
     """
     校验项目是否已分配成员和模块
     """
     count = 0
     try:
         userSQl = """
             SELECT 1 from man_pro_member
             WHERE PRO_ID='{proId}';
             """.format(proId=proId)
         moduleSQL = """
             SELECT 1 from man_pro_module
             WHERE PRO_ID='{proId}';
             """.format(proId=proId)
         count = 1 if PySQL.execute(userSQl) > 0 or PySQL.execute(
             moduleSQL) > 0 else 0
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #17
0
 def getList(self):
     """
     查询 projec type 列表
     """
     try:
         sql = "SELECT CONVERT(TYPE_ID, char) AS TYPE_ID, TYPE_TEXT FROM man_pro_type;"
         list = PySQL.get(sql)
         return list
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
         return []
Пример #18
0
 def updatePwd(self, id, pwd, new):
     """
     检查登录信息,修改账户密码
     """
     try:
         sql = "UPDATE man_auth_user SET USER_PWD='{2}' WHERE USER_ID='{0}' AND USER_PWD='{1}';".format(
             id, pwd, new)
         return PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
         return 0
Пример #19
0
 def record(self, page, size, currentUserr):
     """
     查询调试记录列表
     """
     start = (int(page) - 1) * int(size)
     try:
         sql = """
             SELECT record.*,
                 bug.PRO_NAME, bug.MODULE_NAME, bug.BUG_TITLE, bug.BUG_LEVEL, bug.BUG_DES
             FROM man_bug_record AS record
                 LEFT JOIN man_pro_bug AS bug
                 ON record.BUG_ID = bug.BUG_ID
             WHERE bug.PRO_ID IN (
             	SELECT DISTINCT member.PRO_ID
                 FROM man_pro_member AS member
                 WHERE member.USER_ID = '{userId}'
             )
             ORDER BY HANDLE_TIME DESC
             LIMIT {start}, {size};
             """.format(userId=currentUserr, start=start, size=size)
         sqlTotal = """
             SELECT COUNT(1)
             FROM man_bug_record AS record
                 LEFT JOIN man_pro_bug AS bug
                 ON record.BUG_ID = bug.BUG_ID
             WHERE bug.PRO_ID IN (
             	SELECT DISTINCT member.PRO_ID
                 FROM man_pro_member AS member
                 WHERE member.USER_ID = '{userId}'
             );
             """.format(userId=currentUserr)
         Utils.log('查询问题列表SQL', sql)
         list = PySQL.get(sql)
         total = PySQL.count(sqlTotal)
         return list, total
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
         return [], 0
Пример #20
0
 def validInsert(self, userId):
     """
     检查用户名是否存在
     """
     count = 0
     try:
         sql = """
             SELECT COUNT(1) FROM man_auth_user
             WHERE USER_ID="{}";
             """.format(userId)
         count = PySQL.count(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #21
0
 def delete(self, modId):
     """
     删除任务进度
     """
     count = 0
     try:
         sql = """
             DELETE FROM man_pro_rate
             WHERE MODULE_ID='{}';
             """.format(modId)
         Utils.log(sql)
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #22
0
 def delete(self, fileId, userCreator):
     """
     删除文件
     """
     count = 0
     try:
         sql = """
             DELETE FROM man_pro_file
             WHERE ID='{}';
             """.format(fileId)
         Utils.log("删除项目文件", sql)
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #23
0
 def delete(self, proId):
     """
     删除 project 记录
     """
     count = 0
     try:
         sql = """
             DELETE FROM man_pro_info
             WHERE PRO_ID='{}';
             """.format(proId)
         Utils.log(sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #24
0
 def valid(self, proId, userId):
     """
     校验成员是否已分配任务
     """
     count = 0
     try:
         SQL = """
             SELECT 1 FROM man_pro_task
             WHERE PRO_ID='{proId}'
             AND USER_ID='{userId}';
             """.format(proId=proId, userId=userId)
         Utils.log('打印校验成员SQL', SQL)  # print log
         count = PySQL.execute(SQL)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #25
0
 def delete(self, userId, currentAuth):
     """
     删除用户记录
     """
     count = 0
     try:
         sql = """
             DELETE FROM man_auth_user
             WHERE USER_ID='{}'
             AND USER_AUTH > '{}';
             """.format(userId, currentAuth)
         Utils.log(sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #26
0
 def remove(self, proId, userId):
     """
     移除成员信息, 如果已分配任务则不能移除
     """
     count = 0
     try:
         sql = """
             DELETE FROM man_pro_member
             WHERE PRO_ID='{proId}'
             AND USER_ID='{userId}';
             """.format(proId=proId, userId=userId)
         Utils.log('打印移除成员SQL', sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #27
0
    def getListAll(self, proId):
        """
        查询数据库所属项目成员列表
        """
        try:
            sql = """
                SELECT USER_ID, USER_NAME
                FROM man_pro_member
                WHERE PRO_ID='{proId}'
                ORDER BY USER_NAME ASC;
                """.format(proId=proId)

            list = PySQL.get(sql)
            return list
        except Exception as e:
            print('ERROR {}'.format(e))
            Utils.log('ERROR {}'.format(e))
            return []
Пример #28
0
 def query(self, proId, userId):
     """
     查询数据库项目模块列表
     """
     try:
         sql = """
             SELECT task.MODULE_ID, task.MODULE_NAME
             FROM man_pro_task AS task
             WHERE task.PRO_ID='{}'
             ORDER BY CREATE_TIME;
             """.format(proId)
         Utils.log('查询数据库项目模块列表SQL', sql)
         list = PySQL.get(sql)
         return list
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
         return []
Пример #29
0
 def update(self, proId, proType, proUse, proDes):
     """
     修改 project 记录
     """
     count = 0
     try:
         sql = """
             UPDATE man_pro_info SET 
                 PRO_TYPE='{}',
                 PRO_USE='{}',
                 PRO_DES='{}'
             WHERE PRO_ID='{}';
             """.format(proType, proUse, proDes, proId)
         Utils.log(sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
Пример #30
0
 def update(self, userId, userName, userAuth, userLogin, currentAuth):
     """
     修改用户记录
     """
     count = 0
     try:
         sql = """
             UPDATE man_auth_user SET
                 USER_NAME='{}',
                 USER_AUTH='{}',
                 USER_LOGIN='******'
             WHERE USER_ID='{}'
             AND USER_AUTH > '{}';
             """.format(userName, userAuth, userLogin, userId, currentAuth)
         Utils.log(sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0