|
@@ -268,7 +268,11 @@ WHERE
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-func GetSandboxListByCondition(condition string, pars []interface{}, startSize, pageSize int) (item []*Sandbox, err error) {
|
|
|
|
|
|
+type SandboxListItems struct {
|
|
|
|
+ Sandbox
|
|
|
|
+ ParentIds string
|
|
|
|
+}
|
|
|
|
+func GetSandboxListByCondition(condition string, pars []interface{}, startSize, pageSize int) (item []*SandboxListItems, err error) {
|
|
o := orm.NewOrmUsingDB("data")
|
|
o := orm.NewOrmUsingDB("data")
|
|
sql := ` SELECT * FROM sandbox WHERE 1=1 `
|
|
sql := ` SELECT * FROM sandbox WHERE 1=1 `
|
|
if condition != "" {
|
|
if condition != "" {
|
|
@@ -291,7 +295,7 @@ func GetSandboxListCountByCondition(condition string, pars []interface{}) (count
|
|
|
|
|
|
type SandboxListResp struct {
|
|
type SandboxListResp struct {
|
|
Paging *paging.PagingItem
|
|
Paging *paging.PagingItem
|
|
- List []*Sandbox
|
|
|
|
|
|
+ List []*SandboxListItems
|
|
}
|
|
}
|
|
|
|
|
|
func AddSandbox(item *Sandbox) (lastId int64, err error) {
|
|
func AddSandbox(item *Sandbox) (lastId int64, err error) {
|
|
@@ -306,4 +310,41 @@ func GetSandboxItemsByClassifyId(sandboxClassifyId int) (list []*SandboxClassify
|
|
FROM sandbox WHERE sandbox_classify_id = ? AND is_delete = 0 `
|
|
FROM sandbox WHERE sandbox_classify_id = ? AND is_delete = 0 `
|
|
_, err = o.Raw(sql,sandboxClassifyId).QueryRows(&list)
|
|
_, err = o.Raw(sql,sandboxClassifyId).QueryRows(&list)
|
|
return
|
|
return
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func GetSandboxAllParentByClassifyId(sandboxClassifyId int) (ids string, err error) {
|
|
|
|
+ o := orm.NewOrmUsingDB("data")
|
|
|
|
+ sql := `SELECT
|
|
|
|
+ GROUP_CONCAT(DISTINCT m.sandbox_classify_id ORDER BY m.level) AS ids
|
|
|
|
+FROM
|
|
|
|
+ (
|
|
|
|
+ SELECT
|
|
|
|
+ @id AS _id,(
|
|
|
|
+ SELECT
|
|
|
|
+ @id := parent_id
|
|
|
|
+ FROM
|
|
|
|
+ sandbox_classify
|
|
|
|
+ WHERE
|
|
|
|
+ sandbox_classify_id = _id
|
|
|
|
+ )
|
|
|
|
+ FROM
|
|
|
|
+ (
|
|
|
|
+ SELECT
|
|
|
|
+ @id :=(
|
|
|
|
+ SELECT
|
|
|
|
+ parent_id
|
|
|
|
+ FROM
|
|
|
|
+ sandbox_classify
|
|
|
|
+ WHERE
|
|
|
|
+ sandbox_classify_id = ?
|
|
|
|
+ )) vm,
|
|
|
|
+ sandbox_classify m
|
|
|
|
+ WHERE
|
|
|
|
+ @id IS NOT NULL
|
|
|
|
+ ) vm
|
|
|
|
+ INNER JOIN sandbox_classify m
|
|
|
|
+WHERE
|
|
|
|
+ sandbox_classify_id = vm._id `
|
|
|
|
+ err = o.Raw(sql,sandboxClassifyId).QueryRow(&ids)
|
|
|
|
+ return
|
|
}
|
|
}
|