123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package cygx
- import "github.com/beego/beego/v2/client/orm"
- type RaiServeTypeResp struct {
- ServeTypeId int `description:"服务类型id"`
- ServeTypeName string `description:"服务类型名称"`
- }
- type RaiServeTypeListResp struct {
- List []*RaiServeTypeResp
- }
- // 服务类型列表
- func GetRaiServeTypeRespList(condition string) (items []*RaiServeTypeResp, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := `SELECT * FROM cygx_rai_serve_type WHERE 1= 1 `
- if condition != "" {
- sql += condition
- }
- sql += ` ORDER BY sort DESC LIMIT 100 `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- type RaiServeTagResp struct {
- TagType int `description:"标签类型"`
- TagId int `description:"标签ID"`
- TagName string `description:"标签名称"`
- }
- type RaiServeTagListResp struct {
- List []*RaiServeTagResp
- }
- // 服务类型列表
- func GetRaiServeSearchTagRespList(keywords string) (items []*RaiServeTagResp, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := `SELECT
- 1 AS tag_type,
- i.industrial_management_id AS tag_id,
- i.industry_name AS tag_name,
- i.create_time
- FROM
- cygx_industrial_management AS i
- WHERE
- 1 = 1
- AND i.chart_permission_id IN ( 19, 20, 21, 22 )
- AND i.industry_name LIKE '%` + keywords + `%' UNION ALL
- SELECT
- 2 AS tag_type,
- s.industrial_subject_id AS tag_id,
- s.subject_name AS tag_name,
- s.create_time
- FROM
- cygx_industrial_subject AS s
- INNER JOIN cygx_industrial_management AS i ON i.industrial_management_id = s.industrial_management_id
- WHERE
- 1 = 1
- AND i.chart_permission_id IN ( 19, 20, 21, 22 )
- AND s.subject_name LIKE '%` + keywords + `%'
- ORDER BY
- create_time ASC `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
|