This commit is contained in:
weiyida 2025-02-23 20:34:26 +08:00
commit dc75314e36
7 changed files with 86 additions and 7 deletions

View File

@ -84,4 +84,4 @@ export class DepartmentController {
};
}
}
}
}

View File

@ -38,4 +38,8 @@ export class GoodsController {
results: []
};
}
<<<<<<< HEAD
}
=======
}
>>>>>>> de6e632ec69dd408a6c4e85d5cda01a1aa8e8276

View File

@ -3,7 +3,18 @@ import { GoodsService } from './goods.service';
import { GoodsController } from './goods.controller';
@Module({
<<<<<<< HEAD
providers: [GoodsService],
controllers:[GoodsController]
})
export class GoodsModule {}
=======
providers: [GoodsService],
controllers: [GoodsController],
})
export class GoodsModule {}
>>>>>>> de6e632ec69dd408a6c4e85d5cda01a1aa8e8276

View File

@ -1,6 +1,10 @@
import { Injectable } from '@nestjs/common';
@Injectable()
<<<<<<< HEAD
export class GoodsService {}
=======
export class GoodsService {
}
>>>>>>> de6e632ec69dd408a6c4e85d5cda01a1aa8e8276

View File

@ -34,7 +34,11 @@ import { GoodsModule } from '@server/models/goods/goods.module';
VisitModule,
WebSocketModule,
ResourceModule,
<<<<<<< HEAD
GoodsModule,
=======
GoodsModule
>>>>>>> de6e632ec69dd408a6c4e85d5cda01a1aa8e8276
],
controllers: [],
providers: [TrpcService, TrpcRouter, Logger],

View File

@ -1,3 +1,58 @@
<<<<<<< HEAD
import { api } from "@nice/client";
import { apiClient } from "@web/src/utils";
import { Button, Tag } from "antd";
import { useEffect, useMemo, useState } from "react";
function HomePage() {
// 使用 useQuery 钩子从 API 获取数据
const { data } = api.staff.findMany.useQuery({
take: 10
});
// 定义 counter 状态和更新函数
const [counter, setCounter] = useState<number>(0);
// 使用 useMemo 记忆化 counterText仅在 counter 变化时重新计算
const counterText = useMemo(() => {
return `当前计数为: ${counter}`;
}, [counter]);
const getData = async()=>{
const res = @wait apiClient.get(*/goods/hello*)
console.log(res)
}
// 使用 useEffect 在 data 变化时打印 data
useEffect(() => {
apiClient.get(/goods/hello)
}, [data]);
return (
<div className="p-2 space-y-2">
<Tag>{counterText}</Tag>
<div className="space-x-2">
<Button type="primary" onClick={() => setCounter(counter + 1)}>
1
</Button>
<Button danger onClick={() => setCounter(counter - 1)}>
1
</Button>
</div>
{/* 如果 data 存在,遍历并渲染每个项目的 username */}
{data?.map((item) => (
<div className="p-2 rounded border shadow" key={item.username}>
<Tag>{item.username}</Tag>
</div>
))}
</div>
);
}
export default HomePage;
=======
import { api } from "@nice/client"
import { apiClient } from "@web/src/utils"
import { Button, Tag } from "antd"
@ -43,3 +98,4 @@ function HomePage() {
}
// export { HomePage }
export default HomePage
>>>>>>> de6e632ec69dd408a6c4e85d5cda01a1aa8e8276

View File

@ -245,13 +245,8 @@ model PostAncestry {
// 复合索引优化
// 索引建议
@@index([ancestorId]) // 针对祖先的查询
@@index([descendantId]) // 针对后代的查询
@@index([ancestorId, descendantId]) // 组合索引,用于查询特定的祖先-后代关系
@@index([relDepth]) // 根据关系深度的查询
@@map("post_ancestry")
}
}
model Message {
id String @id @default(cuid())
url String?
@ -328,9 +323,14 @@ model Resource {
@@index([type])
@@index([createdAt])
@@map("resource")
}
<<<<<<< HEAD
=======
>>>>>>> de6e632ec69dd408a6c4e85d5cda01a1aa8e8276
//商品表
model Goods {