Code clean, and code style error fix.

This commit is contained in:
Krad
2022-04-22 17:16:45 +08:00
parent 7cee364fc3
commit 27487fdf3c
21 changed files with 198 additions and 240 deletions

View File

@@ -48,7 +48,7 @@ bool User::submitChange() {
return result;
}
bool User::QueryUser(QString userID, QString Pwd) {
bool User::QueryUser(const QString& userID, const QString& Pwd) {
QString sql = QString("select * from Account where UserCode=:userID and Password=:pwd");
QMap<QString,QVariant> map;
@@ -82,7 +82,7 @@ bool User::QueryUser(QString userID, QString Pwd) {
}
bool User::existsUser(QString userCode) {
bool User::existsUser(const QString& userCode) {
QString sql = QString("select * from Account where UserCode=:userID");
QMap<QString,QVariant> map;
QMap<QString,QVariant> params;
@@ -91,7 +91,7 @@ bool User::existsUser(QString userCode) {
return !map.isEmpty();
}
bool User::getUser(QString userUID, User& user) {
bool User::getUser(const QString& userUID, User& user) {
QString sql = QString("select * from Account where UserID=:userUID");
QMap<QString,QVariant> map;
QMap<QString,QVariant> params;
@@ -113,7 +113,7 @@ bool User::getUser(QString userUID, User& user) {
static bool LOAD_ALL_ROLE = false;
static QMap<QString,QString> roleCache;
QString User::getRoleName(QString RoleID) {
QString User::getRoleName(const QString& RoleID) {
if (roleCache.contains(RoleID)) return roleCache[RoleID];
QString sql = QString("select RoleName from Role where RoleID=:RoleID");
QMap<QString,QVariant> map;
@@ -124,7 +124,7 @@ QString User::getRoleName(QString RoleID) {
return map["RoleName"].toString();
}
QString User::getRoleID(QString RoleName) {
QString User::getRoleID(const QString& RoleName) {
if (roleCache.values().contains(RoleName)) {
int index = roleCache.values().indexOf(RoleName);
return roleCache.keys()[index];
@@ -155,7 +155,7 @@ QStringList User::getAllRoleName() {
return roleCache.values();
}
bool User::insertUser(QString UserCode, User &user) {
bool User::insertUser(const QString& UserCode, User &user) {
user.m_UserID = QUuid::createUuid().toString();
user.m_UserCode = UserCode;
static QString updateSQL = "insert into Account (%1) values (%2)";