master
ck 5 years ago
parent fe74b9759a
commit a105c8634c

@ -1,6 +1,7 @@
package com.jingcheng.cms.controller;
import com.alibaba.fastjson.JSONObject;
import com.jingcheng.cms.model.PopularLabel;
import com.jingcheng.cms.service.PopularLabelService;
import com.jingcheng.cms.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
@ -8,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/api/popularLabel")
public class PopularLabelController {
@ -55,4 +58,21 @@ public class PopularLabelController {
ajaxResult= popularLabelService.delPopularLabel(id);
return ajaxResult;
}
/**
*
* @return
*/
@RequestMapping("/get-all-popular-label")
public AjaxResult getPopularLabelListByPage() {
AjaxResult ajaxResult = new AjaxResult();
List<PopularLabel> popularLabelList= popularLabelService.getAllPopularLabel();
if (popularLabelList.size() == 0){
ajaxResult.setRetmsg("无热门标签");
}else {
ajaxResult.setData(popularLabelList);
}
return ajaxResult;
}
}

@ -1,8 +1,11 @@
package com.jingcheng.cms.service;
import com.alibaba.fastjson.JSONObject;
import com.jingcheng.cms.model.PopularLabel;
import com.jingcheng.cms.util.AjaxResult;
import java.util.List;
public interface PopularLabelService {
/**
*
@ -19,4 +22,6 @@ public interface PopularLabelService {
AjaxResult savePopularLabel(JSONObject jsonObject);
AjaxResult delPopularLabel(Long id);
List<PopularLabel> getAllPopularLabel();
}

@ -90,5 +90,13 @@ public class PopularLabelServiceImpl implements PopularLabelService {
}
}
@Override
public List<PopularLabel> getAllPopularLabel() {
PopularLabel findPopularLabel = new PopularLabel();
findPopularLabel.setState(Constants.STATE_VALID);
List<PopularLabel> popularLabelList = popularLabelMapper.select(findPopularLabel);
return popularLabelList;
}
}

Loading…
Cancel
Save