create-yss-spec 2.1.6 → 2.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/.agents/skills/yss-ddd-scaffold-generator/SKILL.md +1 -1
- package/template/.agents/skills/yss-domain/SKILL.md +2 -2
- package/template/.agents/skills/yss-dto/SKILL.md +19 -4
- package/template/.agents/skills/yss-dto/agents/openai.yaml +1 -1
- package/template/.agents/skills/yss-dto/references/README.md +9 -2
- package/template/.agents/skills/yss-dto/references/openapi-wire-profile.yaml +181 -0
- package/template/.agents/skills/yss-mybatis/SKILL.md +1 -1
- package/template/.agents/skills/yss-openapi-draft-review/SKILL.md +18 -6
- package/template/.agents/skills/yss-openapi-governance/SKILL.md +11 -1
- package/template/.agents/skills/yss-repository/SKILL.md +2 -2
- package/template/.agents/skills/yss-router/references/boundaries.md +0 -3
- package/template/.agents/skills/yss-source-index/references/source-map-config.md +0 -2
- package/template/.agents/skills/yss-source-index/scripts/refresh-yss-skill-index.mjs +1 -1
- package/template/.agents/skills/yss-web-controller/SKILL.md +1 -1
- package/template/.claude/skills/yss-ddd-scaffold-generator/SKILL.md +1 -1
- package/template/.claude/skills/yss-domain/SKILL.md +2 -2
- package/template/.claude/skills/yss-dto/SKILL.md +19 -4
- package/template/.claude/skills/yss-dto/agents/openai.yaml +1 -1
- package/template/.claude/skills/yss-dto/references/README.md +9 -2
- package/template/.claude/skills/yss-dto/references/openapi-wire-profile.yaml +181 -0
- package/template/.claude/skills/yss-mybatis/SKILL.md +1 -1
- package/template/.claude/skills/yss-openapi-draft-review/SKILL.md +18 -6
- package/template/.claude/skills/yss-openapi-governance/SKILL.md +11 -1
- package/template/.claude/skills/yss-repository/SKILL.md +2 -2
- package/template/.claude/skills/yss-router/references/boundaries.md +0 -3
- package/template/.claude/skills/yss-source-index/references/source-map-config.md +0 -2
- package/template/.claude/skills/yss-source-index/scripts/refresh-yss-skill-index.mjs +1 -1
- package/template/.claude/skills/yss-web-controller/SKILL.md +1 -1
- package/template/.codex/skills/yss-ddd-scaffold-generator/SKILL.md +1 -1
- package/template/.codex/skills/yss-domain/SKILL.md +2 -2
- package/template/.codex/skills/yss-dto/SKILL.md +19 -4
- package/template/.codex/skills/yss-dto/agents/openai.yaml +1 -1
- package/template/.codex/skills/yss-dto/references/README.md +9 -2
- package/template/.codex/skills/yss-dto/references/openapi-wire-profile.yaml +181 -0
- package/template/.codex/skills/yss-mybatis/SKILL.md +1 -1
- package/template/.codex/skills/yss-openapi-draft-review/SKILL.md +18 -6
- package/template/.codex/skills/yss-openapi-governance/SKILL.md +11 -1
- package/template/.codex/skills/yss-repository/SKILL.md +2 -2
- package/template/.codex/skills/yss-router/references/boundaries.md +0 -3
- package/template/.codex/skills/yss-source-index/references/source-map-config.md +0 -2
- package/template/.codex/skills/yss-source-index/scripts/refresh-yss-skill-index.mjs +1 -1
- package/template/.codex/skills/yss-web-controller/SKILL.md +1 -1
- package/template/.github/workflows/template-node-tooling.yml +2 -0
- package/template/.hermes/skills/yss-ddd-scaffold-generator/SKILL.md +1 -1
- package/template/.hermes/skills/yss-domain/SKILL.md +2 -2
- package/template/.hermes/skills/yss-dto/SKILL.md +19 -4
- package/template/.hermes/skills/yss-dto/agents/openai.yaml +1 -1
- package/template/.hermes/skills/yss-dto/references/README.md +9 -2
- package/template/.hermes/skills/yss-dto/references/openapi-wire-profile.yaml +181 -0
- package/template/.hermes/skills/yss-mybatis/SKILL.md +1 -1
- package/template/.hermes/skills/yss-openapi-draft-review/SKILL.md +18 -6
- package/template/.hermes/skills/yss-openapi-governance/SKILL.md +11 -1
- package/template/.hermes/skills/yss-repository/SKILL.md +2 -2
- package/template/.hermes/skills/yss-router/references/boundaries.md +0 -3
- package/template/.hermes/skills/yss-source-index/references/source-map-config.md +0 -2
- package/template/.hermes/skills/yss-source-index/scripts/refresh-yss-skill-index.mjs +1 -1
- package/template/.hermes/skills/yss-web-controller/SKILL.md +1 -1
- package/template/.pi/skills/yss-ddd-scaffold-generator/SKILL.md +1 -1
- package/template/.pi/skills/yss-domain/SKILL.md +2 -2
- package/template/.pi/skills/yss-dto/SKILL.md +19 -4
- package/template/.pi/skills/yss-dto/agents/openai.yaml +1 -1
- package/template/.pi/skills/yss-dto/references/README.md +9 -2
- package/template/.pi/skills/yss-dto/references/openapi-wire-profile.yaml +181 -0
- package/template/.pi/skills/yss-mybatis/SKILL.md +1 -1
- package/template/.pi/skills/yss-openapi-draft-review/SKILL.md +18 -6
- package/template/.pi/skills/yss-openapi-governance/SKILL.md +11 -1
- package/template/.pi/skills/yss-repository/SKILL.md +2 -2
- package/template/.pi/skills/yss-router/references/boundaries.md +0 -3
- package/template/.pi/skills/yss-source-index/references/source-map-config.md +0 -2
- package/template/.pi/skills/yss-source-index/scripts/refresh-yss-skill-index.mjs +1 -1
- package/template/.pi/skills/yss-web-controller/SKILL.md +1 -1
- package/template/.qoder/skills/yss-ddd-scaffold-generator/SKILL.md +1 -1
- package/template/.qoder/skills/yss-domain/SKILL.md +2 -2
- package/template/.qoder/skills/yss-dto/SKILL.md +19 -4
- package/template/.qoder/skills/yss-dto/agents/openai.yaml +1 -1
- package/template/.qoder/skills/yss-dto/references/README.md +9 -2
- package/template/.qoder/skills/yss-dto/references/openapi-wire-profile.yaml +181 -0
- package/template/.qoder/skills/yss-mybatis/SKILL.md +1 -1
- package/template/.qoder/skills/yss-openapi-draft-review/SKILL.md +18 -6
- package/template/.qoder/skills/yss-openapi-governance/SKILL.md +11 -1
- package/template/.qoder/skills/yss-repository/SKILL.md +2 -2
- package/template/.qoder/skills/yss-router/references/boundaries.md +0 -3
- package/template/.qoder/skills/yss-source-index/references/source-map-config.md +0 -2
- package/template/.qoder/skills/yss-source-index/scripts/refresh-yss-skill-index.mjs +1 -1
- package/template/.qoder/skills/yss-web-controller/SKILL.md +1 -1
- package/template/.trae/skills/yss-ddd-scaffold-generator/SKILL.md +1 -1
- package/template/.trae/skills/yss-domain/SKILL.md +2 -2
- package/template/.trae/skills/yss-dto/SKILL.md +19 -4
- package/template/.trae/skills/yss-dto/agents/openai.yaml +1 -1
- package/template/.trae/skills/yss-dto/references/README.md +9 -2
- package/template/.trae/skills/yss-dto/references/openapi-wire-profile.yaml +181 -0
- package/template/.trae/skills/yss-mybatis/SKILL.md +1 -1
- package/template/.trae/skills/yss-openapi-draft-review/SKILL.md +18 -6
- package/template/.trae/skills/yss-openapi-governance/SKILL.md +11 -1
- package/template/.trae/skills/yss-repository/SKILL.md +2 -2
- package/template/.trae/skills/yss-router/references/boundaries.md +0 -3
- package/template/.trae/skills/yss-source-index/references/source-map-config.md +0 -2
- package/template/.trae/skills/yss-source-index/scripts/refresh-yss-skill-index.mjs +1 -1
- package/template/.trae/skills/yss-web-controller/SKILL.md +1 -1
- package/template/CONTEXT.md +4 -0
- package/template/docs/api/templates/openapi-draft-review-checklist.md +6 -0
- package/template/scripts/lib/scenario-checks.mjs +21 -0
- package/template/scripts/lib/skill-supply-chain.mjs +1 -1
- package/template/scripts/verify-template +4 -2
- package/template/scripts/verify-yss-dto-openapi-profile +109 -0
- package/template/scripts/verify-yss-dto-openapi-scenarios +4 -0
- package/template/skills-lock.json +10 -55
- package/template/wiki/wiki/YSS/345/267/245/347/250/213/346/212/200/350/203/275/344/275/223/347/263/273.md +1 -1
- package/template/yss-public-skills.json +1 -7
- package/template.manifest.json +3 -1
- package/template.snapshot.json +4 -4
- package/template/.agents/skills/yss-db2mybatis/SKILL.md +0 -95
- package/template/.agents/skills/yss-db2mybatis/agents/openai.yaml +0 -5
- package/template/.agents/skills/yss-db2mybatis/assets/$.java +0 -19
- package/template/.agents/skills/yss-db2mybatis/assets/convertor.java.template +0 -22
- package/template/.agents/skills/yss-db2mybatis/assets/domain_gateway.java.template +0 -45
- package/template/.agents/skills/yss-db2mybatis/assets/domain_model.java.template +0 -16
- package/template/.agents/skills/yss-db2mybatis/assets/gateway_impl.java.template +0 -62
- package/template/.agents/skills/yss-db2mybatis/assets/po.java.template +0 -18
- package/template/.agents/skills/yss-db2mybatis/assets/repository.java.template +0 -7
- package/template/.agents/skills/yss-db2mybatis/config/metadata.json +0 -334
- package/template/.agents/skills/yss-db2mybatis/config/temp_datasource.json +0 -12
- package/template/.agents/skills/yss-db2mybatis/references/datasource-config.example.json +0 -46
- package/template/.agents/skills/yss-db2mybatis/references/project-convention.example.json +0 -14
- package/template/.agents/skills/yss-db2mybatis/references/type-mapping.json +0 -31
- package/template/.agents/skills/yss-db2mybatis/scripts/db2mybatis.mjs +0 -145
- package/template/.agents/skills/yss-db2mybatis/scripts/db2mybatis.test.mjs +0 -32
- package/template/.agents/skills/yss-valuation/SKILL.md +0 -40
- package/template/.agents/skills/yss-valuation/agents/openai.yaml +0 -4
- package/template/.agents/skills/yss-valuation/references/source-index.md +0 -37
- package/template/.agents/skills/yss-variable/SKILL.md +0 -47
- package/template/.agents/skills/yss-variable/agents/openai.yaml +0 -4
- package/template/.agents/skills/yss-variable/references/source-index.md +0 -32
- package/template/.claude/skills/yss-db2mybatis/SKILL.md +0 -95
- package/template/.claude/skills/yss-db2mybatis/agents/openai.yaml +0 -5
- package/template/.claude/skills/yss-db2mybatis/assets/$.java +0 -19
- package/template/.claude/skills/yss-db2mybatis/assets/convertor.java.template +0 -22
- package/template/.claude/skills/yss-db2mybatis/assets/domain_gateway.java.template +0 -45
- package/template/.claude/skills/yss-db2mybatis/assets/domain_model.java.template +0 -16
- package/template/.claude/skills/yss-db2mybatis/assets/gateway_impl.java.template +0 -62
- package/template/.claude/skills/yss-db2mybatis/assets/po.java.template +0 -18
- package/template/.claude/skills/yss-db2mybatis/assets/repository.java.template +0 -7
- package/template/.claude/skills/yss-db2mybatis/config/metadata.json +0 -334
- package/template/.claude/skills/yss-db2mybatis/config/temp_datasource.json +0 -12
- package/template/.claude/skills/yss-db2mybatis/references/datasource-config.example.json +0 -46
- package/template/.claude/skills/yss-db2mybatis/references/project-convention.example.json +0 -14
- package/template/.claude/skills/yss-db2mybatis/references/type-mapping.json +0 -31
- package/template/.claude/skills/yss-db2mybatis/scripts/db2mybatis.mjs +0 -145
- package/template/.claude/skills/yss-db2mybatis/scripts/db2mybatis.test.mjs +0 -32
- package/template/.claude/skills/yss-valuation/SKILL.md +0 -40
- package/template/.claude/skills/yss-valuation/agents/openai.yaml +0 -4
- package/template/.claude/skills/yss-valuation/references/source-index.md +0 -37
- package/template/.claude/skills/yss-variable/SKILL.md +0 -47
- package/template/.claude/skills/yss-variable/agents/openai.yaml +0 -4
- package/template/.claude/skills/yss-variable/references/source-index.md +0 -32
- package/template/.codex/skills/yss-db2mybatis/SKILL.md +0 -95
- package/template/.codex/skills/yss-db2mybatis/agents/openai.yaml +0 -5
- package/template/.codex/skills/yss-db2mybatis/assets/$.java +0 -19
- package/template/.codex/skills/yss-db2mybatis/assets/convertor.java.template +0 -22
- package/template/.codex/skills/yss-db2mybatis/assets/domain_gateway.java.template +0 -45
- package/template/.codex/skills/yss-db2mybatis/assets/domain_model.java.template +0 -16
- package/template/.codex/skills/yss-db2mybatis/assets/gateway_impl.java.template +0 -62
- package/template/.codex/skills/yss-db2mybatis/assets/po.java.template +0 -18
- package/template/.codex/skills/yss-db2mybatis/assets/repository.java.template +0 -7
- package/template/.codex/skills/yss-db2mybatis/config/metadata.json +0 -334
- package/template/.codex/skills/yss-db2mybatis/config/temp_datasource.json +0 -12
- package/template/.codex/skills/yss-db2mybatis/references/datasource-config.example.json +0 -46
- package/template/.codex/skills/yss-db2mybatis/references/project-convention.example.json +0 -14
- package/template/.codex/skills/yss-db2mybatis/references/type-mapping.json +0 -31
- package/template/.codex/skills/yss-db2mybatis/scripts/db2mybatis.mjs +0 -145
- package/template/.codex/skills/yss-db2mybatis/scripts/db2mybatis.test.mjs +0 -32
- package/template/.codex/skills/yss-valuation/SKILL.md +0 -40
- package/template/.codex/skills/yss-valuation/agents/openai.yaml +0 -4
- package/template/.codex/skills/yss-valuation/references/source-index.md +0 -37
- package/template/.codex/skills/yss-variable/SKILL.md +0 -47
- package/template/.codex/skills/yss-variable/agents/openai.yaml +0 -4
- package/template/.codex/skills/yss-variable/references/source-index.md +0 -32
- package/template/.hermes/skills/yss-db2mybatis/SKILL.md +0 -95
- package/template/.hermes/skills/yss-db2mybatis/agents/openai.yaml +0 -5
- package/template/.hermes/skills/yss-db2mybatis/assets/$.java +0 -19
- package/template/.hermes/skills/yss-db2mybatis/assets/convertor.java.template +0 -22
- package/template/.hermes/skills/yss-db2mybatis/assets/domain_gateway.java.template +0 -45
- package/template/.hermes/skills/yss-db2mybatis/assets/domain_model.java.template +0 -16
- package/template/.hermes/skills/yss-db2mybatis/assets/gateway_impl.java.template +0 -62
- package/template/.hermes/skills/yss-db2mybatis/assets/po.java.template +0 -18
- package/template/.hermes/skills/yss-db2mybatis/assets/repository.java.template +0 -7
- package/template/.hermes/skills/yss-db2mybatis/config/metadata.json +0 -334
- package/template/.hermes/skills/yss-db2mybatis/config/temp_datasource.json +0 -12
- package/template/.hermes/skills/yss-db2mybatis/references/datasource-config.example.json +0 -46
- package/template/.hermes/skills/yss-db2mybatis/references/project-convention.example.json +0 -14
- package/template/.hermes/skills/yss-db2mybatis/references/type-mapping.json +0 -31
- package/template/.hermes/skills/yss-db2mybatis/scripts/db2mybatis.mjs +0 -145
- package/template/.hermes/skills/yss-db2mybatis/scripts/db2mybatis.test.mjs +0 -32
- package/template/.hermes/skills/yss-valuation/SKILL.md +0 -40
- package/template/.hermes/skills/yss-valuation/agents/openai.yaml +0 -4
- package/template/.hermes/skills/yss-valuation/references/source-index.md +0 -37
- package/template/.hermes/skills/yss-variable/SKILL.md +0 -47
- package/template/.hermes/skills/yss-variable/agents/openai.yaml +0 -4
- package/template/.hermes/skills/yss-variable/references/source-index.md +0 -32
- package/template/.pi/skills/yss-db2mybatis/SKILL.md +0 -95
- package/template/.pi/skills/yss-db2mybatis/agents/openai.yaml +0 -5
- package/template/.pi/skills/yss-db2mybatis/assets/$.java +0 -19
- package/template/.pi/skills/yss-db2mybatis/assets/convertor.java.template +0 -22
- package/template/.pi/skills/yss-db2mybatis/assets/domain_gateway.java.template +0 -45
- package/template/.pi/skills/yss-db2mybatis/assets/domain_model.java.template +0 -16
- package/template/.pi/skills/yss-db2mybatis/assets/gateway_impl.java.template +0 -62
- package/template/.pi/skills/yss-db2mybatis/assets/po.java.template +0 -18
- package/template/.pi/skills/yss-db2mybatis/assets/repository.java.template +0 -7
- package/template/.pi/skills/yss-db2mybatis/config/metadata.json +0 -334
- package/template/.pi/skills/yss-db2mybatis/config/temp_datasource.json +0 -12
- package/template/.pi/skills/yss-db2mybatis/references/datasource-config.example.json +0 -46
- package/template/.pi/skills/yss-db2mybatis/references/project-convention.example.json +0 -14
- package/template/.pi/skills/yss-db2mybatis/references/type-mapping.json +0 -31
- package/template/.pi/skills/yss-db2mybatis/scripts/db2mybatis.mjs +0 -145
- package/template/.pi/skills/yss-db2mybatis/scripts/db2mybatis.test.mjs +0 -32
- package/template/.pi/skills/yss-valuation/SKILL.md +0 -40
- package/template/.pi/skills/yss-valuation/agents/openai.yaml +0 -4
- package/template/.pi/skills/yss-valuation/references/source-index.md +0 -37
- package/template/.pi/skills/yss-variable/SKILL.md +0 -47
- package/template/.pi/skills/yss-variable/agents/openai.yaml +0 -4
- package/template/.pi/skills/yss-variable/references/source-index.md +0 -32
- package/template/.qoder/skills/yss-db2mybatis/SKILL.md +0 -95
- package/template/.qoder/skills/yss-db2mybatis/agents/openai.yaml +0 -5
- package/template/.qoder/skills/yss-db2mybatis/assets/$.java +0 -19
- package/template/.qoder/skills/yss-db2mybatis/assets/convertor.java.template +0 -22
- package/template/.qoder/skills/yss-db2mybatis/assets/domain_gateway.java.template +0 -45
- package/template/.qoder/skills/yss-db2mybatis/assets/domain_model.java.template +0 -16
- package/template/.qoder/skills/yss-db2mybatis/assets/gateway_impl.java.template +0 -62
- package/template/.qoder/skills/yss-db2mybatis/assets/po.java.template +0 -18
- package/template/.qoder/skills/yss-db2mybatis/assets/repository.java.template +0 -7
- package/template/.qoder/skills/yss-db2mybatis/config/metadata.json +0 -334
- package/template/.qoder/skills/yss-db2mybatis/config/temp_datasource.json +0 -12
- package/template/.qoder/skills/yss-db2mybatis/references/datasource-config.example.json +0 -46
- package/template/.qoder/skills/yss-db2mybatis/references/project-convention.example.json +0 -14
- package/template/.qoder/skills/yss-db2mybatis/references/type-mapping.json +0 -31
- package/template/.qoder/skills/yss-db2mybatis/scripts/db2mybatis.mjs +0 -145
- package/template/.qoder/skills/yss-db2mybatis/scripts/db2mybatis.test.mjs +0 -32
- package/template/.qoder/skills/yss-valuation/SKILL.md +0 -40
- package/template/.qoder/skills/yss-valuation/agents/openai.yaml +0 -4
- package/template/.qoder/skills/yss-valuation/references/source-index.md +0 -37
- package/template/.qoder/skills/yss-variable/SKILL.md +0 -47
- package/template/.qoder/skills/yss-variable/agents/openai.yaml +0 -4
- package/template/.qoder/skills/yss-variable/references/source-index.md +0 -32
- package/template/.trae/skills/yss-db2mybatis/SKILL.md +0 -95
- package/template/.trae/skills/yss-db2mybatis/agents/openai.yaml +0 -5
- package/template/.trae/skills/yss-db2mybatis/assets/$.java +0 -19
- package/template/.trae/skills/yss-db2mybatis/assets/convertor.java.template +0 -22
- package/template/.trae/skills/yss-db2mybatis/assets/domain_gateway.java.template +0 -45
- package/template/.trae/skills/yss-db2mybatis/assets/domain_model.java.template +0 -16
- package/template/.trae/skills/yss-db2mybatis/assets/gateway_impl.java.template +0 -62
- package/template/.trae/skills/yss-db2mybatis/assets/po.java.template +0 -18
- package/template/.trae/skills/yss-db2mybatis/assets/repository.java.template +0 -7
- package/template/.trae/skills/yss-db2mybatis/config/metadata.json +0 -334
- package/template/.trae/skills/yss-db2mybatis/config/temp_datasource.json +0 -12
- package/template/.trae/skills/yss-db2mybatis/references/datasource-config.example.json +0 -46
- package/template/.trae/skills/yss-db2mybatis/references/project-convention.example.json +0 -14
- package/template/.trae/skills/yss-db2mybatis/references/type-mapping.json +0 -31
- package/template/.trae/skills/yss-db2mybatis/scripts/db2mybatis.mjs +0 -145
- package/template/.trae/skills/yss-db2mybatis/scripts/db2mybatis.test.mjs +0 -32
- package/template/.trae/skills/yss-valuation/SKILL.md +0 -40
- package/template/.trae/skills/yss-valuation/agents/openai.yaml +0 -4
- package/template/.trae/skills/yss-valuation/references/source-index.md +0 -37
- package/template/.trae/skills/yss-variable/SKILL.md +0 -47
- package/template/.trae/skills/yss-variable/agents/openai.yaml +0 -4
- package/template/.trae/skills/yss-variable/references/source-index.md +0 -32
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import os from 'node:os';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import { spawnSync } from 'node:child_process';
|
|
6
|
-
import test from 'node:test';
|
|
7
|
-
|
|
8
|
-
const skillRoot = path.resolve(import.meta.dirname, '..');
|
|
9
|
-
const script = path.join(skillRoot, 'scripts', 'db2mybatis.mjs');
|
|
10
|
-
const run = (args, cwd = process.cwd()) => spawnSync(process.execPath, [script, ...args], { cwd, encoding: 'utf8' });
|
|
11
|
-
const temp = () => fs.mkdtempSync(path.join(os.tmpdir(), 'yss-db2mybatis-node-'));
|
|
12
|
-
const scaffoldArgs = (root, metadata, extra = []) => ['scaffold', '--skill-root', skillRoot, '--metadata-file', metadata, '--base-package', 'com.yss.demo', '--domain-segment', 'example', '--domain-java-root', path.join(root, 'domain'), '--infra-java-root', path.join(root, 'infra'), ...extra];
|
|
13
|
-
|
|
14
|
-
test('DDL 转 metadata,并保留主键、类型与注释', () => {
|
|
15
|
-
const root = temp(); const metadata = path.join(root, 'metadata.json');
|
|
16
|
-
const result = run(['ddl2metadata', '--ddl-sql', "CREATE TABLE t_order (id bigint NOT NULL COMMENT '主键', amount decimal(10,2), PRIMARY KEY (id)) COMMENT='订单';", '--db-type', 'mysql', '--database', 'demo', '--output', metadata]);
|
|
17
|
-
assert.equal(result.status, 0, result.stderr); const parsed = JSON.parse(fs.readFileSync(metadata, 'utf8'));
|
|
18
|
-
assert.equal(parsed.tables[0].table_name, 't_order'); assert.deepEqual(parsed.tables[0].primary_keys, ['id']); assert.equal(parsed.tables[0].columns[1].sql_type, 'decimal(10,2)');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('scaffold dry-run 不写文件,正常生成拒绝既有目标', () => {
|
|
22
|
-
const root = temp(); const metadata = path.join(root, 'metadata.json');
|
|
23
|
-
fs.writeFileSync(metadata, JSON.stringify({ tables: [{ table_name: 't_order', table_comment: '订单', primary_keys: ['id'], columns: [{ name: 'id', sql_type: 'bigint', primary: true, nullable: false, auto_increment: false }], indexes: [], foreign_keys: [] }] }));
|
|
24
|
-
const dryRun = run(scaffoldArgs(root, metadata, ['--dry-run'])); assert.equal(dryRun.status, 0, dryRun.stderr); assert.match(dryRun.stdout, /planned:/); assert.equal(fs.existsSync(path.join(root, 'domain')), false);
|
|
25
|
-
const generated = run(scaffoldArgs(root, metadata)); assert.equal(generated.status, 0, generated.stderr); const again = run(scaffoldArgs(root, metadata)); assert.equal(again.status, 2); assert.match(again.stderr, /文件已存在/);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test('非法参数和缺失数据库驱动均以退出码 2 失败', () => {
|
|
29
|
-
const invalid = run(['ddl2metadata', '--output', path.join(temp(), 'out.json')]); assert.equal(invalid.status, 2); assert.match(invalid.stderr, /请提供 --ddl-file 或 --ddl-sql/);
|
|
30
|
-
const unknown = run(['ddl2metadata', '--ddl-sql', 'CREATE TABLE t_x (id bigint)', '--output', path.join(temp(), 'out.json'), '--unexpected', 'x']); assert.equal(unknown.status, 2); assert.match(unknown.stderr, /未知参数/);
|
|
31
|
-
const missing = run(['extract', '--db-type', 'mysql', '--host', '127.0.0.1', '--port', '3306', '--user', 'u', '--password', 'p', '--database', 'd', '--output', path.join(temp(), 'out.json')], temp()); assert.equal(missing.status, 2); assert.match(missing.stderr, /YSS_DB2MYBATIS_DRIVER_ROOT/);
|
|
32
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: yss-valuation
|
|
3
|
-
description: Use when 用于 YSS valuation 组件、Excel/Csv 文件读取、Excel2SqlDDL、ImportFileJob、估值文件导入和区域条件解析排障。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# yss-valuation
|
|
7
|
-
|
|
8
|
-
Use this skill for YSS 估值导入组件. Keep implementation grounded in the local project and resolvable YSS backend component source.
|
|
9
|
-
|
|
10
|
-
中文说明:本技能用于 YSS 估值导入组件。执行时优先读取源码索引,避免凭记忆猜类名、配置项或接入方式。
|
|
11
|
-
|
|
12
|
-
## Source Index First
|
|
13
|
-
|
|
14
|
-
- Backend source location is environment-specific; resolve it with `yss-source-index/references/source-location.md`.
|
|
15
|
-
- Generated index: `references/source-index.md`
|
|
16
|
-
- Component path hints: `yss-microservice-components/yss-component-valuation`
|
|
17
|
-
|
|
18
|
-
Read `references/source-index.md` as a path-hint index whenever the task depends on exact modules, annotations, auto configuration, properties, controllers, clients, repositories, DTOs, handlers, or troubleshooting.
|
|
19
|
-
|
|
20
|
-
## Workflow
|
|
21
|
-
|
|
22
|
-
1. Identify whether the task is valuation file import, Excel/CSV reading, Excel-to-DDL generation, table relationship extraction, or import job troubleshooting.
|
|
23
|
-
2. Read `references/source-index.md`, then inspect `Excel2SqlDDL`, `Excel2TableRelationship`, `ImportFileJob`, `FileReader`, `ExcelFileReader`, and `CsvFileReader`.
|
|
24
|
-
3. Use this component for valuation/data-middle file import and DDL derivation; resolve generic file storage or parser infrastructure through the consuming project's source and the available source index.
|
|
25
|
-
4. Validate file format, sheet/column mapping, encoding, and generated DDL before applying changes to a database.
|
|
26
|
-
5. Keep import jobs idempotent or clearly restartable when possible.
|
|
27
|
-
|
|
28
|
-
## Checklist
|
|
29
|
-
|
|
30
|
-
- Required dependency or starter module is present.
|
|
31
|
-
- Excel/CSV reader matches the actual file type.
|
|
32
|
-
- Generated DDL uses the expected table/column naming rules.
|
|
33
|
-
- Table relationship extraction is verified with sample files.
|
|
34
|
-
- Import job failure handling records enough context for rerun.
|
|
35
|
-
|
|
36
|
-
## Do Not
|
|
37
|
-
|
|
38
|
-
- Do not invent class names or configuration keys without checking the source index.
|
|
39
|
-
- Do not replace component extension points with business-local framework code.
|
|
40
|
-
- Do not broaden the task into unrelated YSS components unless the user asks.
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# yss-valuation Source Index
|
|
2
|
-
|
|
3
|
-
Generated: 2026-08-17T12:03:37.436Z
|
|
4
|
-
Source commit: `38b556a5081e6c66c0c538cbc1ef839b19996ed3`
|
|
5
|
-
Source worktree: `dirty`
|
|
6
|
-
Indexed source root: resolved at refresh time; set `YSS_SOURCE_ROOT` to reproduce or refresh.
|
|
7
|
-
|
|
8
|
-
This file is generated by `yss-source-index/scripts/refresh-yss-skill-index.mjs`. Do not hand-edit generated sections.
|
|
9
|
-
|
|
10
|
-
Paths below are source path hints captured at refresh time. If they do not exist in the current workspace, locate sources using `YSS_SOURCE_ROOT`, CodeGraph, package/class names, Maven artifact names, or repository search before assuming the source is unavailable.
|
|
11
|
-
|
|
12
|
-
## Component Path Hints
|
|
13
|
-
|
|
14
|
-
- `yss-microservice-components/yss-component-valuation` (existed when indexed)
|
|
15
|
-
|
|
16
|
-
## Documentation Files
|
|
17
|
-
|
|
18
|
-
- No component documentation files found.
|
|
19
|
-
|
|
20
|
-
## Maven Modules
|
|
21
|
-
|
|
22
|
-
- `yss-microservice-components/yss-component-valuation`
|
|
23
|
-
|
|
24
|
-
## Key Java Entry Points
|
|
25
|
-
|
|
26
|
-
- `yss-microservice-components/yss-component-valuation/src/main/java/com/yss/datamiddle/ddl/Excel2SqlDDL.java`
|
|
27
|
-
- `yss-microservice-components/yss-component-valuation/src/main/java/com/yss/datamiddle/ddl/Excel2TableRelationship.java`
|
|
28
|
-
- `yss-microservice-components/yss-component-valuation/src/main/java/com/yss/datamiddle/job/ImportFileJob.java`
|
|
29
|
-
- `yss-microservice-components/yss-component-valuation/src/main/java/com/yss/datamiddle/reader/FileReader.java`
|
|
30
|
-
- `yss-microservice-components/yss-component-valuation/src/main/java/com/yss/datamiddle/reader/impl/CsvFileReader.java`
|
|
31
|
-
- `yss-microservice-components/yss-component-valuation/src/main/java/com/yss/datamiddle/reader/impl/ExcelFileReader.java`
|
|
32
|
-
|
|
33
|
-
## Recommended Next Reads
|
|
34
|
-
|
|
35
|
-
- Start with the documentation files above when learning component usage.
|
|
36
|
-
- Search the key Java entry points for annotations, auto configuration, properties, aspects, interceptors, handlers, and result objects before changing application code.
|
|
37
|
-
- Prefer existing component extension points over rewriting framework logic in business modules.
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: yss-variable
|
|
3
|
-
description: Use when 用于 YSS variable 组件、变量命名空间、VariableController、VarNameSpaceController、变量解析、占位符替换和变量导入导出排障。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# yss-variable
|
|
7
|
-
|
|
8
|
-
Use this skill for YSS 变量组件. Keep implementation grounded in the local project and resolvable YSS backend component source.
|
|
9
|
-
|
|
10
|
-
中文说明:本技能用于 YSS 变量组件。执行时优先读取源码索引,避免凭记忆猜类名、配置项或接入方式。
|
|
11
|
-
|
|
12
|
-
## Source Index First
|
|
13
|
-
|
|
14
|
-
- Backend source location is environment-specific; resolve it with `yss-source-index/references/source-location.md`.
|
|
15
|
-
- Generated index: `references/source-index.md`
|
|
16
|
-
- Component path hints: `yss-microservice-components/yss-component-variable`
|
|
17
|
-
|
|
18
|
-
Read `references/source-index.md` as a path-hint index whenever the task depends on exact modules, annotations, auto configuration, properties, controllers, clients, repositories, DTOs, handlers, or troubleshooting.
|
|
19
|
-
|
|
20
|
-
## Workflow
|
|
21
|
-
|
|
22
|
-
1. Identify whether the task is variable CRUD, namespace management, variable copy/move, import/export, wildcard search, author write handling, or async task status.
|
|
23
|
-
2. Read `references/source-index.md`, then inspect `VariableController`, `VarNameSpaceController`, `VariableService`, mappers, DTOs, and enums.
|
|
24
|
-
3. Keep namespace operations separate from variable definition operations.
|
|
25
|
-
4. Use `VarTypeEnum` and `UserFlagEnum` semantics instead of stringly typed business flags.
|
|
26
|
-
5. For import/copy/move tasks, inspect request/response DTOs and task response/status models.
|
|
27
|
-
|
|
28
|
-
## Capability Split
|
|
29
|
-
|
|
30
|
-
- Controllers: namespace and variable APIs.
|
|
31
|
-
- Service/mapper/entity: variable persistence and operations.
|
|
32
|
-
- DTOs: namespace page query, variable definition/copy/move/import/list responses.
|
|
33
|
-
- Common utilities: author write handler, SQL wildcard transform, result wrappers.
|
|
34
|
-
|
|
35
|
-
## Checklist
|
|
36
|
-
|
|
37
|
-
- Required dependency or starter module is present.
|
|
38
|
-
- Namespace and variable IDs/paths are handled consistently.
|
|
39
|
-
- Variable type and user flag values use enums.
|
|
40
|
-
- Import errors are returned through existing error response DTOs.
|
|
41
|
-
- Wildcard search escapes SQL-sensitive characters through existing utility behavior.
|
|
42
|
-
|
|
43
|
-
## Do Not
|
|
44
|
-
|
|
45
|
-
- Do not invent class names or configuration keys without checking the source index.
|
|
46
|
-
- Do not replace component extension points with business-local framework code.
|
|
47
|
-
- Do not broaden the task into unrelated YSS components unless the user asks.
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# yss-variable Source Index
|
|
2
|
-
|
|
3
|
-
Generated: 2026-08-17T12:03:37.436Z
|
|
4
|
-
Source commit: `38b556a5081e6c66c0c538cbc1ef839b19996ed3`
|
|
5
|
-
Source worktree: `dirty`
|
|
6
|
-
Indexed source root: resolved at refresh time; set `YSS_SOURCE_ROOT` to reproduce or refresh.
|
|
7
|
-
|
|
8
|
-
This file is generated by `yss-source-index/scripts/refresh-yss-skill-index.mjs`. Do not hand-edit generated sections.
|
|
9
|
-
|
|
10
|
-
Paths below are source path hints captured at refresh time. If they do not exist in the current workspace, locate sources using `YSS_SOURCE_ROOT`, CodeGraph, package/class names, Maven artifact names, or repository search before assuming the source is unavailable.
|
|
11
|
-
|
|
12
|
-
## Component Path Hints
|
|
13
|
-
|
|
14
|
-
- `yss-microservice-components/yss-component-variable` (missing when indexed)
|
|
15
|
-
|
|
16
|
-
## Documentation Files
|
|
17
|
-
|
|
18
|
-
- No component documentation files found.
|
|
19
|
-
|
|
20
|
-
## Maven Modules
|
|
21
|
-
|
|
22
|
-
- No Maven modules found.
|
|
23
|
-
|
|
24
|
-
## Key Java Entry Points
|
|
25
|
-
|
|
26
|
-
- No key Java entry points matched the configured name patterns.
|
|
27
|
-
|
|
28
|
-
## Recommended Next Reads
|
|
29
|
-
|
|
30
|
-
- Start with the documentation files above when learning component usage.
|
|
31
|
-
- Search the key Java entry points for annotations, auto configuration, properties, aspects, interceptors, handlers, and result objects before changing application code.
|
|
32
|
-
- Prefer existing component extension points over rewriting framework logic in business modules.
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: yss-db2mybatis
|
|
3
|
-
description: Use when 用于从数据库元数据或 DDL 生成 YSS 风格的 Domain Gateway、PO、Repository、Convertor 和 GatewayImpl。当用户要求按表结构、DDL、metadata 或数据库连接批量生成持久层代码时调用。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# yss-db2mybatis
|
|
7
|
-
|
|
8
|
-
这是一个生成器型 skill。优先复用脚本 `scripts/db2mybatis.mjs`,不要在对话里手写大段样板代码替代脚本。
|
|
9
|
-
|
|
10
|
-
## 何时使用
|
|
11
|
-
|
|
12
|
-
- 用户给出数据库表、DDL、metadata,要求生成 YSS 持久层代码。
|
|
13
|
-
- 用户要求批量生成 `PO / Repository / Convertor / GatewayImpl / Domain Gateway`。
|
|
14
|
-
- 用户要从 MySQL、PostgreSQL、Oracle、OpenGauss、OceanBase 提取元数据。
|
|
15
|
-
- 用户要先从 DDL 离线生成 metadata,再生成代码。
|
|
16
|
-
|
|
17
|
-
## 不适用
|
|
18
|
-
|
|
19
|
-
- 复杂 SQL 优化、手写 XML Mapper。
|
|
20
|
-
- 联合主键需要特殊建模且用户未确认策略。
|
|
21
|
-
- 用户只想补某个领域行为,而不是批量落持久层。
|
|
22
|
-
|
|
23
|
-
## 优先流程
|
|
24
|
-
|
|
25
|
-
1. 识别输入来源:`metadata.json`、数据库连接、DDL 文件、DDL 文本。
|
|
26
|
-
2. 先执行 `validate` 或 `extract` / `ddl2metadata`,不要直接盲生成。
|
|
27
|
-
3. 生成前优先用 `--dry-run` 预览。
|
|
28
|
-
4. 生成后检查输出路径、命名、主键策略和类型映射。
|
|
29
|
-
5. 如用户要继续补 Domain 或 Web,再衔接 `yss-domain`、`yss-web-controller`。
|
|
30
|
-
|
|
31
|
-
## 推荐命令
|
|
32
|
-
|
|
33
|
-
### 从数据库提取 metadata
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
node scripts/db2mybatis.mjs extract \
|
|
37
|
-
--datasource-config references/datasource-config.example.json \
|
|
38
|
-
--datasource-name your-datasource \
|
|
39
|
-
--tables t_example \
|
|
40
|
-
--output /tmp/metadata.json
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### 从 DDL 生成 metadata
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
node scripts/db2mybatis.mjs ddl2metadata \
|
|
47
|
-
--ddl-file /path/schema.sql \
|
|
48
|
-
--db-type mysql \
|
|
49
|
-
--database demo \
|
|
50
|
-
--output /tmp/metadata.json
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### 生成代码
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
node scripts/db2mybatis.mjs scaffold \
|
|
57
|
-
--skill-root /path/to/.agents/skills/yss-db2mybatis \
|
|
58
|
-
--metadata-file /tmp/metadata.json \
|
|
59
|
-
--base-package com.yss.demo \
|
|
60
|
-
--domain-segment example \
|
|
61
|
-
--domain-java-root /path/project-domain/src/main/java \
|
|
62
|
-
--infra-java-root /path/project-infra/src/main/java \
|
|
63
|
-
--dry-run
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## 关键参数
|
|
67
|
-
|
|
68
|
-
- 表过滤:`--tables`、`--include-tables-regex`、`--exclude-tables-regex`
|
|
69
|
-
- 安全控制:`--dry-run`、`--overwrite`
|
|
70
|
-
- 输入来源:`--metadata-file`、`--ddl-file`、`--ddl-sql`
|
|
71
|
-
- 主键策略:`--pk-strategy error|first`
|
|
72
|
-
- 项目约定:`--convention-file`
|
|
73
|
-
- 实时驱动根目录:`YSS_DB2MYBATIS_DRIVER_ROOT`(未设置时使用当前工作目录;不自动安装依赖)。MySQL / OceanBase 使用 `mysql2`,PostgreSQL / OpenGauss 使用 `pg`,Oracle 使用 `oracledb`;DDL、metadata、scaffold 和 validate 不依赖第三方包。
|
|
74
|
-
|
|
75
|
-
## 输出预期
|
|
76
|
-
|
|
77
|
-
- `domain/{segment}/gateway/*Gateway.java`
|
|
78
|
-
- `repository/entity/*PO.java`
|
|
79
|
-
- `repository/*Repository.java`
|
|
80
|
-
- `repository/convertor/*Convertor.java`
|
|
81
|
-
- `repository/gateway/impl/*GatewayImpl.java`
|
|
82
|
-
|
|
83
|
-
## 质量要求
|
|
84
|
-
|
|
85
|
-
- 遇到无法推断的类型时,给出明确告警,不要静默猜测。
|
|
86
|
-
- 联合主键默认报错,除非用户明确接受 `first` 策略。
|
|
87
|
-
- 默认先生成可编译骨架,再由调用方补复杂查询。
|
|
88
|
-
- 输出前检查生成路径是否真的对齐当前工程。
|
|
89
|
-
|
|
90
|
-
## 按需读取
|
|
91
|
-
|
|
92
|
-
- 主脚本:`scripts/db2mybatis.mjs`(Node `>=22 <27`)
|
|
93
|
-
- 类型映射:`references/type-mapping.json`
|
|
94
|
-
- 数据源示例:`references/datasource-config.example.json`
|
|
95
|
-
- 项目约定示例:`references/project-convention.example.json`
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
package ${base_package}.repository.entity;
|
|
2
|
-
|
|
3
|
-
import com.baomidou.mybatisplus.annotation.IdType;
|
|
4
|
-
import com.baomidou.mybatisplus.annotation.TableField;
|
|
5
|
-
import com.baomidou.mybatisplus.annotation.TableId;
|
|
6
|
-
import com.baomidou.mybatisplus.annotation.TableName;
|
|
7
|
-
import lombok.Data;
|
|
8
|
-
import lombok.EqualsAndHashCode;${extra_imports}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* ${table_comment}
|
|
12
|
-
*/
|
|
13
|
-
@Data
|
|
14
|
-
@EqualsAndHashCode
|
|
15
|
-
@TableName("${table_name}")
|
|
16
|
-
public class ${domain_name}PO {
|
|
17
|
-
|
|
18
|
-
${fields_block}
|
|
19
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
package ${base_package}.repository.convertor;
|
|
2
|
-
|
|
3
|
-
import ${model_pkg}.${domain_name};
|
|
4
|
-
import ${base_package}.repository.entity.${domain_name}PO;
|
|
5
|
-
import org.mapstruct.Mapper;
|
|
6
|
-
import org.mapstruct.NullValueCheckStrategy;
|
|
7
|
-
import org.mapstruct.NullValuePropertyMappingStrategy;
|
|
8
|
-
import org.mapstruct.factory.Mappers;
|
|
9
|
-
|
|
10
|
-
import java.util.List;
|
|
11
|
-
|
|
12
|
-
@Mapper(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE, nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
|
|
13
|
-
public interface ${domain_name}Convertor {
|
|
14
|
-
|
|
15
|
-
${domain_name}Convertor INSTANCE = Mappers.getMapper(${domain_name}Convertor.class);
|
|
16
|
-
|
|
17
|
-
${domain_name}PO toPO(${domain_name} source);
|
|
18
|
-
|
|
19
|
-
${domain_name} toDomain(${domain_name}PO source);
|
|
20
|
-
|
|
21
|
-
List<${domain_name}> toDomainList(List<${domain_name}PO> source);
|
|
22
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
package ${gateway_pkg};
|
|
2
|
-
|
|
3
|
-
import com.yss.cloud.dto.page.PageQuery;
|
|
4
|
-
import com.yss.cloud.dto.result.PageResult;
|
|
5
|
-
import ${model_pkg}.${domain_name};
|
|
6
|
-
|
|
7
|
-
import java.util.Optional;
|
|
8
|
-
|
|
9
|
-
public interface ${domain_name}Gateway{
|
|
10
|
-
/**
|
|
11
|
-
* Add ${domain_name}
|
|
12
|
-
*
|
|
13
|
-
* @param entity entity
|
|
14
|
-
* @return id
|
|
15
|
-
*/
|
|
16
|
-
${pk_java_type} ${method_add}(${domain_name} entity);
|
|
17
|
-
/**
|
|
18
|
-
* Update ${domain_name}
|
|
19
|
-
*
|
|
20
|
-
* @param entity entity
|
|
21
|
-
* @return boolean
|
|
22
|
-
*/
|
|
23
|
-
boolean ${method_update}(${domain_name} entity);
|
|
24
|
-
/**
|
|
25
|
-
* Delete ${domain_name}
|
|
26
|
-
*
|
|
27
|
-
* @param ${pk_field_name} id
|
|
28
|
-
* @return boolean
|
|
29
|
-
*/
|
|
30
|
-
boolean ${method_delete}(${pk_java_type} ${pk_field_name});
|
|
31
|
-
/**
|
|
32
|
-
* Get ${domain_name} by id
|
|
33
|
-
*
|
|
34
|
-
* @param ${pk_field_name} id
|
|
35
|
-
* @return optional
|
|
36
|
-
*/
|
|
37
|
-
Optional<${domain_name}> ${method_get}(${pk_java_type} ${pk_field_name});
|
|
38
|
-
/**
|
|
39
|
-
* Page ${domain_name}
|
|
40
|
-
*
|
|
41
|
-
* @param query query
|
|
42
|
-
* @return page result
|
|
43
|
-
*/
|
|
44
|
-
PageResult<${domain_name}> ${method_page}(PageQuery query);
|
|
45
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
package ${model_pkg};
|
|
2
|
-
|
|
3
|
-
import lombok.Data;
|
|
4
|
-
import java.io.Serializable;
|
|
5
|
-
${extra_imports}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* ${table_comment}
|
|
9
|
-
*/
|
|
10
|
-
@Data
|
|
11
|
-
public class ${domain_name} implements Serializable {
|
|
12
|
-
|
|
13
|
-
private static final long serialVersionUID = 1L;
|
|
14
|
-
|
|
15
|
-
${fields_block}
|
|
16
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
package ${base_package}.repository.gateway.impl;
|
|
2
|
-
|
|
3
|
-
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
4
|
-
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
5
|
-
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
6
|
-
import com.yss.cloud.dto.page.PageQuery;
|
|
7
|
-
import com.yss.cloud.dto.result.PageResult;
|
|
8
|
-
import ${gateway_pkg}.${domain_name}Gateway;
|
|
9
|
-
import ${model_pkg}.${domain_name};
|
|
10
|
-
import ${base_package}.repository.${domain_name}Repository;
|
|
11
|
-
import ${base_package}.repository.convertor.${domain_name}Convertor;
|
|
12
|
-
import ${base_package}.repository.entity.${domain_name}PO;
|
|
13
|
-
import ${base_package}.repository.util.PageUtil;
|
|
14
|
-
import lombok.RequiredArgsConstructor;
|
|
15
|
-
import org.springframework.stereotype.Repository;
|
|
16
|
-
|
|
17
|
-
import java.util.List;
|
|
18
|
-
import java.util.Optional;
|
|
19
|
-
import java.util.stream.Collectors;
|
|
20
|
-
|
|
21
|
-
@Repository
|
|
22
|
-
@RequiredArgsConstructor
|
|
23
|
-
public class ${domain_name}GatewayImpl implements ${domain_name}Gateway {
|
|
24
|
-
|
|
25
|
-
private final ${domain_name}Repository ${repository_field_name};
|
|
26
|
-
|
|
27
|
-
@Override
|
|
28
|
-
public ${pk_java_type} ${method_add}(${domain_name} entity) {
|
|
29
|
-
${domain_name}PO po = ${domain_name}Convertor.INSTANCE.toPO(entity);
|
|
30
|
-
${repository_field_name}.insert(po);
|
|
31
|
-
//fixme 补充返回数据唯一id
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@Override
|
|
36
|
-
public boolean ${method_update}(${domain_name} entity) {
|
|
37
|
-
return ${repository_field_name}.updateById(${domain_name}Convertor.INSTANCE.toPO(entity)) > 0;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@Override
|
|
41
|
-
public boolean ${method_delete}(${pk_java_type} ${pk_field_name}) {
|
|
42
|
-
return ${repository_field_name}.deleteById(${pk_field_name}) > 0;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@Override
|
|
46
|
-
public Optional<${domain_name}> ${method_get}(${pk_java_type} ${pk_field_name}) {
|
|
47
|
-
return Optional.ofNullable(${repository_field_name}.selectById(${pk_field_name})).map(this::toDomain);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
@Override
|
|
51
|
-
public PageResult<${domain_name}> ${method_page}(PageQuery query) {
|
|
52
|
-
LambdaQueryWrapper<${domain_name}PO> wrapper = Wrappers.lambdaQuery(${domain_name}PO.class);
|
|
53
|
-
${logic_delete_condition}
|
|
54
|
-
IPage<${domain_name}PO> result = ${repository_field_name}.selectPage(PageUtil.page(query), wrapper);
|
|
55
|
-
List<${domain_name}> records = result.getRecords().stream().map(this::toDomain).collect(Collectors.toList());
|
|
56
|
-
return PageResult.of(records, result.getTotal(), result.getSize(), result.getCurrent());
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
private ${domain_name} toDomain(${domain_name}PO source) {
|
|
60
|
-
return ${domain_name}Convertor.INSTANCE.toDomain(source);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
package ${base_package}.repository.entity;
|
|
2
|
-
|
|
3
|
-
import com.baomidou.mybatisplus.annotation.IdType;
|
|
4
|
-
import com.baomidou.mybatisplus.annotation.TableField;
|
|
5
|
-
import com.baomidou.mybatisplus.annotation.TableId;
|
|
6
|
-
import com.baomidou.mybatisplus.annotation.TableName;
|
|
7
|
-
import lombok.Data;
|
|
8
|
-
import lombok.EqualsAndHashCode;${extra_imports}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* ${table_comment}
|
|
12
|
-
*/
|
|
13
|
-
@Data
|
|
14
|
-
@EqualsAndHashCode
|
|
15
|
-
@TableName("${table_name}")
|
|
16
|
-
public class ${domain_name}PO {
|
|
17
|
-
${fields_block}
|
|
18
|
-
}
|