|
@@ -107,6 +107,8 @@ type ErmcpReportOPLog struct {
|
|
|
OPTYPENAME string `json:"optypename"` // 流水类型名称
|
|
OPTYPENAME string `json:"optypename"` // 流水类型名称
|
|
|
LOGTYPENAME string `json:"logtypename"` // 合同类型(名称)
|
|
LOGTYPENAME string `json:"logtypename"` // 合同类型(名称)
|
|
|
APPLYNAME string `json:"applyname"` // 操作人名称
|
|
APPLYNAME string `json:"applyname"` // 操作人名称
|
|
|
|
|
+ BRANDNAME string `json:"brandname" xorm:"'brandname'"` // 品牌名称
|
|
|
|
|
+ MODELNAME string `json:"modelname" xorm:"'modelname'"` // 型号名称
|
|
|
|
|
|
|
|
LogTypeFilter string `json:"-"` // 查询日志类型, 逗号隔开(如 1,2,4)
|
|
LogTypeFilter string `json:"-"` // 查询日志类型, 逗号隔开(如 1,2,4)
|
|
|
}
|
|
}
|
|
@@ -162,6 +164,11 @@ func (r *ErmcpReportOPLog) Calc() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 去除多余的0,最后4个0
|
|
|
|
|
+ if r.LOGVALUE[len(r.LOGVALUE)-4:] == "0000" {
|
|
|
|
|
+ r.LOGVALUE = r.LOGVALUE[:len(r.LOGVALUE)-4]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if r.BIZTYPE == 1 {
|
|
if r.BIZTYPE == 1 {
|
|
|
r.LOGTYPENAME += "计划"
|
|
r.LOGTYPENAME += "计划"
|
|
|
} else if r.BIZTYPE == 2 {
|
|
} else if r.BIZTYPE == 2 {
|
|
@@ -170,21 +177,7 @@ func (r *ErmcpReportOPLog) Calc() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (r *ErmcpReportOPLog) buildSql() string {
|
|
func (r *ErmcpReportOPLog) buildSql() string {
|
|
|
- var sqlId utils.SQLVal = "with tmp as" +
|
|
|
|
|
- " (select to_char(t.hedgeplanid) relatedid," +
|
|
|
|
|
- " t.hedgeplanno relatedno," +
|
|
|
|
|
- " 1 as logType," +
|
|
|
|
|
- " t.contracttype" +
|
|
|
|
|
- " from ermcp_hedgeplan t" +
|
|
|
|
|
- " where t.areauserid = %v" +
|
|
|
|
|
- " union all" +
|
|
|
|
|
- " select to_char(t.spotcontractid)," +
|
|
|
|
|
- " t.contractno," +
|
|
|
|
|
- " 2 as logType," +
|
|
|
|
|
- " t.contracttype" +
|
|
|
|
|
- " from ermcp_spotcontract t" +
|
|
|
|
|
- " where t.userid = %v)" +
|
|
|
|
|
- " SELECT to_char(t.LOGID) LOGID," +
|
|
|
|
|
|
|
+ var sqlId utils.SQLVal = "SELECT to_char(t.LOGID) LOGID," +
|
|
|
" t.BIZTYPE," +
|
|
" t.BIZTYPE," +
|
|
|
" t.OPERATELOGTYPE," +
|
|
" t.OPERATELOGTYPE," +
|
|
|
" to_char(t.RELATEDID) RELATEDID," +
|
|
" to_char(t.RELATEDID) RELATEDID," +
|
|
@@ -195,17 +188,26 @@ func (r *ErmcpReportOPLog) buildSql() string {
|
|
|
" t.CONTRACTTYPE," +
|
|
" t.CONTRACTTYPE," +
|
|
|
" t.USERID," +
|
|
" t.USERID," +
|
|
|
" t.WRSTANDARDID," +
|
|
" t.WRSTANDARDID," +
|
|
|
- " tmp.relatedno," +
|
|
|
|
|
|
|
+ " s.contractno relatedno," +
|
|
|
|
|
+ " s.spotgoodsbrandid," +
|
|
|
|
|
+ " s.spotgoodsmodelid," +
|
|
|
" w.wrstandardname," +
|
|
" w.wrstandardname," +
|
|
|
" w.wrstandardcode," +
|
|
" w.wrstandardcode," +
|
|
|
- " w.unitid" +
|
|
|
|
|
|
|
+ " w.unitid," +
|
|
|
|
|
+ " gb.brandname," +
|
|
|
|
|
+ " gm.modelname" +
|
|
|
" FROM ERMCP_CONTRACTOPERATELOG t" +
|
|
" FROM ERMCP_CONTRACTOPERATELOG t" +
|
|
|
- " inner join tmp" +
|
|
|
|
|
- " on t.RELATEDID = tmp.RELATEDID" +
|
|
|
|
|
|
|
+ " inner join ermcp_spotcontract s" +
|
|
|
|
|
+ " on t.RELATEDID = s.spotcontractid" +
|
|
|
" and t.userid = %v" +
|
|
" and t.userid = %v" +
|
|
|
- " left join wrstandard w on t.wrstandardid=w.wrstandardid" +
|
|
|
|
|
- " WHERE 1 = 1"
|
|
|
|
|
- sqlId = utils.SQLVal(fmt.Sprintf(sqlId.String(), r.USERID, r.USERID, r.USERID))
|
|
|
|
|
|
|
+ " left join wrstandard w" +
|
|
|
|
|
+ " on t.wrstandardid = w.wrstandardid" +
|
|
|
|
|
+ " left join spotgoodsbrand gb" +
|
|
|
|
|
+ " on s.spotgoodsbrandid = gb.brandid" +
|
|
|
|
|
+ " left join spotgoodsmodel gm" +
|
|
|
|
|
+ " on s.spotgoodsmodelid = gm.modelid" +
|
|
|
|
|
+ " WHERE t.biztype = 2"
|
|
|
|
|
+ sqlId = utils.SQLVal(fmt.Sprintf(sqlId.String(), r.USERID))
|
|
|
// 筛选条件
|
|
// 筛选条件
|
|
|
sqlId.And("t.TRADEDATE", r.TRADEDATE)
|
|
sqlId.And("t.TRADEDATE", r.TRADEDATE)
|
|
|
if r.WRSTANDARDID > 0 {
|
|
if r.WRSTANDARDID > 0 {
|