|
@@ -4,12 +4,13 @@ import (
|
|
|
"eta/eta_api/models/data_manage"
|
|
|
"eta/eta_api/utils"
|
|
|
"fmt"
|
|
|
- "github.com/beego/beego/v2/client/orm"
|
|
|
- "github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"sort"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
|
+
|
|
|
+ "github.com/beego/beego/v2/client/orm"
|
|
|
+ "github.com/rdlucklib/rdluck_tools/paging"
|
|
|
)
|
|
|
|
|
|
type DataList struct {
|
|
@@ -150,6 +151,7 @@ type Edbinfo struct {
|
|
|
UserName string `description:"录入用户名称"`
|
|
|
NoticeTime string `description:"通知时间"`
|
|
|
Mobile string `description:"录入者手机号"`
|
|
|
+ Sort int `description:"排序"`
|
|
|
}
|
|
|
|
|
|
func GetEdbinfoListCount(condition string, pars []interface{}, mobile string, roleType int) (count int, err error) {
|
|
@@ -275,6 +277,14 @@ func AddEdbinfo(tradeCode, secName, unit, remark, frequency, noticeTime string,
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func AddEdbinfoV2(tradeCode, secName, unit, remark, frequency, noticeTime string, classifyId int, userId, sort int) (err error) {
|
|
|
+ sql := `INSERT INTO edbinfo(TRADE_CODE, SEC_NAME,UNIT, REMARK,frequency, classify_id,notice_time,user_id,create_date, sort)
|
|
|
+ VALUES(?,?,?,?,?,?,?,?,now(), ?) `
|
|
|
+ o := orm.NewOrmUsingDB("edb")
|
|
|
+ _, err = o.Raw(sql, tradeCode, secName, unit, remark, frequency, classifyId, noticeTime, userId, sort).Exec()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func AddEdbinfoUser(tradeCode, mobile string) (err error) {
|
|
|
o := orm.NewOrmUsingDB("edb")
|
|
|
sql := `INSERT INTO edbinfo_user(TRADE_CODE, mobile) VALUES (?,?)`
|
|
@@ -1243,6 +1253,57 @@ left join edbdata b on a.TRADE_CODE=b.TRADE_CODE `
|
|
|
|
|
|
}
|
|
|
|
|
|
+// GetTargetItemList 获取指标列表数据
|
|
|
+func GetTargetItemListSort(classifyId, edbShowType int, frequency, keyword, tradeCode string, classifyIdStrList []string) (items []*EdbInfoItem, err error) {
|
|
|
+ o := orm.NewOrmUsingDB("edb")
|
|
|
+
|
|
|
+ pars := make([]interface{}, 0)
|
|
|
+
|
|
|
+ sql := ` SELECT a.*,'' modify_date,'' STATUS FROM edbinfo AS a `
|
|
|
+ if edbShowType != 0 {
|
|
|
+ sql = ` SELECT a.*,b.DT,'' modify_date,'' STATUS FROM edbinfo AS a
|
|
|
+left join edbdata b on a.TRADE_CODE=b.TRADE_CODE `
|
|
|
+ }
|
|
|
+ sql += ` WHERE LEFT(a.TRADE_CODE,1)='W' AND a.REMARK='手动' AND a.classify_id>0 `
|
|
|
+
|
|
|
+ //如果没有分类id集合列表,那么就没有数据了,不用往下执行了,直接返回好了
|
|
|
+ if len(classifyIdStrList) <= 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(classifyIdStrList) > 0 {
|
|
|
+ sql += ` AND a.classify_id in (` + strings.Join(classifyIdStrList, ",") + `) `
|
|
|
+ }
|
|
|
+ if classifyId > 0 {
|
|
|
+ sql += ` AND a.classify_id=` + strconv.Itoa(classifyId) + ` `
|
|
|
+ }
|
|
|
+ //频度
|
|
|
+ if frequency != "" {
|
|
|
+ sql += ` AND a.frequency="` + frequency + `" `
|
|
|
+ }
|
|
|
+ //关键字
|
|
|
+ if keyword != "" {
|
|
|
+ sql += ` AND (a.SEC_NAME like ? or a.TRADE_CODE like ? )`
|
|
|
+ pars = utils.GetLikeKeywordPars(pars, keyword, 2)
|
|
|
+ }
|
|
|
+ //指定指标
|
|
|
+ if tradeCode != "" {
|
|
|
+ sql += ` AND a.TRADE_CODE = "` + tradeCode + `" `
|
|
|
+ }
|
|
|
+ //指标里面是否有数据
|
|
|
+ switch edbShowType {
|
|
|
+ case 1:
|
|
|
+ sql += ` AND b.CLOSE is not null `
|
|
|
+ case 2:
|
|
|
+ sql += ` AND b.CLOSE is null `
|
|
|
+ }
|
|
|
+ sql += ` GROUP BY a.TRADE_CODE `
|
|
|
+
|
|
|
+ sql = sql + ` ORDER BY sort ASC, CONVERT(a.SEC_NAME USING gbk ) COLLATE gbk_chinese_ci ASC `
|
|
|
+ _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
+ return
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
// GetLzItemList 模糊查询隆众数据库指标列表
|
|
|
func GetLzItemList(keyword string) (items []*data_manage.LongzhongSurveyProduct, err error) {
|
|
|
o := orm.NewOrmUsingDB("edb")
|