zs 1 rok temu
rodzic
commit
35f8d6c36c
70 zmienionych plików z 3321 dodań i 150 usunięć
  1. 2 2
      src/config/config.default.ts
  2. 2 2
      src/config/config.local.ts
  3. 2 2
      src/config/config.prod.ts
  4. 139 0
      src/controller/Admin.controller.ts
  5. 89 0
      src/controller/Cart.controller.ts
  6. 89 0
      src/controller/Collection.controller.ts
  7. 89 0
      src/controller/Config.controller.ts
  8. 89 0
      src/controller/DictData.controller.ts
  9. 89 0
      src/controller/DictType.controller.ts
  10. 89 0
      src/controller/Good.controller.ts
  11. 89 0
      src/controller/Module.controller.ts
  12. 89 0
      src/controller/Office.controller.ts
  13. 89 0
      src/controller/Order.controller.ts
  14. 89 0
      src/controller/OrderDetail.controller.ts
  15. 89 0
      src/controller/Role.controller.ts
  16. 89 0
      src/controller/ShopSetting.controller.ts
  17. 89 0
      src/controller/Specs.controller.ts
  18. 89 0
      src/controller/Supplier.controller.ts
  19. 35 0
      src/controller/Tool.controller.ts
  20. 6 6
      src/controller/User.controller.ts
  21. 0 9
      src/controller/home.controller.ts
  22. 27 0
      src/entity/Admin.entity.ts
  23. 17 0
      src/entity/Cart.entity.ts
  24. 20 0
      src/entity/Collection.entity.ts
  25. 9 0
      src/entity/Config.entity.ts
  26. 25 0
      src/entity/DictData.entity.ts
  27. 21 0
      src/entity/DictType.entity.ts
  28. 24 0
      src/entity/Good.entity.ts
  29. 25 0
      src/entity/Module.entity.ts
  30. 24 0
      src/entity/Office.entity.ts
  31. 25 0
      src/entity/Order.entity.ts
  32. 26 0
      src/entity/OrderDetail.entity.ts
  33. 19 0
      src/entity/Role.entity.ts
  34. 20 0
      src/entity/ShopSetting.entity.ts
  35. 20 0
      src/entity/Specs.entity.ts
  36. 15 0
      src/entity/Supplier.entity.ts
  37. 0 6
      src/interface.ts
  38. 116 0
      src/interface/Admin.interface.ts
  39. 91 0
      src/interface/Cart.interface.ts
  40. 92 0
      src/interface/Collection.interface.ts
  41. 61 0
      src/interface/Config.interface.ts
  42. 96 0
      src/interface/DictData.interface.ts
  43. 82 0
      src/interface/DictType.interface.ts
  44. 92 0
      src/interface/Good.interface.ts
  45. 92 0
      src/interface/Module.interface.ts
  46. 71 0
      src/interface/Office.interface.ts
  47. 92 0
      src/interface/Order.interface.ts
  48. 103 0
      src/interface/OrderDetail.interface.ts
  49. 94 0
      src/interface/Role.interface.ts
  50. 78 0
      src/interface/ShopSetting.interface.ts
  51. 92 0
      src/interface/Specs.interface.ts
  52. 76 0
      src/interface/Supplier.interface.ts
  53. 2 8
      src/interface/util/user.util.interface.ts
  54. 30 0
      src/service/Admin.service.ts
  55. 11 0
      src/service/Cart.service.ts
  56. 11 0
      src/service/Collection.service.ts
  57. 11 0
      src/service/Config.service.ts
  58. 11 0
      src/service/DictData.service.ts
  59. 11 0
      src/service/DictType.service.ts
  60. 11 0
      src/service/Good.service.ts
  61. 11 0
      src/service/Module.service.ts
  62. 11 0
      src/service/Office.service.ts
  63. 11 0
      src/service/Order.service.ts
  64. 11 0
      src/service/OrderDetail.service.ts
  65. 11 0
      src/service/Role.service.ts
  66. 11 0
      src/service/ShopSetting.service.ts
  67. 11 0
      src/service/Specs.service.ts
  68. 11 0
      src/service/Supplier.service.ts
  69. 44 0
      src/service/Tool.service.ts
  70. 14 115
      src/service/util/user.util.ts

+ 2 - 2
src/config/config.default.ts

