Archer_cdm
2 years ago
3 changed files with 116 additions and 0 deletions
@ -0,0 +1,23 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
async function getPersonalTrainRecordList(ctx) { |
||||
|
try { |
||||
|
const { models } = ctx.fs.dc; |
||||
|
const { limit, page } = ctx.query; |
||||
|
let personalTrainDetail = await models.PersonalTraining.findAndCountAll({ |
||||
|
offset: Number(page) * Number(limit), |
||||
|
limit: Number(limit), |
||||
|
order: [['id', 'ASC']] |
||||
|
}); |
||||
|
ctx.status = 200 |
||||
|
ctx.body = personalTrainDetail; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path:${ctx.path},error:${error}`) |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { name: 'FindError', message: '查询个人培训记录数据失败' } |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
module.exports = { |
||||
|
getPersonalTrainRecordList |
||||
|
} |
@ -0,0 +1,85 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const PersonalTraining = sequelize.define("personalTraining", { |
||||
|
id: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
primaryKey: true, |
||||
|
field: "id", |
||||
|
autoIncrement: true, |
||||
|
}, |
||||
|
personalName: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
field: "personalname", |
||||
|
}, |
||||
|
departmentName: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
field: "departmentname", |
||||
|
}, |
||||
|
trainingType: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
field: "trainingtype", |
||||
|
}, |
||||
|
topic: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
field: "topic", |
||||
|
}, |
||||
|
trainer: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
field: "trainer", |
||||
|
}, |
||||
|
trainDate: { |
||||
|
type: DataTypes.DATE, |
||||
|
allowNull: false, |
||||
|
field: "traindate", |
||||
|
}, |
||||
|
trainTime: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
field: "traintime", |
||||
|
}, |
||||
|
trainMethod: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
field: "trainmethod", |
||||
|
}, |
||||
|
attendanceScore: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: true, |
||||
|
field: "attendancescore", |
||||
|
}, |
||||
|
appraisalMethod: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
field: "appraisalmethod", |
||||
|
}, |
||||
|
appraisalScore: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: true, |
||||
|
field: "appraisalscore", |
||||
|
}, |
||||
|
totalScore: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: true, |
||||
|
field: "totalscore", |
||||
|
}, |
||||
|
origin: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: true, |
||||
|
field: "origin", |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "personal_training", |
||||
|
}); |
||||
|
dc.models.PersonalTraining = PersonalTraining; |
||||
|
return PersonalTraining; |
||||
|
}; |
@ -0,0 +1,8 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
const personalTrain = require('../../controllers/personalTrain'); |
||||
|
|
||||
|
module.exports = function (app, router, opts) { |
||||
|
app.fs.api.logAttr['GET/personal/train/record/list'] = { content: '查询个人培训记录列表', visible: true }; |
||||
|
router.get('/personal/train/record/list', personalTrain.getPersonalTrainRecordList); |
||||
|
}; |
Loading…
Reference in new issue