|
@@ -35,9 +35,9 @@ type CustomerProductRiskMapping struct {
|
|
|
UpdatedTime time.Time `description:"default:null;onUpdate:CURRENT_TIMESTAMP"`
|
|
|
}
|
|
|
|
|
|
-func GetMappingList() (list []*CustomerProductRiskMapping, err error) {
|
|
|
+func GetMappingList(sort string) (list []*CustomerProductRiskMapping, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- sql := "select id, customer_risk,product_risk,creator from customer_product_risk_mapping where is_deleted= ? ORDER BY CAST(substr(customer_risk, 2) AS UNSIGNED)"
|
|
|
+ sql := "select id, customer_risk,product_risk,creator,updated_time from customer_product_risk_mapping where is_deleted= ? ORDER BY updated_time " + sort
|
|
|
_, err = o.Raw(sql, false).QueryRows(&list)
|
|
|
return
|
|
|
}
|
|
@@ -60,6 +60,7 @@ func CheckCustomerRisk(customerRisk string) (exist bool, err error) {
|
|
|
}
|
|
|
func (cp *CustomerProductRiskMapping) Insert() (err error) {
|
|
|
cp.CreatedTime = time.Now()
|
|
|
+ cp.UpdatedTime = time.Now()
|
|
|
o := orm.NewOrm()
|
|
|
_, err = o.Insert(cp)
|
|
|
return
|