feat: 新增客户管理全模块功能
实现客户信息、客户部门、客户账号三个子模块的完整CRUD,包含: 1. 数据库实体、DTO、控制器、服务层代码 2. RBAC权限映射与菜单种子数据扩展 3. 前端路由与API封装 4. 数据权限隔离与鉴权逻辑 5. 配套工具脚本与测试验证清单
This commit is contained in:
1 parent
026ec34471
commit
1c80a24d1d
31 files changed
+26321
-653
No files matched your search
@@ -0,0 +1,54 @@
|
||||
import { Controller, Get, Post, Put, Del, Inject, Query, Body, Param } from "@midwayjs/core";
|
||||
import { Context } from "@midwayjs/koa";
|
||||
import { CustomerService } from "../service/customer.service";
|
||||
|
||||
@Controller("/api/customers")
|
||||
export class CustomerController {
|
||||
@Inject()
|
||||
ctx!: Context;
|
||||
|
||||
@Inject()
|
||||
customerService!: CustomerService;
|
||||
|
||||
@Get("/")
|
||||
async list(@Query() query: any) {
|
||||
const result = await this.customerService.list(query, this.ctx);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Get("/options/all")
|
||||
async getSimpleList() {
|
||||
const result = await this.customerService.getSimpleList(this.ctx);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Get("/:id")
|
||||
async detail(@Param("id") id: string) {
|
||||
const result = await this.customerService.detail(Number(id), this.ctx);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Post("/")
|
||||
async create(@Body() body: any) {
|
||||
const result = await this.customerService.create(body, this.ctx);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Put("/:id")
|
||||
async update(@Param("id") id: string, @Body() body: any) {
|
||||
const result = await this.customerService.update(Number(id), body, this.ctx);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Del("/:id")
|
||||
async delete(@Param("id") id: string) {
|
||||
const result = await this.customerService.delete(Number(id), this.ctx);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Put("/:id/status")
|
||||
async updateStatus(@Param("id") id: string, @Body() body: { status: number }) {
|
||||
const result = await this.customerService.updateStatus(Number(id), body.status, this.ctx);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user