6 changed files with 178 additions and 3 deletions
@ -0,0 +1,30 @@ |
|||||
|
package com.galaxis.rcs.common.entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* (lcc_env_info) |
||||
|
*/ |
||||
|
@Data |
||||
|
public class LccEnvInfo implements Serializable { |
||||
|
/** 环境ID */ |
||||
|
private Long envId; |
||||
|
/** 世界地图ID */ |
||||
|
private String worldId; |
||||
|
/** 环境名称 */ |
||||
|
private String envName; |
||||
|
/** 是否虚拟环境 */ |
||||
|
private Boolean isVirtual; |
||||
|
/** 环境负载信息 */ |
||||
|
private String envPayload; |
||||
|
/** 创建时间 */ |
||||
|
private Date createAt; |
||||
|
/** 创建人 */ |
||||
|
private String createBy; |
||||
|
/** 更新时间 */ |
||||
|
private Date updateAt; |
||||
|
/** 更新人 */ |
||||
|
private String updateBy; |
||||
|
} |
||||
@ -0,0 +1,74 @@ |
|||||
|
package com.galaxis.rcs.common.query; |
||||
|
|
||||
|
import static com.querydsl.core.types.PathMetadataFactory.*; |
||||
|
import com.querydsl.core.types.dsl.*; |
||||
|
import com.querydsl.core.types.*; |
||||
|
import com.querydsl.sql.*; |
||||
|
import java.sql.Types; |
||||
|
import com.galaxis.rcs.common.entity.LccEnvInfo; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* (lcc_env_info) |
||||
|
*/ |
||||
|
@SuppressWarnings("ALL") |
||||
|
public class QLccEnvInfo extends RelationalPathBase<LccEnvInfo> { |
||||
|
/** lcc_env_info表 */ |
||||
|
public static final QLccEnvInfo lccEnvInfo = new QLccEnvInfo("lcc_env_info"); |
||||
|
|
||||
|
/** 环境ID */ |
||||
|
public final NumberPath<Long> envId = createNumber("envId", Long.class); |
||||
|
/** 世界地图ID */ |
||||
|
public final StringPath worldId = createString("worldId"); |
||||
|
/** 环境名称 */ |
||||
|
public final StringPath envName = createString("envName"); |
||||
|
/** 是否虚拟环境 */ |
||||
|
public final BooleanPath isVirtual = createBoolean("isVirtual"); |
||||
|
/** 环境负载信息 */ |
||||
|
public final StringPath envPayload = createString("envPayload"); |
||||
|
/** 创建时间 */ |
||||
|
public final DateTimePath<Date> createAt = createDateTime("createAt", Date.class); |
||||
|
/** 创建人 */ |
||||
|
public final StringPath createBy = createString("createBy"); |
||||
|
/** 更新时间 */ |
||||
|
public final DateTimePath<Date> updateAt = createDateTime("updateAt", Date.class); |
||||
|
/** 更新人 */ |
||||
|
public final StringPath updateBy = createString("updateBy"); |
||||
|
|
||||
|
public QLccEnvInfo(String variable) { |
||||
|
super(LccEnvInfo.class, forVariable(variable), "rcs2_tw_zhanghui", "lcc_env_info"); |
||||
|
addMetadata(); |
||||
|
} |
||||
|
|
||||
|
public QLccEnvInfo(String variable, String schema, String table) { |
||||
|
super(LccEnvInfo.class, forVariable(variable), schema, table); |
||||
|
addMetadata(); |
||||
|
} |
||||
|
|
||||
|
public QLccEnvInfo(String variable, String schema) { |
||||
|
super(LccEnvInfo.class, forVariable(variable), schema, "lcc_env_info"); |
||||
|
addMetadata(); |
||||
|
} |
||||
|
|
||||
|
public QLccEnvInfo(Path<? extends LccEnvInfo> path) { |
||||
|
super(path.getType(), path.getMetadata(), "rcs2_tw_zhanghui", "lcc_env_info"); |
||||
|
addMetadata(); |
||||
|
} |
||||
|
|
||||
|
public QLccEnvInfo(PathMetadata metadata) { |
||||
|
super(LccEnvInfo.class, metadata, "rcs2_tw_zhanghui", "lcc_env_info"); |
||||
|
addMetadata(); |
||||
|
} |
||||
|
|
||||
|
private void addMetadata() { |
||||
|
addMetadata(envId, ColumnMetadata.named("env_id").withIndex(1).ofType(Types.BIGINT).withSize(19)); |
||||
|
addMetadata(worldId, ColumnMetadata.named("world_id").withIndex(2).ofType(Types.VARCHAR).withSize(50)); |
||||
|
addMetadata(envName, ColumnMetadata.named("env_name").withIndex(3).ofType(Types.VARCHAR).withSize(50)); |
||||
|
addMetadata(isVirtual, ColumnMetadata.named("is_virtual").withIndex(4).ofType(Types.BIT).withSize(3)); |
||||
|
addMetadata(envPayload, ColumnMetadata.named("env_payload").withIndex(5).ofType(Types.VARCHAR).withSize(3000)); |
||||
|
addMetadata(createAt, ColumnMetadata.named("create_at").withIndex(6).ofType(Types.TIMESTAMP)); |
||||
|
addMetadata(createBy, ColumnMetadata.named("create_by").withIndex(7).ofType(Types.VARCHAR).withSize(50)); |
||||
|
addMetadata(updateAt, ColumnMetadata.named("update_at").withIndex(8).ofType(Types.TIMESTAMP)); |
||||
|
addMetadata(updateBy, ColumnMetadata.named("update_by").withIndex(9).ofType(Types.VARCHAR).withSize(50)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package com.yvan.workbench.controller; |
||||
|
|
||||
|
import com.yvan.workbench.model.entity.Model; |
||||
|
import org.clever.core.Conv; |
||||
|
import org.clever.core.json.JsonWrapper; |
||||
|
import org.clever.data.jdbc.DaoFactory; |
||||
|
import org.clever.data.jdbc.QueryDSL; |
||||
|
import org.clever.data.jdbc.querydsl.utils.QueryDslUtils; |
||||
|
import org.clever.web.mvc.annotation.RequestBody; |
||||
|
import org.springframework.data.redis.core.query.QueryUtils; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
|
||||
|
import java.util.LinkedHashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
import static com.galaxis.rcs.common.query.QLccEnvInfo.lccEnvInfo; |
||||
|
|
||||
|
public class EnvController { |
||||
|
static final QueryDSL queryDSL = DaoFactory.getQueryDSL(); |
||||
|
|
||||
|
@ResponseBody |
||||
|
public static Model<List<LinkedHashMap<String, Object>>> getAllEnv(@RequestBody Map<String, Object> params) { |
||||
|
var list = queryDSL.select(QueryDslUtils.linkedMap(lccEnvInfo)) |
||||
|
.from(lccEnvInfo) |
||||
|
.where(lccEnvInfo.worldId.eq(Conv.asString(params.get("worldId")))) |
||||
|
.fetch(); |
||||
|
|
||||
|
return Model.newSuccess(list); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
package com.yvan.workbench.model.entity; |
||||
|
|
||||
|
public class Model<T> implements java.io.Serializable { |
||||
|
private boolean success = false; |
||||
|
private T data; |
||||
|
private String msg = ""; |
||||
|
|
||||
|
public static <T> Model<T> newSuccess(T data) { |
||||
|
return new Model<T>().setData(data).setSuccess(true).setMsg("操作成功"); |
||||
|
} |
||||
|
|
||||
|
public T getData() { |
||||
|
return data; |
||||
|
} |
||||
|
|
||||
|
public Model<T> setData(T data) { |
||||
|
this.data = data; |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public String getMsg() { |
||||
|
return msg; |
||||
|
} |
||||
|
|
||||
|
public Model<T> setMsg(String msg) { |
||||
|
this.msg = msg; |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public boolean isSuccess() { |
||||
|
return success; |
||||
|
} |
||||
|
|
||||
|
public Model<T> setSuccess(boolean success) { |
||||
|
this.success = success; |
||||
|
return this; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue