job
This commit is contained in:
19
business/model/dao/job.go
Normal file
19
business/model/dao/job.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetJobCategories(db *DaoDB, name string) (jobCategories []*model.JobCategory, err error) {
|
||||||
|
sql := `
|
||||||
|
SELECT * FROM job_category WHERE deleted_at = ?
|
||||||
|
`
|
||||||
|
sqlParams := []interface{}{utils.DefaultTimeValue}
|
||||||
|
if name != "" {
|
||||||
|
sql += ` AND name LIKE ?`
|
||||||
|
sqlParams = append(sqlParams, "%"+name+"%")
|
||||||
|
}
|
||||||
|
err = GetRows(db, &jobCategories, sql, sqlParams)
|
||||||
|
return jobCategories, err
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ type Job struct {
|
|||||||
|
|
||||||
func (v *Job) TableIndex() [][]string {
|
func (v *Job) TableIndex() [][]string {
|
||||||
return [][]string{
|
return [][]string{
|
||||||
[]string{"ThingID"},
|
[]string{"UserID"},
|
||||||
[]string{"CreatedAt"},
|
[]string{"CreatedAt"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -27,3 +28,17 @@ func (c *JobController) PublishJob() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 查看任务类型
|
||||||
|
// @Description 查看任务类型
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param name query string false "分类名"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /GetJobCategories [get]
|
||||||
|
func (c *JobController) GetJobCategories() {
|
||||||
|
c.callGetJobCategories(func(params *tJobGetJobCategoriesParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
retVal, err = dao.GetJobCategories(dao.GetDB(), params.Name)
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -151,6 +151,24 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetJobCategories",
|
||||||
|
Router: `/GetJobCategories`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "PublishJob",
|
||||||
|
Router: `/PublishJob`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "CreateOrder",
|
Method: "CreateOrder",
|
||||||
|
|||||||
Reference in New Issue
Block a user