|
@@ -8,9 +8,11 @@ import (
|
|
"eta/eta_mini_crm_ht/services"
|
|
"eta/eta_mini_crm_ht/services"
|
|
"eta/eta_mini_crm_ht/utils"
|
|
"eta/eta_mini_crm_ht/utils"
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "github.com/rdlucklib/rdluck_tools/paging"
|
|
"os"
|
|
"os"
|
|
"path"
|
|
"path"
|
|
"strconv"
|
|
"strconv"
|
|
|
|
+ "strings"
|
|
"time"
|
|
"time"
|
|
)
|
|
)
|
|
|
|
|
|
@@ -249,3 +251,86 @@ func (this *ImageController) DeleteImage() {
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
br.Success = true
|
|
br.Success = true
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// ImageList
|
|
|
|
+// @Title 研报列表
|
|
|
|
+// @Description pdf研报列表
|
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
|
+// @Param ClassifyIds query string true "二级分类id,可多选用英文,隔开"
|
|
|
|
+// @Param KeyWord query string true "报告标题/创建人"
|
|
|
|
+// @Param SortType query string true "排序方式"
|
|
|
|
+// @Success 200 {object} models.ReportAuthorResp
|
|
|
|
+// @router /imageList [get]
|
|
|
|
+func (this *ImageController) ImageList() {
|
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
|
+ defer func() {
|
|
|
|
+ this.Data["json"] = br
|
|
|
|
+ this.ServeJSON()
|
|
|
|
+ }()
|
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
|
+ permissionIds := this.GetString("PermissionIds")
|
|
|
|
+ sortType := this.GetString("SortType")
|
|
|
|
+ KeyWord := this.GetString("KeyWord")
|
|
|
|
+ var condition string
|
|
|
|
+ var pars []interface{}
|
|
|
|
+
|
|
|
|
+ if pageSize <= 0 {
|
|
|
|
+ pageSize = utils.PageSize20
|
|
|
|
+ }
|
|
|
|
+ if currentIndex <= 0 {
|
|
|
|
+ currentIndex = 1
|
|
|
|
+ }
|
|
|
|
+ if KeyWord != "" {
|
|
|
|
+ condition += " AND img_name like '%" + KeyWord + "%'"
|
|
|
|
+ }
|
|
|
|
+ var permissionPars []interface{}
|
|
|
|
+ if permissionIds != "" {
|
|
|
|
+ permissionArr := strings.Split(permissionIds, ",")
|
|
|
|
+ for _, permissionId := range permissionArr {
|
|
|
|
+ perId, _ := strconv.Atoi(permissionId)
|
|
|
|
+ permissionPars = append(permissionPars, perId)
|
|
|
|
+ }
|
|
|
|
+ condition += " AND permission_id in (" + utils.GetOrmReplaceHolder(len(permissionPars)) + ")"
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sortCondition := " ORDER BY created_time "
|
|
|
|
+ if sortType == "" {
|
|
|
|
+ sortType = "DESC"
|
|
|
|
+ }
|
|
|
|
+ sortCondition = sortCondition + sortType
|
|
|
|
+ total, err := models.GetImageCountByCondition(condition, pars)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取图片列表失败"
|
|
|
|
+ br.ErrMsg = "获取图片列表统计失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ startSize := utils.StartIndex(currentIndex, pageSize)
|
|
|
|
+ imageList, err := models.GetImageByCondition(condition, sortCondition, pars, startSize, pageSize)
|
|
|
|
+ var results []*models.ImageSourceView
|
|
|
|
+ for _, image := range imageList {
|
|
|
|
+ var view *models.ImageSourceView
|
|
|
|
+ view, err = image.ToView()
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取图片列表失败"
|
|
|
|
+ br.ErrMsg = "获取图片品种名称失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ results = append(results, view)
|
|
|
|
+ }
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取图片列表失败"
|
|
|
|
+ br.ErrMsg = "获取图片列表失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
|
+ resp := new(response.ImageSourceListResp)
|
|
|
|
+ resp.List = results
|
|
|
|
+ resp.Paging = page
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Data = resp
|
|
|
|
+ br.Msg = "获取成功"
|
|
|
|
+}
|