|
|
@@ -26,7 +26,7 @@ func NewService(tenant string) Service {
|
|
|
}
|
|
|
|
|
|
// List 会议室列表
|
|
|
-func (s Service) List(req model.ListReq, user request.UserInfo) ([]accountModel.SettleAccountBill, int, error) {
|
|
|
+func (s Service) List(req model.ListReq, user request.UserInfo) ([]accountModel.BillInfo, int, error) {
|
|
|
entityModel := s.Dao.M
|
|
|
where := "1=1"
|
|
|
|
|
|
@@ -37,28 +37,28 @@ func (s Service) List(req model.ListReq, user request.UserInfo) ([]accountModel
|
|
|
return nil, 0, err
|
|
|
}
|
|
|
if entity.MainUserId != 0 {
|
|
|
- where += fmt.Sprintf(" AND MainUserId='%v'", entity.MainUserId)
|
|
|
+ where += fmt.Sprintf(" AND settle_account_bill.MainUserId='%v'", entity.MainUserId)
|
|
|
}
|
|
|
if entity.Status != "" {
|
|
|
- where += fmt.Sprintf(" AND Status='%v'", entity.Status)
|
|
|
+ where += fmt.Sprintf(" AND settle_account_bill.Status='%v'", entity.Status)
|
|
|
}
|
|
|
if entity.SettleDate != "" {
|
|
|
timelist := strings.Split(entity.SettleDate,",")
|
|
|
if len(timelist) == 2 {
|
|
|
- where += fmt.Sprintf(" AND SettleDate>='%v' AND SettleDate<='%v'", timelist[0],timelist[1])
|
|
|
+ where += fmt.Sprintf(" AND settle_account_bill.SettleDate>='%v' AND settle_account_bill.SettleDate<='%v'", timelist[0],timelist[1])
|
|
|
}
|
|
|
}
|
|
|
if entity.SettleUser != "" {
|
|
|
- where += fmt.Sprintf(" AND SettleUser LIKE '%%%v%%'", entity.SettleUser)
|
|
|
+ where += fmt.Sprintf(" AND settle_account_bill.SettleUser LIKE '%%%v%%'", entity.SettleUser)
|
|
|
}
|
|
|
if entity.MainUser != "" {
|
|
|
- where += fmt.Sprintf(" AND MainUser LIKE '%%%v%%'", entity.MainUser)
|
|
|
+ where += fmt.Sprintf(" AND settle_account_bill.MainUser LIKE '%%%v%%'", entity.MainUser)
|
|
|
}
|
|
|
if entity.StartDate != "" && entity.EndDate != "" {
|
|
|
- where += fmt.Sprintf(" AND StartDate>='%v' AND EndDate<='%v'", entity.StartDate, entity.EndDate)
|
|
|
+ where += fmt.Sprintf(" AND settle_account_bill.StartDate>='%v' AND settle_account_bill.EndDate<='%v'", entity.StartDate, entity.EndDate)
|
|
|
}
|
|
|
if entity.IsSelf != "1" { // 1 查看全部;其他 查看自己
|
|
|
- where += fmt.Sprintf(" AND MainUserId='%v'", user.Id)
|
|
|
+ where += fmt.Sprintf(" AND settle_account_bill.MainUserId='%v'", user.Id)
|
|
|
}
|
|
|
}
|
|
|
entityModel = entityModel.Where(where)
|
|
|
@@ -70,7 +70,7 @@ func (s Service) List(req model.ListReq, user request.UserInfo) ([]accountModel
|
|
|
return nil, 0, nil
|
|
|
}
|
|
|
|
|
|
- res, err := entityModel.Page(req.Current, req.Size).Order("settle_account_bill.Id DESC").Fields("settle_account_bill.*").FindAll()
|
|
|
+ res, err := entityModel.InnerJoin("settle_account_main", "settle_account_bill.Id=settle_account_main.BillId").Group("settle_account_bill.Id").Page(req.Current, req.Size).Order("settle_account_bill.Id DESC").Fields("settle_account_bill.*, SUM(settle_account_main.TotalPrice) TotalAmount").FindAll()
|
|
|
if err != nil {
|
|
|
return nil, 0, err
|
|
|
}
|
|
|
@@ -78,7 +78,7 @@ func (s Service) List(req model.ListReq, user request.UserInfo) ([]accountModel
|
|
|
return nil, 0, nil
|
|
|
}
|
|
|
|
|
|
- list := make([]accountModel.SettleAccountBill, 0)
|
|
|
+ list := make([]accountModel.BillInfo, 0)
|
|
|
err = res.Structs(&list)
|
|
|
if err != nil {
|
|
|
return nil, 0, err
|