feat: 数据查询完善-支持直接选择列输入值过滤数据

This commit is contained in:
meilin.huang
2022-04-24 20:26:58 +08:00
parent 41c660894c
commit 6fe892ca9f
6 changed files with 71 additions and 14 deletions

View File

@@ -29,6 +29,7 @@ func (m *Machine) Machines(rc *ctx.ReqCtx) {
// 使用创建者id模拟账号成员id
condition.CreatorId = rc.LoginAccount.Id
condition.Ip = rc.GinCtx.Query("ip")
condition.Name = rc.GinCtx.Query("name")
condition.ProjectId = uint64(ginx.QueryInt(rc.GinCtx, "projectId", 0))
res := m.MachineApp.GetMachineList(condition, ginx.GetPageParam(rc.GinCtx), new([]*vo.MachineVO))

View File

@@ -24,7 +24,10 @@ func (m *machineRepo) GetMachineList(condition *entity.Machine, pageParam *model
if condition.Ip != "" {
sql = sql + " AND m.ip LIKE '%" + condition.Ip + "%'"
}
sql = sql + " ORDER BY m.create_time DESC"
if condition.Name != "" {
sql = sql + " AND m.name LIKE '%" + condition.Name + "%'"
}
sql = sql + " ORDER BY m.project_id, m.create_time DESC"
return model.GetPageBySql(sql, pageParam, toEntity)
}