42 lines
1.4 KiB
Go
42 lines
1.4 KiB
Go
package bidding
|
|
|
|
import (
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
|
"git.rosy.net.cn/jx-callback/business/model"
|
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
|
)
|
|
|
|
// 获取招标信息
|
|
func GetBiddingMsg(ctx *jxcontext.Context, param map[string]interface{}) (result []*model.BiddingInfo, err error) {
|
|
sql := `select * from cg a where 1=1`
|
|
|
|
sqlParam := make([]interface{}, 0)
|
|
if param["title"] != nil {
|
|
sql += " and a.title like ?"
|
|
sqlParam = append(sqlParam, "%"+utils.Interface2String(param["title"])+"%")
|
|
}
|
|
if param["city"] != nil {
|
|
sql += " and a.city like ?"
|
|
sqlParam = append(sqlParam, "%"+utils.Interface2String(param["city"])+"%")
|
|
}
|
|
if param["startTime"] != nil {
|
|
sql += " and a.cg_time > ?"
|
|
sqlParam = append(sqlParam, utils.Interface2String(param["startTime"]))
|
|
}
|
|
if param["endTime"] != nil {
|
|
sql += " and a.cg_time <= ?"
|
|
sqlParam = append(sqlParam, utils.Interface2String(param["endTime"]))
|
|
}
|
|
if param["pageSize"] != nil && param["pageNumber"] != nil {
|
|
sql += " ORDER BY a.cg_time desc limit ? offset ? "
|
|
sqlParam = append(sqlParam, param["pageSize"])
|
|
sqlParam = append(sqlParam, (utils.MustInterface2Int64(param["pageNumber"])-1)*utils.MustInterface2Int64(param["pageSize"]))
|
|
}
|
|
|
|
if err := dao.GetRows(dao.GetDB(), &result, sql, sqlParam...); err != nil {
|
|
return nil, err
|
|
}
|
|
return
|
|
}
|