guhongwei 4 年之前
父節點
當前提交
b479f03366
共有 5 個文件被更改,包括 192 次插入0 次删除
  1. 103 0
      app/controller/.zhwlcar.js
  2. 16 0
      app/controller/zhwlcar.js
  3. 54 0
      app/model/zhwlcar.js
  4. 3 0
      app/router.js
  5. 16 0
      app/service/zhwlcar.js

+ 103 - 0
app/controller/.zhwlcar.js

@@ -0,0 +1,103 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "car_onwer",
+      "it",
+      "it_member",
+      "ro",
+      "r_time",
+      "car_no",
+      "car_type",
+      "cc_no",
+      "cc_weight",
+      "cc_scrap_time",
+      "cc_examine_time",
+      "rc_no",
+      "rc_examine_time",
+      "bcc_no",
+      "fi_name",
+      "fi_tel",
+      "fi_no",
+      "fi_cost",
+      "fi_start_time",
+      "fi_end_time",
+      "fi_dw",
+      "fi_vt",
+      "fi_sign_time",
+      "bi_name",
+      "bi_tel",
+      "bi_no",
+      "bi_cost",
+      "bi_start_time",
+      "bi_end_time",
+      "bi_dw",
+      "bi_sign_time",
+      "remark",
+      "last_place",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "car_onwer",
+      "it",
+      "it_member",
+      "ro",
+      "r_time",
+      "car_no",
+      "car_type",
+      "cc_no",
+      "cc_weight",
+      "cc_scrap_time",
+      "cc_examine_time",
+      "rc_no",
+      "rc_examine_time",
+      "bcc_no",
+      "fi_name",
+      "fi_tel",
+      "fi_no",
+      "fi_cost",
+      "fi_start_time",
+      "fi_end_time",
+      "fi_dw",
+      "fi_vt",
+      "fi_sign_time",
+      "bi_name",
+      "bi_tel",
+      "bi_no",
+      "bi_cost",
+      "bi_start_time",
+      "bi_end_time",
+      "bi_dw",
+      "bi_sign_time",
+      "remark",
+      "last_place",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        car_onwer: "car_onwer",
+        it: "it",
+        it_member: "it_member",
+      },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+};

+ 16 - 0
app/controller/zhwlcar.js

@@ -0,0 +1,16 @@
+'use strict';
+
+// const _ = require('lodash');
+const meta = require('./.zhwlcar.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 车辆表
+class ZhwlcarController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.zhwlcar;
+  }
+}
+
+module.exports = CrudController(ZhwlcarController, meta);

+ 54 - 0
app/model/zhwlcar.js

@@ -0,0 +1,54 @@
+'use strict';
+const Schema = require('mongoose').Schema;
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
+// 车辆表
+const ZhwlcarSchema = {
+  car_onwer: { type: String, required: false, maxLength: 200 }, // 机动车所有人
+  it: { type: String, required: false, maxLength: 200 }, // 身份证明名称
+
+  it_member: { type: String, required: false, maxLength: 200 }, // 身份证明代码
+  ro: { type: String, required: false, maxLength: 200 }, // 登记机关
+  r_time: { type: String, required: false, maxLength: 200 }, // 登记日期
+  car_no: { type: String, required: false, maxLength: 200 }, // 机动车登记编号
+  car_type: { type: String, required: false, maxLength: 200 }, // 机动车类别
+
+  cc_no: { type: String, required: false, maxLength: 200 }, // 机动车档案编号
+  cc_weight: { type: String, required: false, maxLength: 200 }, // 机动车整备质量(自重)
+  cc_scrap_time: { type: String, required: false, maxLength: 200 }, // 机动车强制报废日期
+  cc_examine_time: { type: String, required: false, maxLength: 200 }, // 机动车检验有效期
+  rc_no: { type: String, required: false, maxLength: 200 }, // 道路运输证编号
+  rc_examine_time: { type: String, required: false, maxLength: 200 }, // 道路检验有效期
+
+  bcc_no: { type: String, required: false, maxLength: 200 }, // 车辆购置税完税证明编号
+  fi_name: { type: String, required: false, maxLength: 200 }, // 强制险责任公司
+  fi_tel: { type: String, required: false, maxLength: 200 }, // 强制险责任公司服务电话
+  fi_no: { type: String, required: false, maxLength: 200 }, // 强制险保险单号
+  fi_cost: { type: String, required: false, maxLength: 200 }, // 强制险费用合计
+
+  fi_start_time: { type: String, required: false, maxLength: 200 }, // 强制险起始时间
+  fi_end_time: { type: String, required: false, maxLength: 200 }, // 强制险截止时间
+  fi_dw: { type: String, required: false, maxLength: 200 }, // 强制险合同争议解决方式
+  fi_vt: { type: String, required: false, maxLength: 200 }, // 强制险代收车船使用税
+  fi_sign_time: { type: String, required: false, maxLength: 200 }, // 强制险签单日期
+
+  bi_name: { type: String, required: false, maxLength: 200 }, // 商业险责任公司名称
+  bi_tel: { type: String, required: false, maxLength: 200 }, // 商业险责任公司电话
+  bi_no: { type: String, required: false, maxLength: 200 }, // 商业险保险单号
+  bi_cost: { type: String, required: false, maxLength: 200 }, // 商业险费用合计
+  bi_start_time: { type: String, required: false, maxLength: 200 }, // 商业险起始日期
+
+  bi_end_time: { type: String, required: false, maxLength: 200 }, // 商业险截止日期
+  bi_dw: { type: String, required: false, maxLength: 200 }, // 商业险合同争议解决方式
+  bi_sign_time: { type: String, required: false, maxLength: 200 }, // 商业险签约日期
+  remark: { type: String, required: false, maxLength: 200 }, // 备注
+  last_place: { type: String, required: false, maxLength: 200 }, // 最后地点
+};
+
+const schema = new Schema(ZhwlcarSchema, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.plugin(metaPlugin);
+
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Zhwlcar', schema, 'zhwlcar');
+};

+ 3 - 0
app/router.js

@@ -23,4 +23,7 @@ module.exports = app => {
   router.resources('zhwldriver', '/api/servicezhwl/zhwldriver', controller.zhwldriver); // index、create、show、destroy
   router.post('zhwldriver', '/api/servicezhwl/zhwldriver/update/:id', controller.zhwldriver.update);
 
+  // 车辆表
+  router.resources('zhwlcar', '/api/servicezhwl/zhwlcar', controller.zhwlcar); // index、create、show、destroy
+  router.post('zhwlcar', '/api/servicezhwl/zhwlcar/update/:id', controller.zhwlcar.update);
 };

+ 16 - 0
app/service/zhwlcar.js

@@ -0,0 +1,16 @@
+'use strict';
+
+const assert = require('assert');
+const _ = require('lodash');
+const { ObjectId } = require('mongoose').Types;
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { ZhwlcarError, ErrorCode } = require('naf-core').Error;
+
+class ZhwlcarService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'zhwlcar');
+    this.model = this.ctx.model.Zhwlcar;
+  }
+}
+
+module.exports = ZhwlcarService;