@@ -32,8 +32,8 @@ export default {
   wechatSetting: {
     // 耗材
     materialApp: {
-      appid: 'wxef5b87d5fef241b4',
-      secret: 'd315753502e0cbc24de5a230bed5c87a',
+      appid: 'wx23c71bee5876d1b9',
+      secret: 'f8099ebd037df28dc9357ef585ab58ff',
       mchid: '1505364491',
       v3key: '1qaz2wsx3edc4rfv5tgb6yhn7ujm8ik9',
     },

+ 2 - 2
src/config/config.local.ts

@@ -44,8 +44,8 @@ export default {
   wechatSetting: {
     // 耗材
     materialApp: {
-      appid: 'wxef5b87d5fef241b4',
-      secret: 'd315753502e0cbc24de5a230bed5c87a',
+      appid: 'wx23c71bee5876d1b9',
+      secret: 'f8099ebd037df28dc9357ef585ab58ff',
       mchid: '1505364491',
       v3key: '1qaz2wsx3edc4rfv5tgb6yhn7ujm8ik9',
     },

+ 2 - 2
src/config/config.prod.ts

@@ -44,8 +44,8 @@ export default {
   wechatSetting: {
     // 耗材
     materialApp: {
-      appid: 'wxef5b87d5fef241b4',
-      secret: 'd315753502e0cbc24de5a230bed5c87a',
+      appid: 'wx23c71bee5876d1b9',
+      secret: 'f8099ebd037df28dc9357ef585ab58ff',
       mchid: '1505364491',
       v3key: '1qaz2wsx3edc4rfv5tgb6yhn7ujm8ik9',
     },

+ 139 - 0
src/controller/Admin.controller.ts

@@ -0,0 +1,139 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+  Config,
+} from '@midwayjs/decorator';
+import {
+  BaseController,
+  FrameworkErrorEnum,
+  ServiceError,
+} from 'free-midway-component';
+import { AdminService } from '../service/Admin.service';
+import {
+  CDTO_Admin,
+  CVO_Admin,
+  FVO_Admin,
+  QDTO_Admin,
+  QVO_Admin,
+  UDTO_Admin,
+  UVAO_Admin,
+  LoginDTO,
+  ResetPasswordDTO,
+  LoginVO,
+} from '../interface/Admin.interface';
+import {
+  ApiResponse,
+  ApiTags,
+  ApiQuery,
+  ApiOperation,
+} from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+import { JwtService } from '@midwayjs/jwt';
+@ApiTags(['系统管理员'])
+@Controller('/Admin')
+export class AdminController extends BaseController {
+  @Inject()
+  service: AdminService;
+
+  @Inject()
+  jwtService: JwtService;
+
+  @Config('jwt.secret')
+  jwtSecret;
+
+  @Config('jwt.expiresIn')
+  jwtExpiresIn;
+
+  @Post('/login')
+  @Validate()
+  async login(@Body() body: LoginDTO) {
+    const data = await this.service.findUserToLogin(body);
+    let vo = new LoginVO(data);
+    vo = JSON.parse(JSON.stringify(vo));
+    const token = await this.jwtService.sign(vo, this.jwtSecret, {
+      expiresIn: this.jwtExpiresIn,
+    });
+    return token;
+  }
+
+  @Post('/rp')
+  @ApiOperation({ description: '修改密码' })
+  async resetPassword(@Body() body: ResetPasswordDTO) {
+    if (!body._id)
+      throw new ServiceError('未找到用户信息', FrameworkErrorEnum.NOT_LOGIN);
+    // 查询用户
+    const user = await this.service.fetch(body._id);
+    if (!user)
+      throw new ServiceError('未找到用户', FrameworkErrorEnum.NOT_FOUND_DATA);
+    // 修改密码
+    await this.service.updateOne(body._id, { password: body.password });
+    // 返回结果
+    return 'ok';
+  }
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_Admin })
+  async create(@Body() data: CDTO_Admin) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_Admin(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_Admin })
+  async query(
+    @Query() filter: QDTO_Admin,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_Admin(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_Admin })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_Admin(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_Admin })
+  async update(@Param('id') id: string, @Body() body: UDTO_Admin) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/Cart.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { CartService } from '../service/Cart.service';
+import {
+  CDTO_Cart,
+  CVO_Cart,
+  FVO_Cart,
+  QDTO_Cart,
+  QVO_Cart,
+  UDTO_Cart,
+  UVAO_Cart,
+} from '../interface/Cart.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['购物车'])
+@Controller('/Cart')
+export class CartController extends BaseController {
+  @Inject()
+  service: CartService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_Cart })
+  async create(@Body() data: CDTO_Cart) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_Cart(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_Cart })
+  async query(
+    @Query() filter: QDTO_Cart,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_Cart(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_Cart })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_Cart(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_Cart })
+  async update(@Param('id') id: string, @Body() body: UDTO_Cart) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/Collection.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { CollectionService } from '../service/Collection.service';
+import {
+  CDTO_Collection,
+  CVO_Collection,
+  FVO_Collection,
+  QDTO_Collection,
+  QVO_Collection,
+  UDTO_Collection,
+  UVAO_Collection,
+} from '../interface/Collection.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['回款审批设置'])
+@Controller('/Collection')
+export class CollectionController extends BaseController {
+  @Inject()
+  service: CollectionService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_Collection })
+  async create(@Body() data: CDTO_Collection) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_Collection(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_Collection })
+  async query(
+    @Query() filter: QDTO_Collection,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_Collection(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_Collection })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_Collection(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_Collection })
+  async update(@Param('id') id: string, @Body() body: UDTO_Collection) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/Config.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { ConfigService } from '../service/Config.service';
+import {
+  CDTO_Config,
+  CVO_Config,
+  FVO_Config,
+  QDTO_Config,
+  QVO_Config,
+  UDTO_Config,
+  UVAO_Config,
+} from '../interface/Config.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['基础设置表'])
+@Controller('/Config')
+export class ConfigController extends BaseController {
+  @Inject()
+  service: ConfigService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_Config })
+  async create(@Body() data: CDTO_Config) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_Config(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_Config })
+  async query(
+    @Query() filter: QDTO_Config,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_Config(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_Config })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_Config(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_Config })
+  async update(@Param('id') id: string, @Body() body: UDTO_Config) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/DictData.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { DictDataService } from '../service/DictData.service';
+import {
+  CDTO_DictData,
+  CVO_DictData,
+  FVO_DictData,
+  QDTO_DictData,
+  QVO_DictData,
+  UDTO_DictData,
+  UVAO_DictData,
+} from '../interface/DictData.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['字典数据'])
+@Controller('/DictData')
+export class DictDataController extends BaseController {
+  @Inject()
+  service: DictDataService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_DictData })
+  async create(@Body() data: CDTO_DictData) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_DictData(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_DictData })
+  async query(
+    @Query() filter: QDTO_DictData,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_DictData(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_DictData })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_DictData(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_DictData })
+  async update(@Param('id') id: string, @Body() body: UDTO_DictData) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/DictType.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { DictTypeService } from '../service/DictType.service';
+import {
+  CDTO_DictType,
+  CVO_DictType,
+  FVO_DictType,
+  QDTO_DictType,
+  QVO_DictType,
+  UDTO_DictType,
+  UVAO_DictType,
+} from '../interface/DictType.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['字典类型'])
+@Controller('/DictType')
+export class DictTypeController extends BaseController {
+  @Inject()
+  service: DictTypeService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_DictType })
+  async create(@Body() data: CDTO_DictType) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_DictType(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_DictType })
+  async query(
+    @Query() filter: QDTO_DictType,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_DictType(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_DictType })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_DictType(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_DictType })
+  async update(@Param('id') id: string, @Body() body: UDTO_DictType) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/Good.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { GoodService } from '../service/Good.service';
+import {
+  CDTO_Good,
+  CVO_Good,
+  FVO_Good,
+  QDTO_Good,
+  QVO_Good,
+  UDTO_Good,
+  UVAO_Good,
+} from '../interface/Good.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['商品'])
+@Controller('/Good')
+export class GoodController extends BaseController {
+  @Inject()
+  service: GoodService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_Good })
+  async create(@Body() data: CDTO_Good) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_Good(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_Good })
+  async query(
+    @Query() filter: QDTO_Good,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_Good(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_Good })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_Good(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_Good })
+  async update(@Param('id') id: string, @Body() body: UDTO_Good) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/Module.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { ModuleService } from '../service/Module.service';
+import {
+  CDTO_Module,
+  CVO_Module,
+  FVO_Module,
+  QDTO_Module,
+  QVO_Module,
+  UDTO_Module,
+  UVAO_Module,
+} from '../interface/Module.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['首页模块'])
+@Controller('/Module')
+export class ModuleController extends BaseController {
+  @Inject()
+  service: ModuleService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_Module })
+  async create(@Body() data: CDTO_Module) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_Module(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_Module })
+  async query(
+    @Query() filter: QDTO_Module,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_Module(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_Module })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_Module(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_Module })
+  async update(@Param('id') id: string, @Body() body: UDTO_Module) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/Office.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { OfficeService } from '../service/Office.service';
+import {
+  CDTO_Office,
+  CVO_Office,
+  FVO_Office,
+  QDTO_Office,
+  QVO_Office,
+  UDTO_Office,
+  UVAO_Office,
+} from '../interface/Office.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['街道和社区'])
+@Controller('/Office')
+export class OfficeController extends BaseController {
+  @Inject()
+  service: OfficeService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_Office })
+  async create(@Body() data: CDTO_Office) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_Office(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_Office })
+  async query(
+    @Query() filter: QDTO_Office,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_Office(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_Office })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_Office(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_Office })
+  async update(@Param('id') id: string, @Body() body: UDTO_Office) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/Order.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { OrderService } from '../service/Order.service';
+import {
+  CDTO_Order,
+  CVO_Order,
+  FVO_Order,
+  QDTO_Order,
+  QVO_Order,
+  UDTO_Order,
+  UVAO_Order,
+} from '../interface/Order.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['订单'])
+@Controller('/Order')
+export class OrderController extends BaseController {
+  @Inject()
+  service: OrderService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_Order })
+  async create(@Body() data: CDTO_Order) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_Order(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_Order })
+  async query(
+    @Query() filter: QDTO_Order,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_Order(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_Order })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_Order(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_Order })
+  async update(@Param('id') id: string, @Body() body: UDTO_Order) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/OrderDetail.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { OrderDetailService } from '../service/OrderDetail.service';
+import {
+  CDTO_OrderDetail,
+  CVO_OrderDetail,
+  FVO_OrderDetail,
+  QDTO_OrderDetail,
+  QVO_OrderDetail,
+  UDTO_OrderDetail,
+  UVAO_OrderDetail,
+} from '../interface/OrderDetail.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['订单详情'])
+@Controller('/OrderDetail')
+export class OrderDetailController extends BaseController {
+  @Inject()
+  service: OrderDetailService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_OrderDetail })
+  async create(@Body() data: CDTO_OrderDetail) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_OrderDetail(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_OrderDetail })
+  async query(
+    @Query() filter: QDTO_OrderDetail,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_OrderDetail(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_OrderDetail })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_OrderDetail(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_OrderDetail })
+  async update(@Param('id') id: string, @Body() body: UDTO_OrderDetail) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/Role.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { RoleService } from '../service/Role.service';
+import {
+  CDTO_Role,
+  CVO_Role,
+  FVO_Role,
+  QDTO_Role,
+  QVO_Role,
+  UDTO_Role,
+  UVAO_Role,
+} from '../interface/Role.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['角色'])
+@Controller('/Role')
+export class RoleController extends BaseController {
+  @Inject()
+  service: RoleService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_Role })
+  async create(@Body() data: CDTO_Role) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_Role(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_Role })
+  async query(
+    @Query() filter: QDTO_Role,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_Role(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_Role })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_Role(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_Role })
+  async update(@Param('id') id: string, @Body() body: UDTO_Role) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/ShopSetting.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { ShopSettingService } from '../service/ShopSetting.service';
+import {
+  CDTO_ShopSetting,
+  CVO_ShopSetting,
+  FVO_ShopSetting,
+  QDTO_ShopSetting,
+  QVO_ShopSetting,
+  UDTO_ShopSetting,
+  UVAO_ShopSetting,
+} from '../interface/ShopSetting.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['采购审批设置'])
+@Controller('/ShopSetting')
+export class ShopSettingController extends BaseController {
+  @Inject()
+  service: ShopSettingService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_ShopSetting })
+  async create(@Body() data: CDTO_ShopSetting) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_ShopSetting(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_ShopSetting })
+  async query(
+    @Query() filter: QDTO_ShopSetting,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_ShopSetting(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_ShopSetting })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_ShopSetting(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_ShopSetting })
+  async update(@Param('id') id: string, @Body() body: UDTO_ShopSetting) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/Specs.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { SpecsService } from '../service/Specs.service';
+import {
+  CDTO_Specs,
+  CVO_Specs,
+  FVO_Specs,
+  QDTO_Specs,
+  QVO_Specs,
+  UDTO_Specs,
+  UVAO_Specs,
+} from '../interface/Specs.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['商品规格'])
+@Controller('/Specs')
+export class SpecsController extends BaseController {
+  @Inject()
+  service: SpecsService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_Specs })
+  async create(@Body() data: CDTO_Specs) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_Specs(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_Specs })
+  async query(
+    @Query() filter: QDTO_Specs,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_Specs(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_Specs })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_Specs(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_Specs })
+  async update(@Param('id') id: string, @Body() body: UDTO_Specs) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 89 - 0
src/controller/Supplier.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { SupplierService } from '../service/Supplier.service';
+import {
+  CDTO_Supplier,
+  CVO_Supplier,
+  FVO_Supplier,
+  QDTO_Supplier,
+  QVO_Supplier,
+  UDTO_Supplier,
+  UVAO_Supplier,
+} from '../interface/Supplier.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['供应商'])
+@Controller('/Supplier')
+export class SupplierController extends BaseController {
+  @Inject()
+  service: SupplierService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_Supplier })
+  async create(@Body() data: CDTO_Supplier) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_Supplier(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_Supplier })
+  async query(
+    @Query() filter: QDTO_Supplier,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_Supplier(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_Supplier })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_Supplier(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_Supplier })
+  async update(@Param('id') id: string, @Body() body: UDTO_Supplier) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 35 - 0
src/controller/Tool.controller.ts

