#####用户相关


###登录
LOGIN = SELECT Id, Username, Password, CredentialNumber, PrivId, DeptId FROM Users WHERE Username = ?

###使用证件号码登录
LOGIN_BY_CREDENTIAL_NUMBER = SELECT Id, Username, Password, CredentialNumber, PrivId, DeptId FROM Users WHERE CredentialNumber = ?

###获得指定ID的角色权限记录
GET_PRIVILEGE_BY_ID = SELECT PrivName FROM User_Priv WHERE ID = ?

###获得指定ID的用户记录
GET_USER_BY_ID = SELECT * FROM Users WHERE ID = ?

###获得严格匹配指定名称的用户记录
GET_USER_BY_USERNAME_EXACTLY = SELECT * FROM Users WHERE Username = ?

###获得匹配指定名称的用户记录
GET_USERS_BY_NAME = SELECT * FROM Users WHERE Username LIKE ?

###获得匹配指定证件号码的用户记录
GET_USER_BY_CREDENTIAL_NUMBER = SELECT * FROM Users WHERE CredentialNumber = ?

###获得指定部门ID的所有用户记录
GET_USERS_BY_DEPARTMENT_ID = SELECT * FROM Users WHERE DeptId = ?

###获得全部用户记录
GET_ALL_USERS = SELECT * FROM Users

###添加用户
ADD_USER = INSERT INTO Users (Username, Password, CredentialNumber, PrivId, DeptId) VALUES (?, ?, ?, ?, ?)

###修改用户
UPDATE_USER = UPDATE Users SET Username = ?, Password = ?, CredentialNumber = ?, DeptId = ? WHERE Id = ?

###删除用户
DELETE_USER = DELETE FROM Users WHERE Id = ?

###根据部门Id删除用户
DELETE_USER_BY_DEPARTMENT_ID = DELETE FROM Users WHERE DeptId = ?