feat: Add SHZ log inspection and HighGo database querying capabilities
- Introduced `inspect-shz-logs` skill for inspecting local and production logs with bounded read-only commands. - Added `view.sh` script for log viewing with options for following logs and filtering by keywords. - Created `query-shz-highgo` skill for querying the SHZ HighGo database through an SSH gateway. - Implemented read-only SQL execution with strict controls on allowed statements and query structure. - Added new domain and mapper classes for managing outdoor fair job associations. - Enhanced `OutdoorFairController` to support job listing and management for outdoor fairs. - Created SQL scripts for initializing outdoor fair job data and managing menu visibility.
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
package com.ruoyi.cms.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
|
||||
/**
|
||||
* 户外招聘会岗位关联表自动迁移。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class OutdoorFairJobMigration
|
||||
{
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@EventListener(ApplicationReadyEvent.class)
|
||||
public void migrate()
|
||||
{
|
||||
try (Connection connection = dataSource.getConnection();
|
||||
ResultSet tables = connection.getMetaData().getTables(
|
||||
connection.getCatalog(), "shz", "cms_outdoor_fair_job", new String[]{"TABLE"}))
|
||||
{
|
||||
if (tables.next())
|
||||
{
|
||||
log.info("户外招聘会岗位关联表已存在");
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("检查户外招聘会岗位关联表失败: {}", e.getMessage(), e);
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection connection = dataSource.getConnection();
|
||||
Statement statement = connection.createStatement())
|
||||
{
|
||||
statement.execute("CREATE SEQUENCE shz.cms_outdoor_fair_job_id_seq " +
|
||||
"START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1");
|
||||
statement.execute("CREATE TABLE shz.cms_outdoor_fair_job (" +
|
||||
"id BIGINT NOT NULL DEFAULT nextval('shz.cms_outdoor_fair_job_id_seq') PRIMARY KEY, " +
|
||||
"fair_id BIGINT NOT NULL, company_id BIGINT NOT NULL, " +
|
||||
"job_id BIGINT NOT NULL, create_by VARCHAR(64), create_time TIMESTAMP, " +
|
||||
"update_by VARCHAR(64), update_time TIMESTAMP, remark VARCHAR(500), " +
|
||||
"del_flag CHAR(1) DEFAULT '0')");
|
||||
statement.execute("CREATE UNIQUE INDEX uk_cms_outdoor_fair_job " +
|
||||
"ON shz.cms_outdoor_fair_job (fair_id, job_id)");
|
||||
statement.execute("CREATE INDEX idx_cms_outdoor_fair_job_company " +
|
||||
"ON shz.cms_outdoor_fair_job (fair_id, company_id)");
|
||||
log.info("户外招聘会岗位关联表检查完成");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("户外招聘会岗位关联表迁移失败: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user