@@ -0,0 +1,35 @@
+import { Controller, Get, Inject } from '@midwayjs/decorator';
+import { Context } from '@midwayjs/koa';
+import { ApiResponse, ApiTags } from '@midwayjs/swagger';
+import { ToolService } from '../service/Tool.service';
+const assert = require('assert');
+import { JwtService } from '@midwayjs/jwt';
+import get = require('lodash/get');
+@ApiTags(['工具'])
+@Controller('/tool')
+export class ToolController {
+  @Inject()
+  service: ToolService;
+
+  @Inject()
+  jwtService: JwtService;
+
+  @Inject()
+  ctx: Context;
+
+  @Get('/token')
+  @ApiResponse({})
+  async tokenView() {
+    const token = get(this.ctx, 'request.header.token');
+    assert(token, '缺少token信息');
+    const result: any = await this.jwtService.decode(token);
+    return result;
+  }
+
+  @Get('/app')
+  async appLogin(fiiter) {
+    const { config, js_code } = fiiter.query;
+    const result: any = await this.service.appLogin(config, js_code);
+    return result;
+  }
+}

+ 6 - 6
src/controller/User.controller.ts

@@ -35,7 +35,7 @@ import {
 } from '@midwayjs/swagger';
 import { Validate } from '@midwayjs/validate';
 import { JwtService } from '@midwayjs/jwt';
-import { UserUtilService } from '../../service/util/user.util';
+import { UserUtilService } from '../service/util/user.util';
 @ApiTags(['用户'])
 @Controller('/User')
 export class UserController extends BaseController {
@@ -51,7 +51,7 @@ export class UserController extends BaseController {
   @Config('jwt.expiresIn')
   jwtExpiresIn;
 
-   @Inject()
+  @Inject()
   userUtil: UserUtilService;
 
   @Post('/login')
@@ -85,8 +85,8 @@ export class UserController extends BaseController {
   @Validate()
   @ApiResponse({ type: CVO_User })
   async create(@Body() data: CDTO_User) {
-     // 检查手机号和上级id
-    // await this.userUtil.checkPhoneAndPid(data);
+    // 检查手机号
+    await this.userUtil.checkPhoneAndPid(data);
     const dbData = await this.service.create(data);
     const result = new CVO_User(dbData);
     return result;
@@ -121,8 +121,8 @@ export class UserController extends BaseController {
   @Validate()
   @ApiResponse({ type: UVAO_User })
   async update(@Param('id') id: string, @Body() body: UDTO_User) {
-    // 检查手机号和上级id
-    // await this.userUtil.checkUpdateCardAndPid(id, body);
+    // 检查手机号
+    await this.userUtil.checkUpdateCardAndPid(id, body);
     const result = await this.service.updateOne(id, body);
     return result;
   }

+ 0 - 9
src/controller/home.controller.ts

@@ -1,9 +0,0 @@
-import { Controller, Get } from '@midwayjs/core';
-
-@Controller('/')
-export class HomeController {
-  @Get('/')
-  async home(): Promise<string> {
-    return 'Hello Midwayjs!';
-  }
-}

+ 27 - 0
src/entity/Admin.entity.ts

@@ -0,0 +1,27 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+import isString = require('lodash/isString');
+@modelOptions({
+  schemaOptions: { collection: 'Admin' },
+})
+export class Admin extends BaseModel {
+  @prop({ required: true, index: true, zh: '口令' })
+  username: string;
+  @prop({
+    required: false,
+    index: false,
+    zh: '密码',
+    select: false,
+    set: (val: string | object) => {
+      if (isString(val)) {
+        return { secret: val };
+      }
+      return val;
+    },
+  })
+  password: {
+    secret: string;
+  };
+  @prop({ required: false, index: false, zh: '显示名' })
+  name: string;
+}

+ 17 - 0
src/entity/Cart.entity.ts

@@ -0,0 +1,17 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'Cart' },
+})
+export class Cart extends BaseModel {
+  @prop({ required: false, index: true, zh: '用户', ref: 'User' })
+  user: string;
+  @prop({ required: false, index: true, zh: '商品id', ref: 'Good' })
+  goods: string;
+  @prop({ required: false, index: true, zh: '商品规格id', ref: 'Spec' })
+  spec: string;
+  @prop({ required: false, index: true, zh: '数量' })
+  num: string;
+  @prop({ required: false, index: true, zh: '总金额' })
+  money: string;
+}

+ 20 - 0
src/entity/Collection.entity.ts

@@ -0,0 +1,20 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'Collection' },
+})
+export class Collection extends BaseModel {
+  @prop({ required: true, index: false, zh: '街道/社区', ref: 'Office' })
+  office: string;
+  @prop({ required: true, index: false, zh: '领导' })
+  leader: Array<any>;
+  @prop({ required: true, index: false, zh: '会计' })
+  accounting: Array<any>;
+  @prop({
+    required: false,
+    index: false,
+    zh: '是否使用',
+    remark: '字典表:is_use',
+  })
+  is_use: string;
+}

+ 9 - 0
src/entity/Config.entity.ts

@@ -0,0 +1,9 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'Config' },
+})
+export class Config extends BaseModel {
+  @prop({ required: false, index: false, zh: 'logo' })
+  logo_url: Array<any>;
+}

+ 25 - 0
src/entity/DictData.entity.ts

@@ -0,0 +1,25 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'DictData' },
+})
+export class DictData extends BaseModel {
+  @prop({ required: false, index: true, zh: '类型' })
+  type: string;
+  @prop({ required: false, index: true, zh: '标签' })
+  label: string;
+  @prop({ required: false, index: true, zh: '键值' })
+  value: string;
+  @prop({ required: false, index: true, zh: '排序' })
+  sort: number;
+  @prop({
+    required: false,
+    index: true,
+    zh: '是否使用',
+    remark: '字典表:is_use',
+    default: '0',
+  })
+  is_use: string;
+  @prop({ required: false, index: false, zh: '字数据' })
+  children: Array<any>;
+}

+ 21 - 0
src/entity/DictType.entity.ts

