1
This commit is contained in:
@@ -9,9 +9,10 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 获取招标信息
|
||||
// GetBiddingMsg 获取招标信息
|
||||
func GetBiddingMsg(ctx *jxcontext.Context, param map[string]interface{}) (result []*model.BiddingInfo, err error) {
|
||||
sql := `select * from cg a where 1=1`
|
||||
|
||||
@@ -129,3 +130,67 @@ func UpdateTiktokOrderPhoneAddress() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateSupermarketSign 保存超市签约数据
|
||||
func CreateSupermarketSign(supermarket []*model.SupermarketSign, lastOperator string) []string {
|
||||
db := dao.GetDB()
|
||||
errors := make([]string, 0, 0)
|
||||
for i := 0; i < len(supermarket); i++ {
|
||||
dao.WrapAddIDCULDEntity(supermarket[i], lastOperator)
|
||||
if err := dao.CreateEntity(db, supermarket[i]); err != nil {
|
||||
errors = append(errors, fmt.Sprintf("%s-%s:%v", supermarket[i].StoreName, supermarket[i].StoreID, err))
|
||||
}
|
||||
}
|
||||
|
||||
return errors
|
||||
}
|
||||
|
||||
func QuerySupermarketSign(storeId, storeName, cityName, storeType, signPeople string, start, end, page, size int) (result []*model.SupermarketSign, totalCount int, err error) {
|
||||
sql := `SELECT SQL_CALC_FOUND_ROWS * FROM supermarket_sign WHERE 1 = 1 `
|
||||
param := make([]interface{}, 0, 0)
|
||||
|
||||
if start != 0 {
|
||||
startTime := time.Unix(int64(start), 0)
|
||||
sql += ` AND sign_start_time >= ?`
|
||||
param = append(param, startTime)
|
||||
}
|
||||
if end != 0 {
|
||||
endTime := time.Unix(int64(end), 0)
|
||||
sql += ` AND sign_end_time < ?`
|
||||
param = append(param, endTime)
|
||||
}
|
||||
if storeId != "" {
|
||||
sql += ` AND store_id = ?`
|
||||
param = append(param, storeId)
|
||||
}
|
||||
if storeName != "" {
|
||||
sql += ` AND store_name like ?`
|
||||
param = append(param, "%"+storeName+"%")
|
||||
}
|
||||
if cityName != "" {
|
||||
sql += ` AND code_name like ?`
|
||||
param = append(param, "%"+cityName+"%")
|
||||
}
|
||||
if storeType != "" {
|
||||
sql += ` AND store_type = ?`
|
||||
param = append(param, storeType)
|
||||
}
|
||||
if signPeople != "" {
|
||||
sql += ` AND sign_people = ?`
|
||||
param = append(param, signPeople)
|
||||
}
|
||||
|
||||
sql += " limit ? offset ? "
|
||||
param = append(param, size)
|
||||
param = append(param, (utils.MustInterface2Int64(page)-1)*utils.MustInterface2Int64(size))
|
||||
|
||||
db := dao.GetDB()
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer dao.Commit(db, txDB)
|
||||
if err = dao.GetRowsTx(txDB, &result, sql, param...); err == nil {
|
||||
totalCount = dao.GetLastTotalRowCount2(db, txDB)
|
||||
return result, totalCount, nil
|
||||
}
|
||||
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user