Commit ff0cdd06 by Sxy

feat: 分配记录

parent 26192b3c
......@@ -51,5 +51,34 @@ class BizOptCtl extends CtlBase {
}
}
// 沟通记录 查询
async communicationRecordList(pobj) {
if (!pobj.bizId) {
return system.getResult(null, "bizId can not be empty,100290");
}
try {
const rs = await this.service.communicationRecordList(pobj);
return system.getResult(rs.reverse());
} catch (err) {
return system.getResult(null, err.message);
}
}
// 沟通记录新增
async createCommunicationRecord(pobj) {
if (!pobj.bizId) {
return system.getResult(null, "bizId can not be empty,100290");
}
if (!pobj.content) {
return system.getResult(null, "content can not be empty,100290");
}
try {
await this.service.createCommunicationRecord(pobj);
return system.getResultSuccess();
} catch (err) {
return system.getResult(null, err.message);
}
}
}
module.exports = BizOptCtl;
const system = require("../../../system");
const Dao = require("../../dao.base");
class CommunicationrecordDao extends Dao {
constructor() {
super(Dao.getModelName(CommunicationrecordDao));
}
}
module.exports = CommunicationrecordDao;
......@@ -106,6 +106,10 @@ class DbFactory {
this.db.models.scheme.belongsTo(this.db.models.bizopt, { constraints: false, });
this.db.models.bizopt.hasOne(this.db.models.scheme, { constraints: false, });
// 沟通记录表
this.db.models.communicationrecord.belongsTo(this.db.models.bizopt, { constraints: false, });
this.db.models.bizopt.hasOne(this.db.models.communicationrecord, { constraints: false, });
// 交付单表 1:1 临时材料表
this.db.models.cacheinfo.belongsTo(this.db.models.deliver, { constraints: false, });
this.db.models.deliver.hasOne(this.db.models.cacheinfo, { constraints: false, });
......
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
/**
* 沟通记录表
*/
module.exports = (db, DataTypes) => {
return db.define("communicationrecord", {
content: {
allowNull: false,
type: DataTypes.TEXT
},
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'communication_record',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
......@@ -9,6 +9,7 @@ class BizoptService extends ServiceBase {
super("bizchance", ServiceBase.getDaoName(BizoptService));
this.schemeDao = system.getObject("db.bizchance.schemeDao");
this.statuslogDao = system.getObject("db.bizchance.statuslogDao");
this.communicationrecordDao = system.getObject("db.bizchance.communicationrecordDao");
}
async findBizAndSheme(pobj) {
let data = await this.dao.findBizAndSheme(pobj.id);
......@@ -111,6 +112,19 @@ class BizoptService extends ServiceBase {
}
// 沟通记录 查询
async communicationRecordList(pobj) {
const rs = await this.communicationrecordDao.findAll({
bizopt_id: pobj.bizId
});
return rs;
}
// 沟通记录新增
async createCommunicationRecord(pobj) {
await this.communicationrecordDao.create({
bizopt_id: pobj.bizId,
content: pobj.content
});
}
}
module.exports = BizoptService;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment