Browse Source

(*)员工沟通表模型更改,查询接口修改

master
zmh 2 years ago
parent
commit
1dd77a0654
  1. 11
      api/app/lib/controllers/employeeCommunicate/index.js
  2. 99
      api/app/lib/models/employee_communicate.js

11
api/app/lib/controllers/employeeCommunicate/index.js

@ -3,14 +3,19 @@ const fs = require('fs');
const moment = require('moment');
/**
* 查询员工沟通统计数据
* @param {*} ctx ctx ctx.query:{keywordTarget-关键字项keyword-关键字内容limit-页宽, page-页码}
* @param {*} ctx ctx ctx.query:{keywordTarget-关键字项keyword-关键字内容timeRange-沟通时间limit-页宽, page-页码}
*/
async function get(ctx) {
try {
const { models } = ctx.fs.dc;
const { keywordTarget, keyword, entryTime, limit, page } = ctx.query;
const { keywordTarget, keyword, timeRange, limit, page } = ctx.query;
const where = {};
if (keywordTarget && keyword) {
where[keywordTarget] = { $iLike: `%${keyword}%` };
}
if(timeRange){
where.communicateDate= { $between: timeRange.split(',') };
}
let employeeCommunicate = await models.EmployeeCommunicate.findAndCountAll({
where: where,
offset: Number(page) * Number(limit),

99
api/app/lib/models/employee_communicate.js

@ -1,4 +1,5 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
@ -8,57 +9,151 @@ module.exports = dc => {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
autoIncrement: true
},
personalName: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "personalname",
autoIncrement: false
},
job: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "job",
autoIncrement: false
},
departmentName: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "departmentname",
autoIncrement: false
},
communicateDate: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "communicatedate",
autoIncrement: false
},
communicateContent: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "communicatecontent",
autoIncrement: false
},
communicateResult: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "communicateresult",
autoIncrement: false
},
valuation: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "valuation",
autoIncrement: false
},
communicateCondition: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "communicatecondition",
autoIncrement: false
},
nextPlan: {
type: DataTypes.STRING,
allowNull: true,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "nextplan",
autoIncrement: false
},
topic: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "topic",
autoIncrement: false
},
communicateEndDate: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "communicateenddate",
autoIncrement: false
},
background: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "background",
autoIncrement: false
},
suggestion: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "suggestion",
autoIncrement: false
},
toPersonSugges: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "topersonsugges",
autoIncrement: false
},
training: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "training",
autoIncrement: false
}
}, {
tableName: "employee_communicate",
comment: "",
indexes: []
});
dc.models.EmployeeCommunicate = EmployeeCommunicate;
return EmployeeCommunicate;

Loading…
Cancel
Save