diff --git a/packages/sqlite-plugin/src/entity/VBossLibrary.ts b/packages/sqlite-plugin/src/entity/VBossLibrary.ts new file mode 100644 index 0000000..d14959d --- /dev/null +++ b/packages/sqlite-plugin/src/entity/VBossLibrary.ts @@ -0,0 +1,30 @@ +import { requireTypeorm } from "../utils/module-loader"; +const { ViewEntity, ViewColumn } = requireTypeorm(); +@ViewEntity({ + expression: `SELECT + boss_info.encryptBossId, + boss_info.name, + boss_info.title, + company_info.name as companyName, + company_info.encryptCompanyId as encryptCompanyId + FROM + boss_info + LEFT JOIN company_info ON company_info.encryptCompanyId = boss_info.encryptCompanyId + `, +}) +export class VBossLibrary { + @ViewColumn() + encryptBossId: number; + + @ViewColumn() + name: string; + + @ViewColumn() + title: string; + + @ViewColumn() + companyName: number | null; + + @ViewColumn() + encryptCompanyId: number | null; +} diff --git a/packages/sqlite-plugin/src/entity/VCompanyLibrary.ts b/packages/sqlite-plugin/src/entity/VCompanyLibrary.ts new file mode 100644 index 0000000..5ac52b2 --- /dev/null +++ b/packages/sqlite-plugin/src/entity/VCompanyLibrary.ts @@ -0,0 +1,31 @@ +import { requireTypeorm } from "../utils/module-loader"; +const { ViewEntity, ViewColumn } = requireTypeorm(); +@ViewEntity({ + expression: `SELECT + company_info.* + FROM + company_info + `, +}) +export class VCompanyLibrary { + @ViewColumn() + encryptCompanyId: string; + + @ViewColumn() + name: string; + + @ViewColumn() + brandName: string; + + @ViewColumn() + scaleLow?: number; + + @ViewColumn() + scaleHigh?: number; + + @ViewColumn() + stageName?: string; + + @ViewColumn() + industryName?: string; +} diff --git a/packages/sqlite-plugin/src/entity/VJobLibrary.ts b/packages/sqlite-plugin/src/entity/VJobLibrary.ts new file mode 100644 index 0000000..a155e91 --- /dev/null +++ b/packages/sqlite-plugin/src/entity/VJobLibrary.ts @@ -0,0 +1,57 @@ +import { requireTypeorm } from "../utils/module-loader"; +const { ViewEntity, ViewColumn } = requireTypeorm(); +@ViewEntity({ + expression: `SELECT + job_info.*, + boss_info.name AS bossName, + boss_info.title AS bossTitle, + company_info.name AS companyName + FROM + job_info + LEFT JOIN boss_info ON boss_info.encryptBossId = job_info.encryptBossId + LEFT JOIN company_info ON company_info.encryptCompanyId = job_info.encryptCompanyId + `, +}) +export class VJobLibrary { + @ViewColumn() + encryptJobId: number; + + @ViewColumn() + jobName: string; + + @ViewColumn() + positionName: string; + + @ViewColumn() + salaryLow: number | null; + + @ViewColumn() + salaryHigh: number | null; + + @ViewColumn() + salaryMonth: number | null; + + @ViewColumn() + experienceName: number | null; + + @ViewColumn() + publishDate: Date | null; + + @ViewColumn() + degreeName: string; + + @ViewColumn() + address: string; + + @ViewColumn() + description: string; + + @ViewColumn() + bossName: string; + + @ViewColumn() + bossTitle: string; + + @ViewColumn() + companyName: string; +} diff --git a/packages/sqlite-plugin/src/index.ts b/packages/sqlite-plugin/src/index.ts index 68bf0ec..e010fc8 100644 --- a/packages/sqlite-plugin/src/index.ts +++ b/packages/sqlite-plugin/src/index.ts @@ -12,6 +12,9 @@ import { JobInfoChangeLog } from "./entity/JobInfoChangeLog"; import { BossActiveStatusRecord } from "./entity/BossActiveStatusRecord"; import { UserInfo } from "./entity/UserInfo"; import { VChatStartupLog } from "./entity/VChatStartupLog"; +import { VBossLibrary } from "./entity/VBossLibrary"; +import { VJobLibrary } from "./entity/VJobLibrary"; +import { VCompanyLibrary } from "./entity/VCompanyLibrary" import sqlite3 from 'sqlite3'; import * as cliHighlight from 'cli-highlight'; @@ -37,7 +40,10 @@ export function initDb(dbFilePath) { JobInfoChangeLog, BossActiveStatusRecord, UserInfo, - VChatStartupLog + VChatStartupLog, + VBossLibrary, + VJobLibrary, + VCompanyLibrary ], }); return appDataSource.initialize(); diff --git a/packages/sqlite-plugin/src/utils/parser.ts b/packages/sqlite-plugin/src/utils/parser.ts index 08f5b79..d0f67a7 100644 --- a/packages/sqlite-plugin/src/utils/parser.ts +++ b/packages/sqlite-plugin/src/utils/parser.ts @@ -24,6 +24,19 @@ export const parseCompanyScale = (str: string): [number| null, number | null] => return [null, null] } +export function formatCompanyScale(low, high) { + if (low === null && high === null) { + return '' + } + if (low === null && high !== null) { + return `${high}人以下` + } + if (low !== null && high === null) { + return `${low}人以上` + } + return `${low}-${high}人` +} + export const parseSalary = (str: string): { low: null | number, high: null | number, month: null | number } => { const result = { high: null, diff --git a/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/ipc/index.ts b/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/ipc/index.ts index 0bd81dc..22e51ac 100644 --- a/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/ipc/index.ts +++ b/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/ipc/index.ts @@ -17,7 +17,12 @@ import { getAnyAvailablePuppeteerExecutable } from '../../../flow/CHECK_AND_DOWN import { sleep } from '@geekgeekrun/utils/sleep.mjs' import { AUTO_CHAT_ERROR_EXIT_CODE } from '../../../../common/enums/auto-start-chat' import { mainWindow } from '../../../window/mainWindow' -import { getAutoStartChatRecord } from '../utils/db/index' +import { + getAutoStartChatRecord, + getBossLibrary, + getCompanyLibrary, + getJobLibrary +} from '../utils/db/index' import { PageReq } from '../../../../common/types/pagination' export default function initIpc() { @@ -264,6 +269,18 @@ export default function initIpc() { const a = await getAutoStartChatRecord(payload) return a }) + ipcMain.handle('get-job-library', async (ev, payload: PageReq) => { + const a = await getJobLibrary(payload) + return a + }) + ipcMain.handle('get-boss-library', async (ev, payload: PageReq) => { + const a = await getBossLibrary(payload) + return a + }) + ipcMain.handle('get-company-library', async (ev, payload: PageReq) => { + const a = await getCompanyLibrary(payload) + return a + }) let subProcessOfOpenBossSite: ChildProcess | undefined let subProcessOfOpenBossSiteLaunching = false diff --git a/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/utils/db/index.ts b/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/utils/db/index.ts index 7f20e73..6de3718 100644 --- a/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/utils/db/index.ts +++ b/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/utils/db/index.ts @@ -58,3 +58,30 @@ export const getAutoStartChatRecord = async ({ pageNo, pageSize }: Partial = {}) => { + const res = await createWorkerPromise({ + type: 'getBossLibrary', + pageNo, + pageSize + }) + return res +} + +export const getCompanyLibrary = async ({ pageNo, pageSize }: Partial = {}) => { + const res = await createWorkerPromise({ + type: 'getCompanyLibrary', + pageNo, + pageSize + }) + return res +} + +export const getJobLibrary = async ({ pageNo, pageSize }: Partial = {}) => { + const res = await createWorkerPromise({ + type: 'getJobLibrary', + pageNo, + pageSize + }) + return res +} diff --git a/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/utils/db/worker/index.ts b/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/utils/db/worker/index.ts index b34529e..f77d875 100644 --- a/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/utils/db/worker/index.ts +++ b/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/utils/db/worker/index.ts @@ -4,6 +4,9 @@ import { initDb } from '@geekgeekrun/sqlite-plugin' import { type DataSource } from 'typeorm' import { getPublicDbFilePath } from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs' import { VChatStartupLog } from '@geekgeekrun/sqlite-plugin/dist/entity/VChatStartupLog' +import { VJobLibrary } from '@geekgeekrun/sqlite-plugin/dist/entity/VJobLibrary' +import { VCompanyLibrary } from '@geekgeekrun/sqlite-plugin/dist/entity/VCompanyLibrary' +import { VBossLibrary } from '@geekgeekrun/sqlite-plugin/dist/entity/VBossLibrary' import { measureExecutionTime } from '../../../../../../common/utils/performance' import { PageReq, PagedRes } from '../../../../../../common/types/pagination' @@ -50,6 +53,73 @@ const payloadHandler = { pageNo, totalItemCount } + }, + async getJobLibrary({ pageNo, pageSize }: Partial = {}): Promise> { + if (!pageNo) { + pageNo = 1 + } + if (!pageSize) { + pageSize = 10 + } + + const userRepository = dataSource!.getRepository(VJobLibrary)! + const [data, totalItemCount] = await measureExecutionTime( + userRepository.findAndCount({ + skip: (pageNo - 1) * pageSize, + take: pageSize + }) + ) + return { + data, + pageNo, + totalItemCount + } + }, + async getCompanyLibrary({ pageNo, pageSize }: Partial = {}): Promise< + PagedRes + > { + if (!pageNo) { + pageNo = 1 + } + if (!pageSize) { + pageSize = 10 + } + + const userRepository = dataSource!.getRepository(VCompanyLibrary)! + const [data, totalItemCount] = await measureExecutionTime( + userRepository.findAndCount({ + skip: (pageNo - 1) * pageSize, + take: pageSize + }) + ) + return { + data, + pageNo, + totalItemCount + } + }, + async getBossLibrary({ pageNo, pageSize }: Partial = {}): Promise< + PagedRes + > { + if (!pageNo) { + pageNo = 1 + } + if (!pageSize) { + pageSize = 10 + } + + const userRepository = dataSource!.getRepository(VBossLibrary)! + const [data, totalItemCount] = await measureExecutionTime( + userRepository.findAndCount({ + skip: (pageNo - 1) * pageSize, + take: pageSize + }) + ) + return { + data, + pageNo, + totalItemCount + } } } diff --git a/packages/ui/src/renderer/src/page/Configuration/BossLibrary.vue b/packages/ui/src/renderer/src/page/Configuration/BossLibrary.vue new file mode 100644 index 0000000..5fef83d --- /dev/null +++ b/packages/ui/src/renderer/src/page/Configuration/BossLibrary.vue @@ -0,0 +1,113 @@ + + + + + diff --git a/packages/ui/src/renderer/src/page/Configuration/CompanyLibrary.vue b/packages/ui/src/renderer/src/page/Configuration/CompanyLibrary.vue new file mode 100644 index 0000000..bf40837 --- /dev/null +++ b/packages/ui/src/renderer/src/page/Configuration/CompanyLibrary.vue @@ -0,0 +1,123 @@ + + + + + diff --git a/packages/ui/src/renderer/src/page/Configuration/JobLibrary.vue b/packages/ui/src/renderer/src/page/Configuration/JobLibrary.vue new file mode 100644 index 0000000..c90e485 --- /dev/null +++ b/packages/ui/src/renderer/src/page/Configuration/JobLibrary.vue @@ -0,0 +1,124 @@ + + + + + diff --git a/packages/ui/src/renderer/src/page/Configuration/index.vue b/packages/ui/src/renderer/src/page/Configuration/index.vue index 746277b..73d5336 100644 --- a/packages/ui/src/renderer/src/page/Configuration/index.vue +++ b/packages/ui/src/renderer/src/page/Configuration/index.vue @@ -3,8 +3,11 @@
当前版本: {{ buildInfo.version }}({{ buildInfo.buildVersion }})
diff --git a/packages/ui/src/renderer/src/router/index.ts b/packages/ui/src/renderer/src/router/index.ts index 7b74546..8204b7b 100644 --- a/packages/ui/src/renderer/src/router/index.ts +++ b/packages/ui/src/renderer/src/router/index.ts @@ -34,6 +34,27 @@ const routes: Array = [ meta: { title: '开聊记录' } + }, + { + path: 'JobLibrary', + component: () => import('@renderer/page/Configuration/JobLibrary.vue'), + meta: { + title: '职位库' + } + }, + { + path: 'BossLibrary', + component: () => import('@renderer/page/Configuration/BossLibrary.vue'), + meta: { + title: 'Boss库' + } + }, + { + path: 'CompanyLibrary', + component: () => import('@renderer/page/Configuration/CompanyLibrary.vue'), + meta: { + title: '公司库' + } } ] },