@@ -0,0 +1,21 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'DictType' },
+})
+export class DictType extends BaseModel {
+  @prop({ required: false, index: true, zh: '名称' })
+  title: string;
+  @prop({ required: false, index: true, zh: '类型' })
+  type: string;
+  @prop({ required: false, index: false, zh: '备注' })
+  remark: string;
+  @prop({
+    required: false,
+    index: true,
+    zh: '是否使用',
+    remark: '字典表:is_use',
+    default: '0',
+  })
+  is_use: string;
+}

+ 24 - 0
src/entity/Good.entity.ts

@@ -0,0 +1,24 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'Good' },
+})
+export class Good extends BaseModel {
+  @prop({ required: false, index: true, zh: '名称' })
+  name: string;
+  @prop({ required: false, index: false, zh: '图片' })
+  file: Array<any>;
+  @prop({
+    required: false,
+    index: true,
+    zh: '类型',
+    remark: '字典表:good_type',
+  })
+  type: string;
+  @prop({ required: false, index: false, zh: '简介' })
+  brief: string;
+  @prop({ required: false, index: false, zh: '销售数量' })
+  sell_num: number;
+  @prop({ required: false, index: true, zh: '供应商id' })
+  supplier_id: string;
+}

+ 25 - 0
src/entity/Module.entity.ts

@@ -0,0 +1,25 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'Module' },
+})
+export class Module extends BaseModel {
+  @prop({ required: false, index: true, zh: '名称' })
+  name: string;
+  @prop({ required: false, index: true, zh: '类型', remark: '字典 good_type' })
+  type: string;
+  @prop({ required: false, index: false, zh: '图片' })
+  url: Array<any>;
+  @prop({ required: false, index: false, zh: '排序' })
+  sort: number;
+  @prop({
+    required: false,
+    index: true,
+    zh: '状态',
+    remark: '字典表:status',
+    default: '0',
+  })
+  status: string;
+  @prop({ required: false, index: false, zh: '路由' })
+  route: string;
+}

+ 24 - 0
src/entity/Office.entity.ts

@@ -0,0 +1,24 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'Office' },
+})
+export class Office extends BaseModel {
+  @prop({
+    required: false,
+    index: false,
+    zh: '办公处名',
+    remark: '街道社区通用',
+  })
+  name: string;
+  @prop({ required: false, index: false, zh: '具体地址' })
+  address: string;
+  @prop({
+    required: false,
+    index: false,
+    zh: '所属',
+    ref: 'Office',
+    remark: '社区填写,街道不写',
+  })
+  belong: string;
+}

+ 25 - 0
src/entity/Order.entity.ts

@@ -0,0 +1,25 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+import { Decimal128 } from 'mongoose';
+@modelOptions({
+  schemaOptions: { collection: 'Order' },
+})
+export class Order extends BaseModel {
+  @prop({ required: false, index: true, zh: '用户', ref: 'User' })
+  user: string;
+  @prop({ required: false, index: false, zh: '邮寄地址' })
+  address: string;
+  @prop({ required: false, index: false, zh: '商品', ref: '' })
+  goods: Array<any>;
+  @prop({ required: false, index: false, zh: '总金额' })
+  total_money: Decimal128;
+  @prop({ required: false, index: true, zh: '下单时间' })
+  buy_time: string;
+  @prop({
+    required: false,
+    index: true,
+    zh: '订单状态',
+    remark: '字典:order_status',
+  })
+  status: string;
+}

+ 26 - 0
src/entity/OrderDetail.entity.ts

@@ -0,0 +1,26 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'OrderDetail' },
+})
+export class OrderDetail extends BaseModel {
+  @prop({ required: false, index: true, zh: '总订单id' })
+  order_id: string;
+  @prop({ required: false, index: true, zh: '用户', ref: 'User' })
+  user: string;
+  @prop({ required: false, index: true, zh: '商品id' })
+  good: string;
+  @prop({ required: false, index: true, zh: '规格id' })
+  spec: string;
+  @prop({ required: false, index: false, zh: '收货地址' })
+  address: string;
+  @prop({ required: false, index: true, zh: '下单时间' })
+  buy_time: string;
+  @prop({
+    required: false,
+    index: true,
+    zh: '状态',
+    remark: '字典表 :order_status',
+  })
+  status: string;
+}

+ 19 - 0
src/entity/Role.entity.ts

@@ -0,0 +1,19 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'Role' },
+})
+export class Role extends BaseModel {
+  @prop({ required: false, index: true, zh: '角色名称' })
+  name: string;
+  @prop({ required: false, index: true, zh: '角色编码' })
+  code: string;
+  @prop({ required: false, index: false, zh: '简介' })
+  brief: string;
+  @prop({ required: false, index: false, zh: '底部菜单' })
+  menu: Array<any>;
+  @prop({ required: false, index: true, zh: '状态', default: '0' })
+  status: string;
+  @prop({ required: false, index: true, zh: '账号类型' })
+  type: string;
+}

+ 20 - 0
src/entity/ShopSetting.entity.ts

@@ -0,0 +1,20 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'ShopSetting' },
+})
+export class ShopSetting extends BaseModel {
+  @prop({ required: false, index: true, zh: '街道/社区', ref: 'Office' })
+  office: string;
+  @prop({ required: false, index: false, zh: '领导' })
+  leader: Array<any>;
+  @prop({ required: false, index: false, zh: '会计' })
+  accounting: Array<any>;
+  @prop({
+    required: false,
+    index: false,
+    zh: '是否使用',
+    remark: '字典表:is_use',
+  })
+  is_use: string;
+}

+ 20 - 0
src/entity/Specs.entity.ts

@@ -0,0 +1,20 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+import { Decimal128 } from 'mongoose';
+@modelOptions({
+  schemaOptions: { collection: 'Specs' },
+})
+export class Specs extends BaseModel {
+  @prop({ required: false, index: true, zh: '商品源', ref: 'Goods' })
+  goods: string;
+  @prop({ required: false, index: true, zh: '规格名称' })
+  name: string;
+  @prop({ required: false, index: false, zh: '销售价格' })
+  money: Decimal128;
+  @prop({ required: false, index: false, zh: '库存' })
+  num: number;
+  @prop({ required: false, index: true, zh: '状态' })
+  status: string;
+  @prop({ required: false, index: false, zh: '图片' })
+  file: Array<any>;
+}

+ 15 - 0
src/entity/Supplier.entity.ts

@@ -0,0 +1,15 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'Supplier' },
+})
+export class Supplier extends BaseModel {
+  @prop({ required: false, index: false, zh: '供应商名称' })
+  name: string;
+  @prop({ required: false, index: false, zh: '联系电话' })
+  tel: string;
+  @prop({ required: false, index: false, zh: '负责人' })
+  head: string;
+  @prop({ required: false, index: false, zh: '负责人电话' })
+  head_tel: string;
+}

+ 0 - 6
src/interface.ts

@@ -1,6 +0,0 @@
-/**
- * @description User-Service parameters
- */
-export interface IUserOptions {
-  uid: number;
-}

+ 116 - 0
src/interface/Admin.interface.ts

