|
@@ -40,13 +40,16 @@ module.exports = app => {
|
|
|
' oc.p_code As c_code, oc.new_code As c_new_code' +
|
|
|
' FROM ' + this.tableName + ' As c ' +
|
|
|
' INNER JOIN ( ' +
|
|
|
- ' SELECT MAX(`stimes` * ' + timesLen + ' + `sorder`) As `progress`, `lid`, `pid`, `sid` From ' + this.tableName +
|
|
|
+ ' SELECT MAX(`stimes` * ' + timesLen + ' + `sorder`) As `progress`, `lid`, `pid`, `sid`, `cid`, `cbid` From ' + this.tableName +
|
|
|
' WHERE tid = ? And sid = ? And lid = ? And pid = ?' +
|
|
|
- ' GROUP By `lid`, `pid`' +
|
|
|
+ ' GROUP By `lid`, `pid`, `cid`, `cbid`' +
|
|
|
' ) As m ' +
|
|
|
- ' ON (c.stimes * ' + timesLen + ' + c.sorder) = m.progress And c.lid = m.lid And c.pid = m.pid And c.`sid` = m.`sid`' +
|
|
|
+ ' ON (c.stimes * ' + timesLen + ' + c.sorder) = m.progress And c.lid = m.lid And c.pid = m.pid And c.`sid` = m.`sid` And c.`cid` = m.`cid` And c.`cbid` = m.`cbid`' +
|
|
|
' LEFT JOIN ' + this.ctx.service.change.tableName + ' As oc' +
|
|
|
- ' ON c.cid = oc.cid';
|
|
|
+ ' ON c.cid = oc.cid' +
|
|
|
+ ' LEFT JOIN ' + this.ctx.service.changeAuditList.tableName + ' As ocb' +
|
|
|
+ ' ON c.cbid = ocb.id' +
|
|
|
+ ' WHERE not ISNULL(ocb.id)';
|
|
|
const sqlParam = [tid, sid, lid, pid ? pid : -1];
|
|
|
return await this.db.query(sql, sqlParam);
|
|
|
}
|
|
@@ -66,13 +69,16 @@ module.exports = app => {
|
|
|
' oc.p_code As c_code, oc.new_code As c_new_code' +
|
|
|
' FROM ' + this.tableName + ' As c ' +
|
|
|
' INNER JOIN ( ' +
|
|
|
- ' SELECT MAX(`stimes` * ' + timesLen + ' + `sorder`) As `progress`, `lid`, `pid`, `sid` From ' + this.tableName +
|
|
|
+ ' SELECT MAX(`stimes` * ' + timesLen + ' + `sorder`) As `progress`, `lid`, `pid`, `sid`, `cid`, `cbid` From ' + this.tableName +
|
|
|
' WHERE tid = ? And sid = ? And (`stimes` < ? OR (`stimes` = ? AND `sorder` <= ?)) And lid = ? And pid = ?' +
|
|
|
' GROUP By `lid`, `pid`' +
|
|
|
' ) As m ' +
|
|
|
- ' ON (c.stimes * ' + timesLen + ' + c.sorder) = m.progress And c.lid = m.lid And c.pid = m.pid And c.`sid` = m.`sid`' +
|
|
|
+ ' ON (c.stimes * ' + timesLen + ' + c.sorder) = m.progress And c.lid = m.lid And c.pid = m.pid And c.`sid` = m.`sid` And c.`cid` = m.`cid` And c.`cbid` = m.`cbid`' +
|
|
|
' LEFT JOIN ' + this.ctx.service.change.tableName + ' As oc' +
|
|
|
- ' ON c.cid = oc.cid';
|
|
|
+ ' ON c.cid = oc.cid' +
|
|
|
+ ' LEFT JOIN ' + this.ctx.service.changeAuditList.tableName + ' As ocb' +
|
|
|
+ ' ON c.cbid = ocb.id' +
|
|
|
+ ' WHERE not ISNULL(ocb.id)';
|
|
|
const sqlParam = [tid, sid, times, times, order, lid, pid ? pid : -1];
|
|
|
return await this.db.query(sql, sqlParam);
|
|
|
}
|
|
@@ -82,13 +88,16 @@ module.exports = app => {
|
|
|
' oc.p_code As c_code, oc.new_code As c_new_code' +
|
|
|
' FROM ' + this.tableName + ' As c ' +
|
|
|
' INNER JOIN ( ' +
|
|
|
- ' SELECT MAX(`stimes` * ' + timesLen + ' + `sorder`) As `progress`, `lid`, `pid`, `sid` From ' + this.tableName +
|
|
|
+ ' SELECT MAX(`stimes` * ' + timesLen + ' + `sorder`) As `progress`, `lid`, `pid`, `sid`, `cid`, `cbid` From ' + this.tableName +
|
|
|
' WHERE tid = ? And sid = ?' +
|
|
|
' GROUP By `lid`, `pid`' +
|
|
|
' ) As m ' +
|
|
|
- ' ON (c.stimes * ' + timesLen + ' + c.sorder) = m.progress And c.lid = m.lid And c.pid = m.pid And c.`sid` = m.`sid`' +
|
|
|
+ ' ON (c.stimes * ' + timesLen + ' + c.sorder) = m.progress And c.lid = m.lid And c.pid = m.pid And c.`sid` = m.`sid` And c.`cid` = m.`cid` And c.`cbid` = m.`cbid`' +
|
|
|
' LEFT JOIN ' + this.ctx.service.change.tableName + ' As oc' +
|
|
|
- ' ON c.cid = oc.cid';
|
|
|
+ ' ON c.cid = oc.cid'+
|
|
|
+ ' LEFT JOIN ' + this.ctx.service.changeAuditList.tableName + ' As ocb' +
|
|
|
+ ' ON c.cbid = ocb.id' +
|
|
|
+ ' WHERE not ISNULL(ocb.id)';
|
|
|
const sqlParam = [tid, sid];
|
|
|
return await this.db.query(sql, sqlParam);
|
|
|
}
|
|
@@ -98,13 +107,16 @@ module.exports = app => {
|
|
|
' oc.p_code As c_code, oc.new_code As c_new_code' +
|
|
|
' FROM ' + this.tableName + ' As c ' +
|
|
|
' INNER JOIN ( ' +
|
|
|
- ' SELECT MAX(`stimes` * ' + timesLen + ' + `sorder`) As `progress`, `lid`, `pid`, `sid` From ' + this.tableName +
|
|
|
+ ' SELECT MAX(`stimes` * ' + timesLen + ' + `sorder`) As `progress`, `lid`, `pid`, `sid`, `cid`, `cbid` From ' + this.tableName +
|
|
|
' WHERE tid = ? And sid = ? And (`stimes` < ? OR (`stimes` = ? AND `sorder` <= ?))' +
|
|
|
' GROUP By `lid`, `pid`' +
|
|
|
' ) As m ' +
|
|
|
- ' ON (c.stimes * ' + timesLen + ' + c.sorder) = m.progress And c.lid = m.lid And c.pid = m.pid And c.`sid` = m.`sid`' +
|
|
|
+ ' ON (c.stimes * ' + timesLen + ' + c.sorder) = m.progress And c.lid = m.lid And c.pid = m.pid And c.`sid` = m.`sid` And c.`cid` = m.`cid` And c.`cbid` = m.`cbid`' +
|
|
|
' LEFT JOIN ' + this.ctx.service.change.tableName + ' As oc' +
|
|
|
- ' ON c.cid = oc.cid';
|
|
|
+ ' ON c.cid = oc.cid'+
|
|
|
+ ' LEFT JOIN ' + this.ctx.service.changeAuditList.tableName + ' As ocb' +
|
|
|
+ ' ON c.cbid = ocb.id' +
|
|
|
+ ' WHERE not ISNULL(ocb.id)';
|
|
|
const sqlParam = [tid, sid, times, times, order];
|
|
|
return await this.db.query(sql, sqlParam);
|
|
|
}
|