mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-06-01 21:50:02 +08:00
add the view of BossLibrary、CompanyLibrary、JobLibrary
This commit is contained in:
30
packages/sqlite-plugin/src/entity/VBossLibrary.ts
Normal file
30
packages/sqlite-plugin/src/entity/VBossLibrary.ts
Normal file
@@ -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;
|
||||
}
|
||||
31
packages/sqlite-plugin/src/entity/VCompanyLibrary.ts
Normal file
31
packages/sqlite-plugin/src/entity/VCompanyLibrary.ts
Normal file
@@ -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;
|
||||
}
|
||||
57
packages/sqlite-plugin/src/entity/VJobLibrary.ts
Normal file
57
packages/sqlite-plugin/src/entity/VJobLibrary.ts
Normal file
@@ -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;
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user