部分判断优化

Signed-off-by: 勤快的小晴同学 <941403820@qq.com>
This commit is contained in:
勤快的小晴同学
2024-03-11 01:50:13 +00:00
committed by Gitee
parent bb0ec5a25a
commit 0d3bae0001
6 changed files with 17 additions and 47 deletions

View File

@@ -85,36 +85,33 @@ func (s *toolsGenTableColumn) IsNotQuery(name string) bool {
func (s *toolsGenTableColumn) CheckNameColumn(columnName string) bool {
if len(columnName) >= 4 {
if tmp := columnName[len(columnName)-4:]; tmp == "name" {
return true
}
tmp := columnName[len(columnName)-4:]
return tmp == "name"
}
return false
}
func (s *toolsGenTableColumn) CheckStatusColumn(columnName string) bool {
if len(columnName) >= 6 {
if tmp := columnName[len(columnName)-6:]; tmp == "status" {
return true
}
tmp := columnName[len(columnName)-6:]
return tmp == "status"
}
return false
}
func (s *toolsGenTableColumn) CheckTypeColumn(columnName string) bool {
if len(columnName) >= 4 {
if tmp := columnName[len(columnName)-4:]; tmp == "type" {
return true
}
tmp := columnName[len(columnName)-4:]
return tmp == "type"
}
return false
}
func (s *toolsGenTableColumn) CheckSexColumn(columnName string) bool {
if len(columnName) >= 3 {
if tmp := columnName[len(columnName)-3:]; tmp == "sex" {
return true
}
tmp := columnName[len(columnName)-4:]
return tmp == "sex"
}
return false
}

View File

@@ -1,10 +1,5 @@
package api
/**
* @Description
* @Author 熊猫
* @Date 2022/7/14 17:55
**/
import (
"pandax/apps/system/entity"
"pandax/apps/system/services"
@@ -70,8 +65,5 @@ func (p *SysTenantsApi) DeleteSysTenants(rc *restfulx.ReqCtx) {
// IsTenantAdmin 是否为主租户
func IsTenantAdmin(tenantId int64) bool {
if tenantId == 1 {
return true
}
return false
return tenantId == 1
}

View File

@@ -344,10 +344,7 @@ func (u *UserApi) ExportUser(rc *restfulx.ReqCtx) {
// Build 构建前端路由
func Build(menus []entity.SysMenu) []vo.RouterVo {
equals := func(a string, b string) bool {
if a == b {
return true
}
return false
return a == b
}
rvs := make([]vo.RouterVo, 0)
for _, ms := range menus {

View File

@@ -22,10 +22,7 @@ type Text struct {
}
func (node *Node) IsStartNode(ty string) bool {
if node.Type == ty {
return true
}
return false
return node.Type == ty
}
func (node *Node) GetProperties(data any) error {

View File

@@ -14,10 +14,7 @@ func DdmKey(data string) string {
}
func IsDdmKey(data string) bool {
if len(data) > 6 && data[3:len(data)-3] == "****" {
return true
}
return false
return len(data) > 6 && data[3:len(data)-3] == "****"
}
func DdmMail(data string) string {
@@ -25,10 +22,7 @@ func DdmMail(data string) string {
}
func ISDdmMail(data string) bool {
if len(data) > 11 && data[3:len(data)-8] == "****" {
return true
}
return false
return len(data) > 11 && data[3:len(data)-8] == "****"
}
func DdmPassword(data string) string {
@@ -36,8 +30,5 @@ func DdmPassword(data string) string {
}
func IsDdmPassword(data string) bool {
if data == "******" {
return true
}
return false
return data == "******"
}

View File

@@ -25,9 +25,5 @@ func DelDeviceEtoken(key string) error {
func ExistsDeviceEtoken(key string) bool {
exists, _ := RedisDb.Exists(RedisDb.Context(), key).Result()
if exists == 1 {
return true
} else {
return false
}
return exists == 1
}