Skip to content

Commit

Permalink
Merge pull request #3462 from KouShenhai/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
KouShenhai authored Jan 31, 2025
2 parents 1086a38 + 20fcfed commit bfe6e85
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 73 deletions.
2 changes: 2 additions & 0 deletions doc/db/kcloud_platform.sql
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,8 @@ INSERT INTO "public"."boot_sys_menu" ("id", "creator", "editor", "create_time",
INSERT INTO "public"."boot_sys_menu" ("id", "creator", "editor", "create_time", "update_time", "del_flag", "version", "tenant_id", "pid", "permission", "type", "name", "path", "icon", "sort", "status") VALUES (40, 1, 1, '2025-01-21 05:19:17', '2025-01-29 11:20:15.092772', 0, 0, 0, 23, 'sys:menu:tree-list', 1, '查询树列表', '', NULL, 50, 0);
INSERT INTO "public"."boot_sys_menu" ("id", "creator", "editor", "create_time", "update_time", "del_flag", "version", "tenant_id", "pid", "permission", "type", "name", "path", "icon", "sort", "status") VALUES (41, 1, 1, '2025-01-21 05:19:17', '2025-01-29 11:20:15.092772', 0, 0, 0, 23, 'sys:menu:remove', 1, '删除', '', NULL, 20, 0);
INSERT INTO "public"."boot_sys_menu" ("id", "creator", "editor", "create_time", "update_time", "del_flag", "version", "tenant_id", "pid", "permission", "type", "name", "path", "icon", "sort", "status") VALUES (42, 1, 1, '2025-01-21 05:19:17', '2025-01-29 14:32:03.026995', 0, 0, 0, 23, 'sys:menu:save', 1, '新增', '', NULL, 40, 0);
INSERT INTO "public"."boot_sys_menu" ("id", "creator", "editor", "create_time", "update_time", "del_flag", "version", "tenant_id", "pid", "permission", "type", "name", "path", "icon", "sort", "status") VALUES (43, 1, 1, '2025-01-31 13:08:53.459704', '2025-01-31 13:08:53.459779', 0, 0, 0, 23, 'sys:menu:detail', 1, '查看', NULL, NULL, 10, 0);
INSERT INTO "public"."boot_sys_menu" ("id", "creator", "editor", "create_time", "update_time", "del_flag", "version", "tenant_id", "pid", "permission", "type", "name", "path", "icon", "sort", "status") VALUES (44, 1, 1, '2025-01-31 13:50:50.855744', '2025-01-31 13:50:50.856767', 0, 0, 0, 23, 'sys:menu:modify', 1, '修改', NULL, NULL, 30, 0);

-- ----------------------------
-- Table structure for boot_sys_menu_package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ public static String like(String str) {
return str;
}

public static String trim(String str) {
if (isNotEmpty(str)) {
return str.trim();
}
return str;
}

public static boolean isEmpty(String str) {
return !hasText(str);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,31 @@ public class LoginLogPageQry extends PageQuery {
private String errorMessage;

public void setUsername(String username) {
this.username = StringUtil.like(username.trim());
this.username = StringUtil.like(StringUtil.trim(username));
}

public void setIp(String ip) {
this.ip = StringUtil.like(ip.trim());
this.ip = StringUtil.like(StringUtil.trim(ip));
}

public void setAddress(String address) {
this.address = StringUtil.like(address.trim());
this.address = StringUtil.like(StringUtil.trim(address));
}

public void setBrowser(String browser) {
this.browser = StringUtil.like(browser.trim());
this.browser = StringUtil.like(StringUtil.trim(browser));
}

public void setOs(String os) {
this.os = StringUtil.like(os.trim());
this.os = StringUtil.like(StringUtil.trim(os));
}

public void setErrorMessage(String errorMessage) {
this.errorMessage = StringUtil.like(errorMessage.trim());
this.errorMessage = StringUtil.like(StringUtil.trim(errorMessage));
}

public void setType(String type) {
this.type = type.trim();
this.type = StringUtil.trim(type);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;
import org.laokou.common.i18n.dto.ClientObject;
import org.laokou.common.i18n.utils.StringUtil;

/**
* 菜单客户端对象.
Expand Down Expand Up @@ -78,19 +79,19 @@ public class MenuCO extends ClientObject {
private Integer status;

public void setName(String name) {
this.name = name.trim();
this.name = StringUtil.trim(name);
}

public void setIcon(String icon) {
this.icon = icon.trim();
this.icon = StringUtil.trim(icon);
}

public void setPath(String path) {
this.path = path.trim();
this.path = StringUtil.trim(path);
}

public void setPermission(String permission) {
this.permission = permission.trim();
this.permission = StringUtil.trim(permission);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public class NoticeLogPageQry extends PageQuery {
private String errorMessage;

public void setCode(String code) {
this.code = StringUtil.like(code.trim());
this.code = StringUtil.like(StringUtil.trim(code));
}

public void setName(String name) {
this.name = StringUtil.like(name.trim());
this.name = StringUtil.like(StringUtil.trim(name));
}

public void setErrorMessage(String errorMessage) {
this.errorMessage = StringUtil.like(errorMessage.trim());
this.errorMessage = StringUtil.like(StringUtil.trim(errorMessage));
}

}
22 changes: 11 additions & 11 deletions ui/src/pages/Sys/Log/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {ExportOutlined} from "@ant-design/icons";
import {trim} from "@/utils/format";
import {ExportToExcel} from "@/utils/export";
import moment from "moment";
import {useRef} from "react";
import {useRef, useState} from "react";
import {getLoginStatus, getLoginType, LOGIN_STATUS, LOGIN_TYPE} from "@/services/constant";

export default () => {
Expand All @@ -25,13 +25,11 @@ export default () => {
};

const actionRef = useRef();

let list: TableColumns[]

let param: any
const [list, setList] = useState<TableColumns[]>([]);
const [param, setParam] = useState<any>({});

const getPageQuery = (params: any) => {
param = {
const param = {
pageSize: params?.pageSize,
pageNum: params?.current,
pageIndex: params?.pageSize * (params?.current - 1),
Expand All @@ -47,8 +45,9 @@ export default () => {
startTime: params?.startDate ? `${params.startDate} 00:00:00` : undefined,
endTime: params?.endDate ? `${params.endDate} 23:59:59` : undefined
}
};
return param;
}
setParam(param)
return param
}

const columns: ProColumns<TableColumns>[] = [
Expand Down Expand Up @@ -140,13 +139,14 @@ export default () => {
columns={columns}
request={async (params) => {
// 表单搜索项会从 params 传入,传递给后端接口。
list = []
const list: TableColumns[] = []
return pageV3(getPageQuery(params)).then(res => {
res?.data?.records?.forEach((item: TableColumns) => {
item.status = item.status as '0';
item.type = item.type as '0';
list.push(item);
});
setList(list)
return Promise.resolve({
data: list,
total: parseInt(res.data.total),
Expand Down Expand Up @@ -178,8 +178,8 @@ export default () => {
sheetData: _list,
sheetFilter: ["username", "ip", "address", "browser", "os", "status", "errorMessage", "type", "createTime"],
sheetHeader: ["用户名", "IP地址", "归属地", "浏览器", "操作系统", "登录状态", "错误信息", "登录类型", "登录时间"],
fileName: "登录日志" + "_" + moment(new Date()).format('YYYYMMDDHHmmss'),
sheetName: "登录日志_导出_"
fileName: "登录日志_导出_" + moment(new Date()).format('YYYYMMDDHHmmss'),
sheetName: "登录日志"
})
}}>
导出
Expand Down
20 changes: 10 additions & 10 deletions ui/src/pages/Sys/Log/notice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ export default () => {
};

const actionRef = useRef();

let list: TableColumns[]

let param: any
const [list, setList] = useState<TableColumns[]>([]);
const [param, setParam] = useState<any>({});

const getPageQuery = (params: any) => {
param = {
const param = {
pageSize: params?.pageSize,
pageNum: params?.current,
pageIndex: params?.pageSize * (params?.current - 1),
Expand All @@ -48,8 +46,9 @@ export default () => {
startTime: params?.startDate ? `${params.startDate} 00:00:00` : undefined,
endTime: params?.endDate ? `${params.endDate} 23:59:59` : undefined
}
};
return param;
}
setParam(param)
return param
}

const columns: ProColumns<TableColumns>[] = [
Expand Down Expand Up @@ -111,7 +110,7 @@ export default () => {
valueType: 'option',
key: 'option',
render: (_, record) => [
<a key="getable"
<a key="get"
onClick={() => {
getByIdV3({id: record?.id}).then(res => {
setDataSource(res?.data)
Expand Down Expand Up @@ -197,12 +196,13 @@ export default () => {
columns={columns}
request={async (params) => {
// 表单搜索项会从 params 传入,传递给后端接口。
list = []
const list: TableColumns[] = []
return pageV3(getPageQuery(params)).then(res => {
res?.data?.records?.forEach((item: TableColumns) => {
item.status = statusEnum[item.status as '0'];
list.push(item);
});
setList(list)
return Promise.resolve({
data: list,
total: parseInt(res.data.total),
Expand Down Expand Up @@ -233,7 +233,7 @@ export default () => {
sheetData: _list,
sheetFilter: ["code", "name", "status", "param", "errorMessage", "createTime"],
sheetHeader: ["标识", "名称", "状态", "参数", "错误信息", "创建时间"],
fileName: "通知日志" + "_" + moment(new Date()).format('YYYYMMDDHHmmss'),
fileName: "通知日志_导出_" + moment(new Date()).format('YYYYMMDDHHmmss'),
sheetName: "通知日志"
})
}}>
Expand Down
Loading

0 comments on commit bfe6e85

Please sign in to comment.