diff --git a/src/main/java/neatlogic/module/tenant/api/changelog/SearchChangeLogAuditListApi.java b/src/main/java/neatlogic/module/tenant/api/changelog/SearchChangeLogAuditListApi.java new file mode 100644 index 0000000000000000000000000000000000000000..75cefa33c4b0d573b3018c98d0cbf77571ceb690 --- /dev/null +++ b/src/main/java/neatlogic/module/tenant/api/changelog/SearchChangeLogAuditListApi.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.module.tenant.api.changelog; + +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.asynchronization.threadlocal.TenantContext; +import neatlogic.framework.common.constvalue.ApiParamType; +import neatlogic.framework.common.dto.BasePageVo; +import neatlogic.framework.dto.ChangelogAuditVo; +import neatlogic.framework.restful.annotation.*; +import neatlogic.framework.restful.constvalue.OperationTypeEnum; +import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; +import neatlogic.framework.util.TableResultUtil; +import neatlogic.module.tenant.dao.mapper.ChangelogAuditMapper; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +@Service +@OperationType(type = OperationTypeEnum.SEARCH) +public class SearchChangeLogAuditListApi extends PrivateApiComponentBase { + + @Resource + private ChangelogAuditMapper changelogAuditMapper; + + @Override + public String getName() { + return "nmtac.searchchangelogauditlistapi.getname"; + } + + @Input({ + @Param(name = "keyword", type = ApiParamType.STRING, desc = "common.keyword"), + @Param(name = "moduleId", type = ApiParamType.STRING, desc = "term.cmdb.moduleid"), + @Param(name = "sqlStatus", type = ApiParamType.ENUM, rule = "0,1", desc = "common.status"), + @Param(name = "version", type = ApiParamType.STRING, desc = "common.versionnum"), + @Param(name = "currentPage", type = ApiParamType.INTEGER, desc = "common.currentpage"), + @Param(name = "pageSize", type = ApiParamType.INTEGER, desc = "common.pagesize"), + }) + @Output({ + @Param(explode = BasePageVo.class), + @Param(name = "tbodyList", type = ApiParamType.JSONARRAY, desc = "common.tbodylist") + }) + @Description(desc = "查询数据库变更记录列表") + @Override + public Object myDoService(JSONObject paramObj) throws Exception { + List changelogAuditList = new ArrayList<>(); + ChangelogAuditVo changelogAuditVo = paramObj.toJavaObject(ChangelogAuditVo.class); + changelogAuditVo.setTenantUuid(TenantContext.get().getTenantUuid()); + int rowNum = changelogAuditMapper.getChangelogAuditCount(changelogAuditVo); + if (rowNum > 0) { + changelogAuditVo.setRowNum(rowNum); + changelogAuditList = changelogAuditMapper.getChangelogAuditList(changelogAuditVo); + } + return TableResultUtil.getResult(changelogAuditList, changelogAuditVo); + } + + @Override + public String getToken() { + return "changelog/audit/search"; + } +} diff --git a/src/main/java/neatlogic/module/tenant/dao/mapper/ChangelogAuditMapper.java b/src/main/java/neatlogic/module/tenant/dao/mapper/ChangelogAuditMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..0bcf3239073a2e5837e139c89838b7a68289ddde --- /dev/null +++ b/src/main/java/neatlogic/module/tenant/dao/mapper/ChangelogAuditMapper.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.module.tenant.dao.mapper; + +import neatlogic.framework.dao.aop.UseMasterDatabase; +import neatlogic.framework.dto.ChangelogAuditVo; + +import java.util.List; + +@UseMasterDatabase +public interface ChangelogAuditMapper { + int getChangelogAuditCount(ChangelogAuditVo changelogAuditVo); + + List getChangelogAuditList(ChangelogAuditVo changelogAuditVo); +} diff --git a/src/main/java/neatlogic/module/tenant/dao/mapper/ChangelogAuditMapper.xml b/src/main/java/neatlogic/module/tenant/dao/mapper/ChangelogAuditMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..5b84a0ce76cde8b4530872565ccdeed74eb8a78a --- /dev/null +++ b/src/main/java/neatlogic/module/tenant/dao/mapper/ChangelogAuditMapper.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + \ No newline at end of file