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'); 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) { async function get(ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const { keywordTarget, keyword, entryTime, limit, page } = ctx.query; const { keywordTarget, keyword, timeRange, limit, page } = ctx.query;
const where = {}; const where = {};
if (keywordTarget && keyword) {
where[keywordTarget] = { $iLike: `%${keyword}%` };
}
if(timeRange){
where.communicateDate= { $between: timeRange.split(',') };
}
let employeeCommunicate = await models.EmployeeCommunicate.findAndCountAll({ let employeeCommunicate = await models.EmployeeCommunicate.findAndCountAll({
where: where, where: where,
offset: Number(page) * Number(limit), offset: Number(page) * Number(limit),

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

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

Loading…
Cancel
Save