|
@@ -31,13 +31,9 @@ module.exports = app => {
|
|
|
* @returns {Promise<void>}
|
|
|
*/
|
|
|
async getDatas(tid, sid = -1) {
|
|
|
- // return await this.db.select(this.tableName, {
|
|
|
- // where: {tid: tid, sid: -1},
|
|
|
- // columns: ['id', 'uid', 'lid', 'share', 'color', 'comment'],
|
|
|
- // orders: [['create_time', 'desc']],
|
|
|
- // });
|
|
|
- const sql = 'SELECT id, uid, lid, share, color, comment FROM ' + this.tableName +
|
|
|
- ' WHERE tid = ? and sid = ? and (uid = ? or share) ORDER BY create_time DESC';
|
|
|
+ const sql = 'SELECT la.id, la.uid, la.lid, la.share, la.color, la.comment, pa.name as u_name FROM ' + this.tableName + ' la ' +
|
|
|
+ ' LEFT JOIN ' + this.ctx.service.projectAccount.tableName + ' pa ON la.uid = pa.id' +
|
|
|
+ ' WHERE la.tid = ? and la.sid = ? and (la.uid = ? or la.share) ORDER BY la.create_time DESC';
|
|
|
return await this.db.query(sql, [tid, sid, this.ctx.session.sessionUser.accountId]);
|
|
|
}
|
|
|
|
|
@@ -67,6 +63,7 @@ module.exports = app => {
|
|
|
}
|
|
|
const result = await this.db.insert(this.tableName, data);
|
|
|
data.id = result.insertId;
|
|
|
+ data.u_name = this.ctx.session.sessionUser.name;
|
|
|
return data;
|
|
|
}
|
|
|
|