|
@@ -628,3 +628,62 @@ func (this *IndustrialSubjectController) CountDetail() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// @Title 通过行业获取关联标的列表
|
|
|
+// @Description 通过行业获取关联标的列表接口
|
|
|
+// @Param KeyWord query string false "搜索关键词"
|
|
|
+// @Param ChartPermissionId query int true "分类ID"
|
|
|
+// @Success Ret=200 {object} cygx.CygxIndustrialSubjectList
|
|
|
+// @router /industrialAndSubject/search [get]
|
|
|
+func (this *IndustrialSubjectController) IndustrialAndSubjectSearch() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ sysUser := this.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var condition string
|
|
|
+ keyWord := this.GetString("KeyWord")
|
|
|
+ chartPermissionId, _ := this.GetInt("ChartPermissionId")
|
|
|
+ if keyWord != "" {
|
|
|
+ condition = ` AND s.subject_name LIKE '%` + keyWord + `%' `
|
|
|
+ }
|
|
|
+ if chartPermissionId > 0 {
|
|
|
+ condition += ` AND m.chart_permission_id = ` + strconv.Itoa(chartPermissionId)
|
|
|
+ }
|
|
|
+ listSubject, err := cygx.GetIndustrialSubjectListNameByChartId(condition)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ condition = ` AND industry_name LIKE '%` + keyWord + `%' AND chart_permission_id = ` + strconv.Itoa(chartPermissionId)
|
|
|
+ listIndustrial, err := cygx.GetIndustrialManagement(condition)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ listResp := make([]*cygx.CygxIndustrialSubjectListRep, 0)
|
|
|
+ for _, v := range listIndustrial {
|
|
|
+ item := new(cygx.CygxIndustrialSubjectListRep)
|
|
|
+ item.IndustryName = v.IndustryName
|
|
|
+ item.IndustrialManagementId = v.IndustrialManagementId
|
|
|
+ listResp = append(listResp, item)
|
|
|
+ }
|
|
|
+ for _, v := range listSubject {
|
|
|
+ listResp = append(listResp, v)
|
|
|
+ }
|
|
|
+ resp := new(cygx.CygxIndustrialSubjectList)
|
|
|
+ resp.List = listResp
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|