@@ -0,0 +1,116 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import {
+  FrameworkErrorEnum,
+  SearchBase,
+  ServiceError,
+} from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_Admin {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '口令' })
+  'username': string = undefined;
+  @ApiProperty({ description: '密码' })
+  'password': string = undefined;
+  @ApiProperty({ description: '显示名' })
+  'name': string = undefined;
+}
+
+export class QDTO_Admin extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['username'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '口令' })
+  'username': string = undefined;
+}
+
+export class QVO_Admin extends FVO_Admin {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_Admin {
+  @ApiProperty({ description: '口令' })
+  @Rule(
+    RuleType['string']()
+      .required()
+      .error(new ServiceError('缺少口令', FrameworkErrorEnum.NEED_BODY))
+  )
+  'username': string = undefined;
+  @ApiProperty({ description: '密码' })
+  @Rule(
+    RuleType['string']()
+      .required()
+      .error(new ServiceError('缺少密码', FrameworkErrorEnum.NEED_BODY))
+  )
+  'password': string = undefined;
+  @ApiProperty({ description: '显示名' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+}
+
+export class CVO_Admin extends FVO_Admin {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_Admin extends CDTO_Admin {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_Admin extends FVO_Admin {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+export class LoginVO {
+  constructor(data: object) {
+    for (const key of Object.keys(this)) {
+      this[key] = get(data, key);
+    }
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '口令' })
+  'username': string = undefined;
+  @ApiProperty({ description: '显示名' })
+  'name': string = undefined;
+}
+
+export class LoginDTO {
+  @ApiProperty({ description: '口令', example: 'admin' })
+  @Rule(RuleType['string']().empty(''))
+  'username': string = undefined;
+  @ApiProperty({ description: '密码', example: '111111' })
+  @Rule(RuleType['string']().empty(''))
+  'password': string = undefined;
+}
+
+export class ResetPasswordDTO {
+  @ApiProperty({ description: '用户id', example: '' })
+  @Rule(RuleType['string']().required())
+  '_id': string = undefined;
+  @ApiProperty({ description: '密码', example: '123456' })
+  @Rule(RuleType['string']().required())
+  'password': string = undefined;
+}

+ 91 - 0
src/interface/Cart.interface.ts

@@ -0,0 +1,91 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_Cart {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '用户' })
+  'user': string = undefined;
+  @ApiProperty({ description: '商品id' })
+  'goods': string = undefined;
+  @ApiProperty({ description: '商品规格id' })
+  'spec': string = undefined;
+  @ApiProperty({ description: '数量' })
+  'num': string = undefined;
+  @ApiProperty({ description: '总金额' })
+  'money': string = undefined;
+}
+
+export class QDTO_Cart extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['user', 'goods', 'spec', 'num', 'money'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '用户' })
+  'user': string = undefined;
+  @ApiProperty({ description: '商品id' })
+  'goods': string = undefined;
+  @ApiProperty({ description: '商品规格id' })
+  'spec': string = undefined;
+  @ApiProperty({ description: '数量' })
+  'num': string = undefined;
+  @ApiProperty({ description: '总金额' })
+  'money': string = undefined;
+}
+
+export class QVO_Cart extends FVO_Cart {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_Cart {
+  @ApiProperty({ description: '用户' })
+  @Rule(RuleType['string']().empty(''))
+  'user': string = undefined;
+  @ApiProperty({ description: '商品id' })
+  @Rule(RuleType['string']().empty(''))
+  'goods': string = undefined;
+  @ApiProperty({ description: '商品规格id' })
+  @Rule(RuleType['string']().empty(''))
+  'spec': string = undefined;
+  @ApiProperty({ description: '数量' })
+  @Rule(RuleType['string']().empty(''))
+  'num': string = undefined;
+  @ApiProperty({ description: '总金额' })
+  @Rule(RuleType['string']().empty(''))
+  'money': string = undefined;
+}
+
+export class CVO_Cart extends FVO_Cart {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_Cart extends CDTO_Cart {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_Cart extends FVO_Cart {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 92 - 0
src/interface/Collection.interface.ts

@@ -0,0 +1,92 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import {
+  FrameworkErrorEnum,
+  SearchBase,
+  ServiceError,
+} from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_Collection {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '街道/社区' })
+  'office': string = undefined;
+  @ApiProperty({ description: '领导' })
+  'leader': Array<any> = undefined;
+  @ApiProperty({ description: '会计' })
+  'accounting': Array<any> = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+}
+
+export class QDTO_Collection extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = [];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+}
+
+export class QVO_Collection extends FVO_Collection {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_Collection {
+  @ApiProperty({ description: '街道/社区' })
+  @Rule(
+    RuleType['string']()
+      .required()
+      .error(new ServiceError('缺少街道/社区', FrameworkErrorEnum.NEED_BODY))
+  )
+  'office': string = undefined;
+  @ApiProperty({ description: '领导' })
+  @Rule(
+    RuleType['array']()
+      .required()
+      .error(new ServiceError('缺少领导', FrameworkErrorEnum.NEED_BODY))
+  )
+  'leader': Array<any> = undefined;
+  @ApiProperty({ description: '会计' })
+  @Rule(
+    RuleType['array']()
+      .required()
+      .error(new ServiceError('缺少会计', FrameworkErrorEnum.NEED_BODY))
+  )
+  'accounting': Array<any> = undefined;
+  @ApiProperty({ description: '是否使用' })
+  @Rule(RuleType['string']().empty(''))
+  'is_use': string = undefined;
+}
+
+export class CVO_Collection extends FVO_Collection {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_Collection extends CDTO_Collection {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_Collection extends FVO_Collection {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 61 - 0
src/interface/Config.interface.ts

@@ -0,0 +1,61 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_Config {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: 'logo' })
+  ' logo_url': Array<any> = undefined;
+}
+
+export class QDTO_Config extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = [];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+}
+
+export class QVO_Config extends FVO_Config {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_Config {
+  @ApiProperty({ description: 'logo' })
+  @Rule(RuleType['array']().empty(''))
+  ' logo_url': Array<any> = undefined;
+}
+
+export class CVO_Config extends FVO_Config {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_Config extends CDTO_Config {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_Config extends FVO_Config {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 96 - 0
src/interface/DictData.interface.ts

@@ -0,0 +1,96 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_DictData {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '类型' })
+  'type': string = undefined;
+  @ApiProperty({ description: '标签' })
+  'label': string = undefined;
+  @ApiProperty({ description: '键值' })
+  'value': string = undefined;
+  @ApiProperty({ description: '排序' })
+  'sort': number = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+  @ApiProperty({ description: '字数据' })
+  'children': Array<any> = undefined;
+}
+
+export class QDTO_DictData extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['type', 'label', 'value', 'sort', 'is_use'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '类型' })
+  'type': string = undefined;
+  @ApiProperty({ description: '标签' })
+  'label': string = undefined;
+  @ApiProperty({ description: '键值' })
+  'value': string = undefined;
+  @ApiProperty({ description: '排序' })
+  'sort': number = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+}
+
+export class QVO_DictData extends FVO_DictData {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_DictData {
+  @ApiProperty({ description: '类型' })
+  @Rule(RuleType['string']().empty(''))
+  'type': string = undefined;
+  @ApiProperty({ description: '标签' })
+  @Rule(RuleType['string']().empty(''))
+  'label': string = undefined;
+  @ApiProperty({ description: '键值' })
+  @Rule(RuleType['string']().empty(''))
+  'value': string = undefined;
+  @ApiProperty({ description: '排序' })
+  @Rule(RuleType['number']().empty(''))
+  'sort': number = undefined;
+  @ApiProperty({ description: '是否使用' })
+  @Rule(RuleType['string']().empty(''))
+  'is_use': string = undefined;
+  @ApiProperty({ description: '字数据' })
+  @Rule(RuleType['array']().empty(''))
+  'children': Array<any> = undefined;
+}
+
+export class CVO_DictData extends FVO_DictData {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_DictData extends CDTO_DictData {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_DictData extends FVO_DictData {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 82 - 0
src/interface/DictType.interface.ts

@@ -0,0 +1,82 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_DictType {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '名称' })
+  'title': string = undefined;
+  @ApiProperty({ description: '类型' })
+  'type': string = undefined;
+  @ApiProperty({ description: '备注' })
+  'remark': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+}
+
+export class QDTO_DictType extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['title', 'type', 'is_use'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '名称' })
+  'title': string = undefined;
+  @ApiProperty({ description: '类型' })
+  'type': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+}
+
+export class QVO_DictType extends FVO_DictType {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_DictType {
+  @ApiProperty({ description: '名称' })
+  @Rule(RuleType['string']().empty(''))
+  'title': string = undefined;
+  @ApiProperty({ description: '类型' })
+  @Rule(RuleType['string']().empty(''))
+  'type': string = undefined;
+  @ApiProperty({ description: '备注' })
+  @Rule(RuleType['string']().empty(''))
+  'remark': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  @Rule(RuleType['string']().empty(''))
+  'is_use': string = undefined;
+}
+
+export class CVO_DictType extends FVO_DictType {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_DictType extends CDTO_DictType {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_DictType extends FVO_DictType {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 92 - 0
src/interface/Good.interface.ts

@@ -0,0 +1,92 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_Good {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '图片' })
+  'file': Array<any> = undefined;
+  @ApiProperty({ description: '类型' })
+  'type': string = undefined;
+  @ApiProperty({ description: '简介' })
+  'brief': string = undefined;
+  @ApiProperty({ description: '销售数量' })
+  'sell_num': number = undefined;
+  @ApiProperty({ description: '供应商id' })
+  'supplier_id': string = undefined;
+}
+
+export class QDTO_Good extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['name', 'type', 'supplier_id'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '类型' })
+  'type': string = undefined;
+  @ApiProperty({ description: '供应商id' })
+  'supplier_id': string = undefined;
+}
+
+export class QVO_Good extends FVO_Good {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_Good {
+  @ApiProperty({ description: '名称' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '图片' })
+  @Rule(RuleType['array']().empty(''))
+  'file': Array<any> = undefined;
+  @ApiProperty({ description: '类型' })
+  @Rule(RuleType['string']().empty(''))
+  'type': string = undefined;
+  @ApiProperty({ description: '简介' })
+  @Rule(RuleType['string']().empty(''))
+  'brief': string = undefined;
+  @ApiProperty({ description: '销售数量' })
+  @Rule(RuleType['number']().empty(''))
+  'sell_num': number = undefined;
+  @ApiProperty({ description: '供应商id' })
+  @Rule(RuleType['string']().empty(''))
+  'supplier_id': string = undefined;
+}
+
+export class CVO_Good extends FVO_Good {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_Good extends CDTO_Good {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_Good extends FVO_Good {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 92 - 0
src/interface/Module.interface.ts

@@ -0,0 +1,92 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_Module {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '类型' })
+  'type': string = undefined;
+  @ApiProperty({ description: '图片' })
+  'url': Array<any> = undefined;
+  @ApiProperty({ description: '排序' })
+  'sort': number = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+  @ApiProperty({ description: '路由' })
+  'route': string = undefined;
+}
+
+export class QDTO_Module extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['name', 'type', 'status'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '类型' })
+  'type': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QVO_Module extends FVO_Module {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_Module {
+  @ApiProperty({ description: '名称' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '类型' })
+  @Rule(RuleType['string']().empty(''))
+  'type': string = undefined;
+  @ApiProperty({ description: '图片' })
+  @Rule(RuleType['array']().empty(''))
+  'url': Array<any> = undefined;
+  @ApiProperty({ description: '排序' })
+  @Rule(RuleType['number']().empty(''))
+  'sort': number = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+  @ApiProperty({ description: '路由' })
+  @Rule(RuleType['string']().empty(''))
+  'route': string = undefined;
+}
+
+export class CVO_Module extends FVO_Module {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_Module extends CDTO_Module {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_Module extends FVO_Module {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 71 - 0
src/interface/Office.interface.ts

@@ -0,0 +1,71 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_Office {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '办公处名' })
+  'name': string = undefined;
+  @ApiProperty({ description: '具体地址' })
+  'address': string = undefined;
+  @ApiProperty({ description: '所属' })
+  'belong': string = undefined;
+}
+
+export class QDTO_Office extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = [];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+}
+
+export class QVO_Office extends FVO_Office {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_Office {
+  @ApiProperty({ description: '办公处名' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '具体地址' })
+  @Rule(RuleType['string']().empty(''))
+  'address': string = undefined;
+  @ApiProperty({ description: '所属' })
+  @Rule(RuleType['string']().empty(''))
+  'belong': string = undefined;
+}
+
+export class CVO_Office extends FVO_Office {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_Office extends CDTO_Office {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_Office extends FVO_Office {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 92 - 0
src/interface/Order.interface.ts

@@ -0,0 +1,92 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_Order {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '用户' })
+  'user': string = undefined;
+  @ApiProperty({ description: '邮寄地址' })
+  'address': string = undefined;
+  @ApiProperty({ description: '商品' })
+  'goods': Array<any> = undefined;
+  @ApiProperty({ description: '总金额' })
+  'total_money': number = undefined;
+  @ApiProperty({ description: '下单时间' })
+  'buy_time': string = undefined;
+  @ApiProperty({ description: '订单状态' })
+  'status': string = undefined;
+}
+
+export class QDTO_Order extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['user', 'buy_time', 'status'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '用户' })
+  'user': string = undefined;
+  @ApiProperty({ description: '下单时间' })
+  'buy_time': string = undefined;
+  @ApiProperty({ description: '订单状态' })
+  'status': string = undefined;
+}
+
+export class QVO_Order extends FVO_Order {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_Order {
+  @ApiProperty({ description: '用户' })
+  @Rule(RuleType['string']().empty(''))
+  'user': string = undefined;
+  @ApiProperty({ description: '邮寄地址' })
+  @Rule(RuleType['string']().empty(''))
+  'address': string = undefined;
+  @ApiProperty({ description: '商品' })
+  @Rule(RuleType['array']().empty(''))
+  'goods': Array<any> = undefined;
+  @ApiProperty({ description: '总金额' })
+  @Rule(RuleType['number']().empty(''))
+  'total_money': number = undefined;
+  @ApiProperty({ description: '下单时间' })
+  @Rule(RuleType['string']().empty(''))
+  'buy_time': string = undefined;
+  @ApiProperty({ description: '订单状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+}
+
+export class CVO_Order extends FVO_Order {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_Order extends CDTO_Order {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_Order extends FVO_Order {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 103 - 0
src/interface/OrderDetail.interface.ts

@@ -0,0 +1,103 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_OrderDetail {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '总订单id' })
+  'order_id': string = undefined;
+  @ApiProperty({ description: '用户' })
+  'user': string = undefined;
+  @ApiProperty({ description: '商品id' })
+  'good': string = undefined;
+  @ApiProperty({ description: '规格id' })
+  'spec': string = undefined;
+  @ApiProperty({ description: '收货地址' })
+  'address': string = undefined;
+  @ApiProperty({ description: '下单时间' })
+  'buy_time': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QDTO_OrderDetail extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['order_id', 'user', 'good', 'spec', 'buy_time', 'status'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '总订单id' })
+  'order_id': string = undefined;
+  @ApiProperty({ description: '用户' })
+  'user': string = undefined;
+  @ApiProperty({ description: '商品id' })
+  'good': string = undefined;
+  @ApiProperty({ description: '规格id' })
+  'spec': string = undefined;
+  @ApiProperty({ description: '下单时间' })
+  'buy_time': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QVO_OrderDetail extends FVO_OrderDetail {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_OrderDetail {
+  @ApiProperty({ description: '总订单id' })
+  @Rule(RuleType['string']().empty(''))
+  'order_id': string = undefined;
+  @ApiProperty({ description: '用户' })
+  @Rule(RuleType['string']().empty(''))
+  'user': string = undefined;
+  @ApiProperty({ description: '商品id' })
+  @Rule(RuleType['string']().empty(''))
+  'good': string = undefined;
+  @ApiProperty({ description: '规格id' })
+  @Rule(RuleType['string']().empty(''))
+  'spec': string = undefined;
+  @ApiProperty({ description: '收货地址' })
+  @Rule(RuleType['string']().empty(''))
+  'address': string = undefined;
+  @ApiProperty({ description: '下单时间' })
+  @Rule(RuleType['string']().empty(''))
+  'buy_time': string = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+}
+
+export class CVO_OrderDetail extends FVO_OrderDetail {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_OrderDetail extends CDTO_OrderDetail {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_OrderDetail extends FVO_OrderDetail {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 94 - 0
src/interface/Role.interface.ts

@@ -0,0 +1,94 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_Role {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '角色名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '角色编码' })
+  'code': string = undefined;
+  @ApiProperty({ description: '简介' })
+  'brief': string = undefined;
+  @ApiProperty({ description: '底部菜单' })
+  'menu': Array<any> = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+  @ApiProperty({ description: '账号类型' })
+  'type': string = undefined;
+}
+
+export class QDTO_Role extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['name', 'code', 'status', 'type'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '角色名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '角色编码' })
+  'code': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+  @ApiProperty({ description: '账号类型' })
+  'type': string = undefined;
+}
+
+export class QVO_Role extends FVO_Role {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_Role {
+  @ApiProperty({ description: '角色名称' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '角色编码' })
+  @Rule(RuleType['string']().empty(''))
+  'code': string = undefined;
+  @ApiProperty({ description: '简介' })
+  @Rule(RuleType['string']().empty(''))
+  'brief': string = undefined;
+  @ApiProperty({ description: '底部菜单' })
+  @Rule(RuleType['array']().empty(''))
+  'menu': Array<any> = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+  @ApiProperty({ description: '账号类型' })
+  @Rule(RuleType['string']().empty(''))
+  'type': string = undefined;
+}
+
+export class CVO_Role extends FVO_Role {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_Role extends CDTO_Role {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_Role extends FVO_Role {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 78 - 0
src/interface/ShopSetting.interface.ts

@@ -0,0 +1,78 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_ShopSetting {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '街道/社区' })
+  'office': string = undefined;
+  @ApiProperty({ description: '领导' })
+  'leader': Array<any> = undefined;
+  @ApiProperty({ description: '会计' })
+  'accounting': Array<any> = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+}
+
+export class QDTO_ShopSetting extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['office'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '街道/社区' })
+  'office': string = undefined;
+}
+
+export class QVO_ShopSetting extends FVO_ShopSetting {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_ShopSetting {
+  @ApiProperty({ description: '街道/社区' })
+  @Rule(RuleType['string']().empty(''))
+  'office': string = undefined;
+  @ApiProperty({ description: '领导' })
+  @Rule(RuleType['array']().empty(''))
+  'leader': Array<any> = undefined;
+  @ApiProperty({ description: '会计' })
+  @Rule(RuleType['array']().empty(''))
+  'accounting': Array<any> = undefined;
+  @ApiProperty({ description: '是否使用' })
+  @Rule(RuleType['string']().empty(''))
+  'is_use': string = undefined;
+}
+
+export class CVO_ShopSetting extends FVO_ShopSetting {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_ShopSetting extends CDTO_ShopSetting {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_ShopSetting extends FVO_ShopSetting {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 92 - 0
src/interface/Specs.interface.ts

@@ -0,0 +1,92 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_Specs {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '商品源' })
+  'goods': string = undefined;
+  @ApiProperty({ description: '规格名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '销售价格' })
+  'money': number = undefined;
+  @ApiProperty({ description: '库存' })
+  'num': number = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+  @ApiProperty({ description: '图片' })
+  'file': Array<any> = undefined;
+}
+
+export class QDTO_Specs extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['goods', 'name', 'status'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '商品源' })
+  'goods': string = undefined;
+  @ApiProperty({ description: '规格名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QVO_Specs extends FVO_Specs {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_Specs {
+  @ApiProperty({ description: '商品源' })
+  @Rule(RuleType['string']().empty(''))
+  'goods': string = undefined;
+  @ApiProperty({ description: '规格名称' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '销售价格' })
+  @Rule(RuleType['number']().empty(''))
+  'money': number = undefined;
+  @ApiProperty({ description: '库存' })
+  @Rule(RuleType['number']().empty(''))
+  'num': number = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+  @ApiProperty({ description: '图片' })
+  @Rule(RuleType['array']().empty(''))
+  'file': Array<any> = undefined;
+}
+
+export class CVO_Specs extends FVO_Specs {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_Specs extends CDTO_Specs {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_Specs extends FVO_Specs {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 76 - 0
src/interface/Supplier.interface.ts

@@ -0,0 +1,76 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_Supplier {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '供应商名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  'tel': string = undefined;
+  @ApiProperty({ description: '负责人' })
+  'head': string = undefined;
+  @ApiProperty({ description: '负责人电话' })
+  'head_tel': string = undefined;
+}
+
+export class QDTO_Supplier extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = [];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+}
+
+export class QVO_Supplier extends FVO_Supplier {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_Supplier {
+  @ApiProperty({ description: '供应商名称' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  @Rule(RuleType['string']().empty(''))
+  'tel': string = undefined;
+  @ApiProperty({ description: '负责人' })
+  @Rule(RuleType['string']().empty(''))
+  'head': string = undefined;
+  @ApiProperty({ description: '负责人电话' })
+  @Rule(RuleType['string']().empty(''))
+  'head_tel': string = undefined;
+}
+
+export class CVO_Supplier extends FVO_Supplier {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_Supplier extends CDTO_Supplier {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_Supplier extends FVO_Supplier {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 2 - 8
src/interface/util/user.util.interface.ts

@@ -1,12 +1,6 @@
 export interface CheckUpdateCardAndPid {
-  phone?: string;
-  pid?: string;
-  code?: string;
-  name?: string;
+  tel?: string;
 }
 export interface checkPhoneAndPid {
-  phone?: string;
-  pid?: string;
-  code?: string;
-  name?: string;
+  tel?: string;
 }

+ 30 - 0
src/service/Admin.service.ts

@@ -0,0 +1,30 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import {
+  BaseService,
+  FrameworkErrorEnum,
+  ServiceError,
+} from 'free-midway-component';
+import { Admin } from '../entity/Admin.entity';
+import isEqual = require('lodash/isEqual');
+import { LoginDTO } from '../interface/Admin.interface';
+type modelType = ReturnModelType<typeof Admin>;
+@Provide()
+export class AdminService extends BaseService<modelType> {
+  @InjectEntityModel(Admin)
+  model: modelType;
+
+  async findUserToLogin(data: LoginDTO): Promise<object> {
+    const { username, password } = data;
+    const user = await this.model.findOne({ username }, '+password').lean();
+    if (!user)
+      throw new ServiceError(
+        '未找到管理员信息',
+        FrameworkErrorEnum.NOT_FOUND_DATA
+      );
+    if (!isEqual(user.password.secret, password))
+      throw new ServiceError('密码错误', FrameworkErrorEnum.SERVICE_FAULT);
+    return user;
+  }
+}

+ 11 - 0
src/service/Cart.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { Cart } from '../entity/Cart.entity';
+type modelType = ReturnModelType<typeof Cart>;
+@Provide()
+export class CartService extends BaseService<modelType> {
+  @InjectEntityModel(Cart)
+  model: modelType;
+}

+ 11 - 0
src/service/Collection.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { Collection } from '../entity/Collection.entity';
+type modelType = ReturnModelType<typeof Collection>;
+@Provide()
+export class CollectionService extends BaseService<modelType> {
+  @InjectEntityModel(Collection)
+  model: modelType;
+}

+ 11 - 0
src/service/Config.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { Config } from '../entity/Config.entity';
+type modelType = ReturnModelType<typeof Config>;
+@Provide()
+export class ConfigService extends BaseService<modelType> {
+  @InjectEntityModel(Config)
+  model: modelType;
+}

+ 11 - 0
src/service/DictData.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { DictData } from '../entity/DictData.entity';
+type modelType = ReturnModelType<typeof DictData>;
+@Provide()
+export class DictDataService extends BaseService<modelType> {
+  @InjectEntityModel(DictData)
+  model: modelType;
+}

+ 11 - 0
src/service/DictType.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { DictType } from '../entity/DictType.entity';
+type modelType = ReturnModelType<typeof DictType>;
+@Provide()
+export class DictTypeService extends BaseService<modelType> {
+  @InjectEntityModel(DictType)
+  model: modelType;
+}

+ 11 - 0
src/service/Good.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { Good } from '../entity/Good.entity';
+type modelType = ReturnModelType<typeof Good>;
+@Provide()
+export class GoodService extends BaseService<modelType> {
+  @InjectEntityModel(Good)
+  model: modelType;
+}

+ 11 - 0
src/service/Module.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { Module } from '../entity/Module.entity';
+type modelType = ReturnModelType<typeof Module>;
+@Provide()
+export class ModuleService extends BaseService<modelType> {
+  @InjectEntityModel(Module)
+  model: modelType;
+}

+ 11 - 0
src/service/Office.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { Office } from '../entity/Office.entity';
+type modelType = ReturnModelType<typeof Office>;
+@Provide()
+export class OfficeService extends BaseService<modelType> {
+  @InjectEntityModel(Office)
+  model: modelType;
+}

+ 11 - 0
src/service/Order.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { Order } from '../entity/Order.entity';
+type modelType = ReturnModelType<typeof Order>;
+@Provide()
+export class OrderService extends BaseService<modelType> {
+  @InjectEntityModel(Order)
+  model: modelType;
+}

+ 11 - 0
src/service/OrderDetail.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { OrderDetail } from '../entity/OrderDetail.entity';
+type modelType = ReturnModelType<typeof OrderDetail>;
+@Provide()
+export class OrderDetailService extends BaseService<modelType> {
+  @InjectEntityModel(OrderDetail)
+  model: modelType;
+}

+ 11 - 0
src/service/Role.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { Role } from '../entity/Role.entity';
+type modelType = ReturnModelType<typeof Role>;
+@Provide()
+export class RoleService extends BaseService<modelType> {
+  @InjectEntityModel(Role)
+  model: modelType;
+}

+ 11 - 0
src/service/ShopSetting.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { ShopSetting } from '../entity/ShopSetting.entity';
+type modelType = ReturnModelType<typeof ShopSetting>;
+@Provide()
+export class ShopSettingService extends BaseService<modelType> {
+  @InjectEntityModel(ShopSetting)
+  model: modelType;
+}

+ 11 - 0
src/service/Specs.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { Specs } from '../entity/Specs.entity';
+type modelType = ReturnModelType<typeof Specs>;
+@Provide()
+export class SpecsService extends BaseService<modelType> {
+  @InjectEntityModel(Specs)
+  model: modelType;
+}

+ 11 - 0
src/service/Supplier.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { Supplier } from '../entity/Supplier.entity';
+type modelType = ReturnModelType<typeof Supplier>;
+@Provide()
+export class SupplierService extends BaseService<modelType> {
+  @InjectEntityModel(Supplier)
+  model: modelType;
+}

+ 44 - 0
src/service/Tool.service.ts

@@ -0,0 +1,44 @@
+import { Provide } from '@midwayjs/decorator';
+import { FrameworkErrorEnum, ServiceError } from 'free-midway-component';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { User } from '../entity/User.entity';
+import { makeHttpRequest, Config } from '@midwayjs/core';
+import _ = require('lodash');
+@Provide()
+export class ToolService {
+  @Config('wechatSetting')
+  wechatSetting;
+
+  @InjectEntityModel(User)
+  userModel: ReturnModelType<typeof User>;
+
+  // 获取openid
+  async appLogin(config, js_code) {
+    const appConfig = _.get(this.wechatSetting, config);
+    if (!appConfig)
+      throw new ServiceError(
+        '未设置该微信相关信息,无法登陆!',
+        FrameworkErrorEnum.SERVICE_FAULT
+      );
+    const { appid, secret } = appConfig;
+    if (!(appid && secret))
+      throw new ServiceError(
+        '微信相关信息设置错误,无法登陆!',
+        FrameworkErrorEnum.SERVICE_FAULT
+      );
+    const url = `https://api.weixin.qq.com/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${js_code}&grant_type=authorization_code`;
+    const res = await makeHttpRequest(url, {
+      method: 'GET',
+      contentType: 'json',
+      dataType: 'json',
+    });
+    const openid = _.get(res, 'data.openid');
+    if (!openid)
+      throw new ServiceError(
+        '未获取到openid',
+        FrameworkErrorEnum.NOT_FOUND_DATA
+      );
+    return { openid };
+  }
+}

+ 14 - 115
src/service/util/user.util.ts

@@ -2,12 +2,7 @@ import { Provide } from '@midwayjs/decorator';
 import { InjectEntityModel } from '@midwayjs/typegoose';
 import { ReturnModelType } from '@typegoose/typegoose';
 import { FrameworkErrorEnum, ServiceError } from 'free-midway-component';
-import { Admin } from '../../entity/user/admin.entity';
-import { Personal } from '../../entity/user/personal.entity';
-import { Company } from '../../entity/user/company.entity';
-import { Expert } from '../../entity/user/expert.entity';
-import { Types } from 'mongoose';
-const ObjectId = Types.ObjectId;
+import { User } from '../../entity/User.entity';
 import {
   CheckUpdateCardAndPid,
   checkPhoneAndPid,
@@ -15,136 +10,40 @@ import {
 
 @Provide()
 export class UserUtilService {
-  @InjectEntityModel(Admin)
-  adminModel: ReturnModelType<typeof Admin>;
-
-  @InjectEntityModel(Personal)
-  personalModel: ReturnModelType<typeof Personal>;
-
-  @InjectEntityModel(Company)
-  companyModel: ReturnModelType<typeof Company>;
-
-  @InjectEntityModel(Expert)
-  expertModel: ReturnModelType<typeof Expert>;
+  @InjectEntityModel(User)
+  UserModel: ReturnModelType<typeof User>;
 
   /**
    * 检查创建时,手机号和上级id
    * @param data 参数
    */
   async checkPhoneAndPid(data: checkPhoneAndPid) {
-    if (data.phone) {
+    if (data.tel) {
       // 检查手机号
-      // 管理员
-      const adminan = await this.adminModel.count({ phone: data.phone });
-      if (adminan > 0) {
-        throw new ServiceError(
-          '已有管理员/机构管理员/业务管理员 使用该手机号',
-          FrameworkErrorEnum.BAD_BODY
-        );
-      }
-      // 专家
-      const expertan = await this.expertModel.count({
-        phone: data.phone,
-      });
-      if (expertan > 0) {
+      const useran = await this.UserModel.count({ tel: data.tel });
+      if (useran > 0) {
         throw new ServiceError(
-          '已有专家用户使用该手机号',
+          '已有用户 使用该手机号',
           FrameworkErrorEnum.BAD_BODY
         );
       }
-      // 企业
-      const companyan = await this.companyModel.count({
-        phone: data.phone,
-      });
-      if (companyan > 0) {
-        throw new ServiceError(
-          '已有企业用户使用该手机号',
-          FrameworkErrorEnum.BAD_BODY
-        );
-      }
-      if (data.code) {
-        // 用户
-        const personalan = await this.personalModel.count({
-          phone: data.phone,
-          code: data.code,
-        });
-        if (personalan > 0) {
-          throw new ServiceError(
-            `姓名:${data.name} ; 手机号: ${data.phone} ;已有机构所属的个人用户使用该手机号`,
-            FrameworkErrorEnum.BAD_BODY
-          );
-        }
-      }
-    }
-    // 检查上级id
-    if (data.pid) {
-      // 管理员
-      const adminid = await this.adminModel.count({
-        _id: new ObjectId(data.pid),
-      });
-      if (adminid <= 0)
-        throw new ServiceError(
-          '未找到上级的信息',
-          FrameworkErrorEnum.NOT_FOUND_DATA
-        );
-    } else {
-      throw new ServiceError(
-        '未找到上级的信息',
-        FrameworkErrorEnum.NOT_FOUND_DATA
-      );
     }
   }
   /**
-   * 检查创建时,手机号和上级id
+   * 检查创建时,手机号
    * @param id 当前要修改的数据
    * @param data 参数
    */
   async checkUpdateCardAndPid(id, data: CheckUpdateCardAndPid) {
-    const { phone, code, name } = data;
-    if (phone && code) {
-      // 用户
-      const personalan = await this.personalModel.count({
-        _id: { $ne: id },
-        phone,
-        code,
-      });
-      if (personalan > 0)
-        throw new ServiceError(
-          `姓名:${name} ; 手机号: ${phone} ;已有机构所属的个人用户使用该手机号`,
-          FrameworkErrorEnum.BAD_BODY
-        );
-    }
-    if (phone) {
-      // 管理员
-      const adminan = await this.adminModel.count({
-        _id: { $ne: id },
-        phone,
-      });
-      if (adminan > 0) {
-        throw new ServiceError(
-          '已有管理员/机构管理员/业务管理员 使用该手机号',
-          FrameworkErrorEnum.BAD_BODY
-        );
-      }
-      // 专家
-      const expertan = await this.expertModel.count({
-        _id: { $ne: id },
-        phone,
-      });
-      if (expertan > 0) {
-        throw new ServiceError(
-          '已有专家用户使用该手机号',
-          FrameworkErrorEnum.BAD_BODY
-        );
-      }
-      // 企业
-      const companyan = await this.companyModel.count({
+    const { tel } = data;
+    if (tel) {
+      const useran = await this.UserModel.count({
         _id: { $ne: id },
-        phone,
+        tel,
       });
-      if (companyan > 0) {
+      if (useran > 0) {
         throw new ServiceError(
-          '已有企业用户使用该手机号',
+          '已有用户 使用该手机号',
           FrameworkErrorEnum.BAD_BODY
         );
       }