def GetDepartmentListJson(): data = {'Tag': 0, "Message": "", "Data": ""} if id != '': data["Tag"] = 1 data["Message"] = "操作成功" DepartName = request.args.get("DepartmentName") filterList = ConditionQuery.queryList( x1={Department.DepartName: DepartName}) QueryList = [ Department.Id, Department.CreateUserid, Department.CreateTime, Department.ModifyTime, Department.Status, Department.DepartName, User.UserName ] menu = Department.query.join(User,User.Id == Department.User_id).\ with_entities(*QueryList).filter(*filterList).all() tempList = ConditionQuery.List_to_dicList(QueryList, menu) data["Data"] = tempList return jsonify(data)
def GetPositionTwoJson(): data = {'Tag': 0, "Message": "", "Data": ""} if id != '': data["Tag"] = 1 data["Message"] = "操作成功" QueryList = [Position.Id,Position.PositionName] menu = Position.query.with_entities(*QueryList).all() tempList = ConditionQuery.List_to_dicList(QueryList, menu) data["Data"] = tempList return jsonify(data)
def GetRoleJson(): data = {'Tag': 0, "Message": "", "Data": ""} id = request.args.get("id") if id != '': data["Tag"] = 1 data["Message"] = "操作成功" QueryList=[Role.Id,Role.Name] RoleList=Role.query.with_entities(*QueryList).all() data["Data"] = ConditionQuery.List_to_dicList(QueryList,RoleList) return jsonify(data)
def GetUserTwoJson(): data = {'Tag': 0, "Message": "", "Data": ""} if id != '': data["Tag"] = 1 data["Message"] = "操作成功" QueryList = [User.Id, User.RealName] menu = User.query.with_entities(*QueryList).all() tempList = ConditionQuery.List_to_dicList(QueryList, menu) for item in tempList: item["name"] = item.pop("RealName") item["id"] = item.pop("Id") data["Data"] = tempList return jsonify(data)
def GetUsersListJson(): data={'Tag': 0,"Message":"","Data":""} if id!='': data["Tag"]=1 data["Message"]="操作成功" page = request.args.get("pageIndex",type=int) per_page = request.args.get("pageSize",type=int) username = request.args.get("UserName") userphone = request.args.get("UserPhone") userstatus =request.args.get("UserStatus") StartTime = request.args.get("StartTime") EndTime = request.args.get("EndTime") filterList = ConditionQuery.queryList(x1={User.UserName:username},x2={User.Mobile:userphone}, x3={User.Status:userstatus},x4={User.ModifyTime:[StartTime,EndTime]}) QueryList = [User.Id, User.CreateTime,User.RealName, Department.DepartName,User.Mobile,User.Status, User.UserName] menu = User.query.join(Department, User.DepartmentId == Department.Id). \ with_entities(*QueryList).filter(*filterList).paginate(page,per_page) tempList = ConditionQuery.List_to_dicList(QueryList, menu.items) data["Total"]=menu.pages data["Data"] = tempList return jsonify(data)
def GetPositionListJson(): data = {'Tag': 0, "Message": "", "Data": ""} page = request.args.get("pageIndex", type=int) per_page = request.args.get("pageSize", type=int) if id != '': data["Tag"] = 1 data["Message"] = "操作成功" PositionName = request.args.get("PositionName") filterList = ConditionQuery.queryList( x1={Position.PositionName: PositionName}) menu = Position.query.filter(*filterList).paginate(page, per_page) data["Total"] = menu.pages data["Data"] = to_json(menu.items) return jsonify(data)
def GetPositionFormJson(): id = request.args.get("id") data = {'Tag': 0, "Message": "", "Data": ""} if id != '': data["Tag"] = 1 data["Message"] = "操作成功" QueryList = [ Position.Id, Position.PositionName, Position.PositionSort, Position.Status, Position.Remark ] menu = Position.query.with_entities(*QueryList).filter( Position.Id == id).all() tempList = ConditionQuery.List_to_dicList(QueryList, menu) tempList[0]["PositionStatus"] = tempList[0].pop("Status") data["Data"] = tempList[0] return jsonify(data)
def GetDepartFormJson(): id = request.args.get("id") data = {'Tag': 0, "Message": "", "Data": ""} if id != '': data["Tag"] = 1 data["Message"] = "操作成功" QueryList = [ Department.Id, Department.CreateUserid, Department.CreateTime, Department.ModifyTime, Department.ModifyUserid, Department.Status, Department.DepartName, Department.ParentId, Department.DepartSort, Department.Email, User.UserName, Department.Fax, Department.Mobile, Department.Remarks, Department.User_id ] menu = Department.query.join(User, User.Id == Department.User_id). \ with_entities(*QueryList).filter(Department.Id == id).all() tempList = ConditionQuery.List_to_dicList(QueryList, menu) tempList[0]["PrincipalId"] = tempList[0].pop("User_id") data["Total"] = 0 return jsonify(data)