Merge remote-tracking branch 'origin/lichang' into lite

This commit is contained in:
TsMask
2025-03-05 19:37:37 +08:00
parent 2c71040499
commit d9ef522f1c
26 changed files with 83 additions and 67 deletions

View File

@@ -45,7 +45,6 @@ database:
default:
type: "sqlite"
database: "/usr/local/omc/database/omc_db.sqlite"
logging: false
# used to specify the default data source for multiple data resourece
defaultDataSourceName: "default"

View File

@@ -1,6 +1,7 @@
package repository
import (
"fmt"
"time"
"be.ems/src/framework/database/db"
@@ -19,13 +20,13 @@ func (r SysJob) SelectByPage(query map[string]string) ([]model.SysJob, int64) {
tx := db.DB("").Model(&model.SysJob{})
// 查询条件拼接
if v, ok := query["jobName"]; ok && v != "" {
tx = tx.Where("job_name like concat(?, '%')", v)
tx = tx.Where("job_name like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["jobGroup"]; ok && v != "" {
tx = tx.Where("job_group = ?", v)
}
if v, ok := query["invokeTarget"]; ok && v != "" {
tx = tx.Where("invoke_target like concat(?, '%')", v)
tx = tx.Where("invoke_target like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["statusFlag"]; ok && v != "" {
tx = tx.Where("status_flag = ?", v)
@@ -56,13 +57,13 @@ func (r SysJob) Select(sysJob model.SysJob) []model.SysJob {
tx := db.DB("").Model(&model.SysJob{})
// 查询条件拼接
if sysJob.JobName != "" {
tx = tx.Where("job_name like concat(?, '%')", sysJob.JobName)
tx = tx.Where("job_name like ?", fmt.Sprintf("%s%%", sysJob.JobName))
}
if sysJob.JobGroup != "" {
tx = tx.Where("job_group = ?", sysJob.JobGroup)
}
if sysJob.InvokeTarget != "" {
tx = tx.Where("invoke_target like concat(?, '%')", sysJob.InvokeTarget)
tx = tx.Where("invoke_target like ?", fmt.Sprintf("%s%%", sysJob.InvokeTarget))
}
if sysJob.StatusFlag != "" {
tx = tx.Where("status_flag = ?", sysJob.StatusFlag)

View File

@@ -28,7 +28,7 @@ func (r SysJobLog) SelectByPage(query map[string]string) ([]model.SysJobLog, int
tx = tx.Where("status_flag = ?", v)
}
if v, ok := query["invokeTarget"]; ok && v != "" {
tx = tx.Where("invoke_target like concat(?, '%')", v)
tx = tx.Where("invoke_target like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["beginTime"]; ok && v != "" {
if len(v) == 10 {
@@ -72,7 +72,7 @@ func (r SysJobLog) Select(sysJobLog model.SysJobLog) []model.SysJobLog {
tx := db.DB("").Model(&model.SysJobLog{})
// 查询条件拼接
if sysJobLog.JobName != "" {
tx = tx.Where("job_name like concat(?, '%')", sysJobLog.JobName)
tx = tx.Where("job_name like ?", fmt.Sprintf("%s%%", sysJobLog.JobName))
}
if sysJobLog.JobGroup != "" {
tx = tx.Where("job_group = ?", sysJobLog.JobGroup)
@@ -81,7 +81,7 @@ func (r SysJobLog) Select(sysJobLog model.SysJobLog) []model.SysJobLog {
tx = tx.Where("status_flag = ?", sysJobLog.StatusFlag)
}
if sysJobLog.InvokeTarget != "" {
tx = tx.Where("invoke_target like concat(?, '%')", sysJobLog.InvokeTarget)
tx = tx.Where("invoke_target like ?", fmt.Sprintf("%s%%", sysJobLog.InvokeTarget))
}
// 查询数据

View File

@@ -1,6 +1,8 @@
package repository
import (
"fmt"
"be.ems/src/framework/database/db"
"be.ems/src/framework/logger"
"be.ems/src/modules/network_data/model"
@@ -28,10 +30,10 @@ func (r *UDMAuthUser) SelectPage(query map[string]string) (int64, []model.UDMAut
tx := db.DB("").Model(&model.UDMAuthUser{})
// 查询条件拼接
if v, ok := query["imsi"]; ok && v != "" {
tx = tx.Where("imsi like concat(concat('%',?), '%')", v)
tx = tx.Where("imsi like ?", fmt.Sprintf("%%%s%%", v))
}
if v, ok := query["neId"]; ok && v != "" {
tx = tx.Where("ne_id =?", v)
tx = tx.Where("ne_id = ?", v)
}
if v, ok := query["imsis"]; ok && v != "" {
tx = tx.Where("imsi in ?", v)
@@ -122,7 +124,7 @@ func (r *UDMAuthUser) Delete(imsi, neId string) int64 {
// DeletePrefixByIMSI 删除前缀匹配的实体
func (r *UDMAuthUser) DeletePrefixByIMSI(neId, imsi string) int64 {
tx := db.DB("").Where("imsi like concat(?, '%') and ne_id = ?", imsi, neId).Delete(&model.UDMAuthUser{})
tx := db.DB("").Where("imsi like ? and ne_id = ?", fmt.Sprintf("%s%%", imsi), neId).Delete(&model.UDMAuthUser{})
if err := tx.Error; err != nil {
logger.Errorf("DeletePrefixByIMSI err => %v", err)
}

View File

@@ -1,6 +1,8 @@
package repository
import (
"fmt"
"be.ems/src/framework/database/db"
"be.ems/src/framework/logger"
"be.ems/src/modules/network_data/model"
@@ -17,7 +19,7 @@ func (r UDMExtend) SelectByPage(query map[string]string) ([]model.UDMExtend, int
tx := db.DB("").Model(&model.UDMExtend{})
// 查询条件拼接
if v, ok := query["imsi"]; ok && v != "" {
tx = tx.Where("imsi like concat(concat('%', ?), '%')", v)
tx = tx.Where("imsi like ?", fmt.Sprintf("%%%s%%", v))
}
if v, ok := query["neId"]; ok && v != "" {
tx = tx.Where("ne_id = ?", v)
@@ -77,7 +79,7 @@ func (r *UDMExtend) SelectByIMSIAndNeID(imsi, neId string) model.UDMExtend {
tx := db.DB("").Model(&model.UDMExtend{})
// 构建查询条件
if neId == "%" {
tx = tx.Where("imsi like concat(?, '%')", imsi)
tx = tx.Where("imsi like ?", fmt.Sprintf("%s%%", imsi))
} else {
tx = tx.Where(" imsi = ? and ne_id = ?", imsi, neId)
}
@@ -105,7 +107,7 @@ func (r *UDMExtend) Inserts(uArr []model.UDMExtend) int64 {
func (r *UDMExtend) Delete(imsi, neId string) int64 {
tx := db.DB("")
if neId == "%" {
tx = tx.Where("imsi like concat(?, '%')", imsi)
tx = tx.Where("imsi like ?", fmt.Sprintf("%s%%", imsi))
} else {
tx = tx.Where(" imsi = ? and ne_id = ?", imsi, neId)
}

View File

@@ -1,6 +1,8 @@
package repository
import (
"fmt"
"be.ems/src/framework/database/db"
"be.ems/src/framework/logger"
"be.ems/src/modules/network_data/model"
@@ -28,10 +30,10 @@ func (r *UDMSubUser) SelectPage(query map[string]string) (int64, []model.UDMSubU
tx := db.DB("").Model(&model.UDMSubUser{})
// 查询条件拼接
if v, ok := query["imsi"]; ok && v != "" {
tx = tx.Where("imsi like concat(concat('%', ?), '%')", v)
tx = tx.Where("imsi like ?", fmt.Sprintf("%%%s%%", v))
}
if v, ok := query["msisdn"]; ok && v != "" {
tx = tx.Where("msisdn like concat(concat('%', ?), '%')", v)
tx = tx.Where("msisdn like ?", fmt.Sprintf("%%%s%%", v))
}
if v, ok := query["neId"]; ok && v != "" {
tx = tx.Where("ne_id =?", v)
@@ -125,7 +127,7 @@ func (r *UDMSubUser) Delete(imsi, neId string) int64 {
// DeletePrefixByIMSI 删除前缀匹配的实体
func (r *UDMSubUser) DeletePrefixByIMSI(imsiPrefix, neId string) int64 {
tx := db.DB("").Where("imsi like concat(?, '%') and ne_id = ?", imsiPrefix, neId).Delete(&model.UDMSubUser{})
tx := db.DB("").Where("imsi like ? and ne_id = ?", fmt.Sprintf("%s%%", imsiPrefix), neId).Delete(&model.UDMSubUser{})
if err := tx.Error; err != nil {
logger.Errorf("DeletePrefixByIMSI err => %v", err)
}

View File

@@ -1,6 +1,7 @@
package repository
import (
"fmt"
"time"
"be.ems/src/framework/database/db"
@@ -25,7 +26,7 @@ func (r NeConfigBackup) SelectByPage(query map[string]string) ([]model.NeConfigB
tx = tx.Where("neId = ?", v)
}
if v, ok := query["name"]; ok && v != "" {
tx = tx.Where("name like concat(concat('%', ?), '%')", v)
tx = tx.Where("name like ?", fmt.Sprintf("%%%s%%", v))
}
// 查询结果

View File

@@ -26,7 +26,7 @@ func (r NeHost) SelectByPage(query map[string]string) ([]model.NeHost, int64) {
tx = tx.Where("group_id = ?", v)
}
if v, ok := query["title"]; ok && v != "" {
tx = tx.Where("title like concat(?, '%')", v)
tx = tx.Where("title like ?", fmt.Sprintf("%s%%", v))
}
// 查询结果

View File

@@ -1,6 +1,7 @@
package repository
import (
"fmt"
"time"
"be.ems/src/framework/database/db"
@@ -25,7 +26,7 @@ func (r NeHostCmd) SelectByPage(query map[string]string) ([]model.NeHostCmd, int
tx = tx.Where("group_id = ?", v)
}
if v, ok := query["title"]; ok && v != "" {
tx = tx.Where("title like concat(?, '%')", v)
tx = tx.Where("title like ?", fmt.Sprintf("%s%%", v))
}
// 查询结果

View File

@@ -1,6 +1,7 @@
package repository
import (
"fmt"
"time"
"be.ems/src/framework/database/db"
@@ -71,7 +72,7 @@ func (r NeInfo) SelectByPage(query map[string]string) ([]model.NeInfo, int64) {
tx = tx.Where("ne_id = ?", v)
}
if v, ok := query["rmUid"]; ok && v != "" {
tx = tx.Where("rmUid like concat(?, '%')", v)
tx = tx.Where("rmUid like ?", fmt.Sprintf("%s%%", v))
}
// 查询结果

View File

@@ -1,6 +1,7 @@
package repository
import (
"fmt"
"time"
"be.ems/src/framework/database/db"
@@ -31,7 +32,7 @@ func (r NeLicense) SelectByPage(query map[string]string) ([]model.NeLicense, int
tx = tx.Where("serial_num = ?", v)
}
if v, ok := query["createBy"]; ok && v != "" {
tx = tx.Where("create_by like concat(?, '%')", v)
tx = tx.Where("create_by like ?", fmt.Sprintf("%s%%", v))
}
// 查询结果
@@ -69,7 +70,7 @@ func (r NeLicense) Select(param model.NeLicense) []model.NeLicense {
tx = tx.Where("expiry_date = ?", param.ExpiryDate)
}
if param.CreateBy != "" {
tx = tx.Where("create_by like concat(?, '%')", param.CreateBy)
tx = tx.Where("create_by like ?", fmt.Sprintf("%s%%", param.CreateBy))
}
// 查询数据

View File

@@ -1,6 +1,7 @@
package repository
import (
"fmt"
"strings"
"time"
@@ -28,10 +29,10 @@ func (r NeSoftware) SelectByPage(query map[string]string) ([]model.NeSoftware, i
}
}
if v, ok := query["name"]; ok && v != "" {
tx = tx.Where("name like concat(?, '%')", v)
tx = tx.Where("name like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["version"]; ok && v != "" {
tx = tx.Where("version like concat(?, '%')", v)
tx = tx.Where("version like ?", fmt.Sprintf("%s%%", v))
}
// 查询结果
@@ -69,7 +70,7 @@ func (r NeSoftware) Select(param model.NeSoftware) []model.NeSoftware {
tx = tx.Where("version = ?", param.Version)
}
if param.Name != "" {
tx = tx.Where("name like concat(?, '%')", param.Name)
tx = tx.Where("name like ?", fmt.Sprintf("%s%%", param.Name))
}
// 查询数据

View File

@@ -1,6 +1,7 @@
package repository
import (
"fmt"
"time"
"be.ems/src/framework/database/db"
@@ -25,10 +26,10 @@ func (r NeVersion) SelectByPage(query map[string]string) ([]model.NeVersion, int
tx = tx.Where("ne_id = ?", v)
}
if v, ok := query["version"]; ok && v != "" {
tx = tx.Where("version like concat(?, '%')", v)
tx = tx.Where("version like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["path"]; ok && v != "" {
tx = tx.Where("path like concat(?, '%')", v)
tx = tx.Where("path like ?", fmt.Sprintf("%s%%", v))
}
// 查询结果
@@ -63,10 +64,10 @@ func (r NeVersion) Select(param model.NeVersion) []model.NeVersion {
tx = tx.Where("ne_id = ?", param.NeId)
}
if param.Version != "" {
tx = tx.Where("version like concat(?, '%')", param.Version)
tx = tx.Where("version like ?", fmt.Sprintf("%s%%", param.Version))
}
if param.Path != "" {
tx = tx.Where("path like concat(?, '%')", param.Path)
tx = tx.Where("path like ?", fmt.Sprintf("%s%%", param.Path))
}
if param.Status != "" {
tx = tx.Where("status = ?", param.Status)

View File

@@ -21,13 +21,13 @@ func (r SysConfig) SelectByPage(query map[string]string) ([]model.SysConfig, int
tx = tx.Where("del_flag = '0'")
// 查询条件拼接
if v, ok := query["configName"]; ok && v != "" {
tx = tx.Where("config_name like concat(?, '%')", v)
tx = tx.Where("config_name like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["configType"]; ok && v != "" {
tx = tx.Where("config_type = ?", v)
}
if v, ok := query["configKey"]; ok && v != "" {
tx = tx.Where("config_key like concat(?, '%')", v)
tx = tx.Where("config_key like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["beginTime"]; ok && v != "" {
if len(v) == 10 {
@@ -72,13 +72,13 @@ func (r SysConfig) Select(sysConfig model.SysConfig) []model.SysConfig {
tx = tx.Where("del_flag = '0'")
// 查询条件拼接
if sysConfig.ConfigName != "" {
tx = tx.Where("config_name like concat(?, '%')", sysConfig.ConfigName)
tx = tx.Where("config_name like ?", fmt.Sprintf("%s%%", sysConfig.ConfigName))
}
if sysConfig.ConfigType != "" {
tx = tx.Where("config_type = ?", sysConfig.ConfigType)
}
if sysConfig.ConfigKey != "" {
tx = tx.Where("config_key like concat(?, '%')", sysConfig.ConfigKey)
tx = tx.Where("config_key like ?", fmt.Sprintf("%s%%", sysConfig.ConfigKey))
}
if sysConfig.CreateTime > 0 {
tx = tx.Where("create_time >= ?", sysConfig.CreateTime)

View File

@@ -28,7 +28,7 @@ func (r SysDept) Select(sysDept model.SysDept, dataScopeSQL string) []model.SysD
tx = tx.Where("parent_id = ?", sysDept.ParentId)
}
if sysDept.DeptName != "" {
tx = tx.Where("dept_name like concat(?, '%')", sysDept.DeptName)
tx = tx.Where("dept_name like ?", fmt.Sprintf("%s%%", sysDept.DeptName))
}
if sysDept.StatusFlag != "" {
tx = tx.Where("status_flag = ?", sysDept.StatusFlag)

View File

@@ -1,6 +1,7 @@
package repository
import (
"fmt"
"time"
"be.ems/src/framework/database/db"
@@ -23,7 +24,7 @@ func (r SysDictData) SelectByPage(query map[string]string) ([]model.SysDictData,
tx = tx.Where("dict_type = ?", v)
}
if v, ok := query["dataLabel"]; ok && v != "" {
tx = tx.Where("data_label like concat(?, '%')", v)
tx = tx.Where("data_label like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["statusFlag"]; ok && v != "" {
tx = tx.Where("status_flag = ?", v)
@@ -55,7 +56,7 @@ func (r SysDictData) Select(sysDictData model.SysDictData) []model.SysDictData {
tx = tx.Where("del_flag = '0'")
// 查询条件拼接
if sysDictData.DataLabel != "" {
tx = tx.Where("data_label like concat(?, '%')", sysDictData.DataLabel)
tx = tx.Where("data_label like ?", fmt.Sprintf("%s%%", sysDictData.DataLabel))
}
if sysDictData.DictType != "" {
tx = tx.Where("dict_type = ?", sysDictData.DictType)

View File

@@ -21,10 +21,10 @@ func (r SysDictType) SelectByPage(query map[string]string) ([]model.SysDictType,
tx = tx.Where("del_flag = '0'")
// 查询条件拼接
if v, ok := query["dictName"]; ok && v != "" {
tx = tx.Where("dict_name like concat(?, '%')", v)
tx = tx.Where("dict_name like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["dictType"]; ok && v != "" {
tx = tx.Where("dict_type like concat(?, '%')", v)
tx = tx.Where("dict_type like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["statusFlag"]; ok && v != "" {
tx = tx.Where("status_flag = ?", v)
@@ -72,10 +72,10 @@ func (r SysDictType) Select(sysDictType model.SysDictType) []model.SysDictType {
tx = tx.Where("del_flag = '0'")
// 查询条件拼接
if sysDictType.DictName != "" {
tx = tx.Where("dict_name like concat(?, '%')", sysDictType.DictName)
tx = tx.Where("dict_name like ?", fmt.Sprintf("%s%%", sysDictType.DictName))
}
if sysDictType.DictType != "" {
tx = tx.Where("dict_type like concat(?, '%')", sysDictType.DictType)
tx = tx.Where("dict_type like ?", fmt.Sprintf("%s%%", sysDictType.DictType))
}
if sysDictType.StatusFlag != "" {
tx = tx.Where("status_flag = ?", sysDictType.StatusFlag)

View File

@@ -20,10 +20,10 @@ func (r SysLogLogin) SelectByPage(query map[string]string, dataScopeSQL string)
tx := db.DB("").Model(&model.SysLogLogin{})
// 查询条件拼接
if v, ok := query["loginIp"]; ok && v != "" {
tx = tx.Where("login_ip like concat(?, '%')", v)
tx = tx.Where("login_ip like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["userName"]; ok && v != "" {
tx = tx.Where("user_name like concat(?, '%')", v)
tx = tx.Where("user_name like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["statusFlag"]; ok && v != "" {
tx = tx.Where("status_flag = ?", v)

View File

@@ -20,16 +20,16 @@ func (r SysLogOperate) SelectByPage(query map[string]string, dataScopeSQL string
tx := db.DB("").Model(&model.SysLogOperate{})
// 查询条件拼接
if v, ok := query["title"]; ok && v != "" {
tx = tx.Where("title like concat(?, '%')", v)
tx = tx.Where("title like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["businessType"]; ok && v != "" {
tx = tx.Where("business_type = ?", v)
}
if v, ok := query["operaBy"]; ok && v != "" {
tx = tx.Where("opera_by like concat(?, '%')", v)
tx = tx.Where("opera_by like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["operaIp"]; ok && v != "" {
tx = tx.Where("opera_ip like concat(?, '%')", v)
tx = tx.Where("opera_ip like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["statusFlag"]; ok && v != "" {
tx = tx.Where("status_flag = ?", v)

View File

@@ -1,6 +1,7 @@
package repository
import (
"fmt"
"time"
"be.ems/src/framework/constants"
@@ -21,7 +22,7 @@ func (r SysMenu) Select(sysMenu model.SysMenu, userId int64) []model.SysMenu {
tx = tx.Where("del_flag = '0'")
// 查询条件拼接
if sysMenu.MenuName != "" {
tx = tx.Where("menu_name like concat(?, '%')", sysMenu.MenuName)
tx = tx.Where("menu_name like ?", fmt.Sprintf("%s%%", sysMenu.MenuName))
}
if sysMenu.VisibleFlag != "" {
tx = tx.Where("visible_flag = ?", sysMenu.VisibleFlag)

View File

@@ -1,6 +1,7 @@
package repository
import (
"fmt"
"time"
"be.ems/src/framework/database/db"
@@ -20,10 +21,10 @@ func (r SysPost) SelectByPage(query map[string]string) ([]model.SysPost, int64)
tx = tx.Where("del_flag = '0'")
// 查询条件拼接
if v, ok := query["postCode"]; ok && v != "" {
tx = tx.Where("post_code like concat(?, '%')", v)
tx = tx.Where("post_code like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["postName"]; ok && v != "" {
tx = tx.Where("post_name like concat(?, '%')", v)
tx = tx.Where("post_name like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["statusFlag"]; ok && v != "" {
tx = tx.Where("status_flag = ?", v)
@@ -55,10 +56,10 @@ func (r SysPost) Select(sysPost model.SysPost) []model.SysPost {
tx = tx.Where("del_flag = '0'")
// 查询条件拼接
if sysPost.PostCode != "" {
tx = tx.Where("post_code like concat(?, '%')", sysPost.PostCode)
tx = tx.Where("post_code like ?", fmt.Sprintf("%s%%", sysPost.PostCode))
}
if sysPost.PostName != "" {
tx = tx.Where("post_name like concat(?, '%')", sysPost.PostName)
tx = tx.Where("post_name like ?", fmt.Sprintf("%s%%", sysPost.PostName))
}
if sysPost.StatusFlag != "" {
tx = tx.Where("status_flag = ?", sysPost.StatusFlag)

View File

@@ -21,10 +21,10 @@ func (r SysRole) SelectByPage(query map[string]string) ([]model.SysRole, int64)
tx = tx.Where("del_flag = '0' and role_id > 1")
// 查询条件拼接
if v, ok := query["roleName"]; ok && v != "" {
tx = tx.Where("role_name like concat(?, '%')", v)
tx = tx.Where("role_name like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["roleKey"]; ok && v != "" {
tx = tx.Where("role_key like concat(?, '%')", v)
tx = tx.Where("role_key like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["statusFlag"]; ok && v != "" {
tx = tx.Where("status_flag = ?", v)
@@ -78,10 +78,10 @@ func (r SysRole) Select(sysRole model.SysRole) []model.SysRole {
tx = tx.Where("del_flag = '0'")
// 查询条件拼接
if sysRole.RoleKey != "" {
tx = tx.Where("role_key like concat(?, '%')", sysRole.RoleKey)
tx = tx.Where("role_key like ?", fmt.Sprintf("%s%%", sysRole.RoleKey))
}
if sysRole.RoleName != "" {
tx = tx.Where("role_name like concat(?, '%')", sysRole.RoleName)
tx = tx.Where("role_name like ?", fmt.Sprintf("%s%%", sysRole.RoleName))
}
if sysRole.StatusFlag != "" {
tx = tx.Where("status_flag = ?", sysRole.StatusFlag)

View File

@@ -26,10 +26,10 @@ func (r SysUser) SelectByPage(query map[string]string, dataScopeSQL string) ([]m
tx = tx.Where("user_id = ?", v)
}
if v, ok := query["userName"]; ok && v != "" {
tx = tx.Where("user_name like concat(?, '%')", v)
tx = tx.Where("user_name like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["phone"]; ok && v != "" {
tx = tx.Where("phone like concat(?, '%')", v)
tx = tx.Where("phone like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["statusFlag"]; ok && v != "" {
tx = tx.Where("status_flag = ?", v)
@@ -85,10 +85,10 @@ func (r SysUser) Select(sysUser model.SysUser) []model.SysUser {
tx = tx.Where("del_flag = '0'")
// 查询条件拼接
if sysUser.UserName != "" {
tx = tx.Where("user_name like concat(?, '%')", sysUser.UserName)
tx = tx.Where("user_name like ?", fmt.Sprintf("%s%%", sysUser.UserName))
}
if sysUser.Phone != "" {
tx = tx.Where("phone like concat(?, '%')", sysUser.Phone)
tx = tx.Where("phone like ?", fmt.Sprintf("%s%%", sysUser.Phone))
}
if sysUser.StatusFlag != "" {
tx = tx.Where("status_flag = ?", sysUser.StatusFlag)
@@ -229,10 +229,10 @@ func (r SysUser) SelectAuthUsersByPage(query map[string]string, dataScopeSQL str
tx = tx.Where("del_flag = '0'")
// 查询条件拼接
if v, ok := query["userName"]; ok && v != "" {
tx = tx.Where("user_name like concat(?, '%')", v)
tx = tx.Where("user_name like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["phone"]; ok && v != "" {
tx = tx.Where("phone like concat(?, '%')", v)
tx = tx.Where("phone like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["statusFlag"]; ok && v != "" {
tx = tx.Where("status_flag = ?", v)

View File

@@ -19,10 +19,10 @@ func (r TraceData) SelectByPage(query map[string]string) ([]model.TraceData, int
tx := db.DB("").Model(&model.TraceData{})
// 查询条件拼接
if v, ok := query["imsi"]; ok && v != "" {
tx = tx.Where("imsi like concat(?, '%')", v)
tx = tx.Where("imsi like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["msisdn"]; ok && v != "" {
tx = tx.Where("msisdn like concat(?, '%')", v)
tx = tx.Where("msisdn like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["startTime"]; ok && v != "" {
if len(v) == 10 {

View File

@@ -1,6 +1,7 @@
package repository
import (
"fmt"
"time"
"be.ems/src/framework/database/db"
@@ -22,10 +23,10 @@ func (r TraceTask) SelectByPage(query map[string]string) ([]model.TraceTask, int
tx = tx.Where("ne_type = ?", v)
}
if v, ok := query["imsi"]; ok && v != "" {
tx = tx.Where("imsi like concat(?, '%')", v)
tx = tx.Where("imsi like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["msisdn"]; ok && v != "" {
tx = tx.Where("msisdn like concat(?, '%')", v)
tx = tx.Where("msisdn like ?", fmt.Sprintf("%s%%", v))
}
if v, ok := query["startTime"]; ok && v != "" {
tx = tx.Where("start_time >= ?", v)

View File

@@ -20,10 +20,10 @@ func (r TraceTaskHlr) SelectByPage(query model.TraceTaskHlrQuery) ([]model.Trace
tx := db.DB("").Model(&model.TraceTaskHlr{})
// 查询条件拼接
if query.IMSI != "" {
tx = tx.Where("imsi like concat(?, '%')", query.IMSI)
tx = tx.Where("imsi like ?", fmt.Sprintf("%s%%", query.IMSI))
}
if query.MSISDN != "" {
tx = tx.Where("msisdn like concat(?, '%')", query.MSISDN)
tx = tx.Where("msisdn like ?", fmt.Sprintf("%s%%", query.MSISDN))
}
if query.StartTime != "" && len(query.StartTime) == 13 {
tx = tx.Where("start_time >= ?", query.StartTime)