All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.leazxl.cms.web.CmsCategoryWeb Maven / Gradle / Ivy

There is a newer version: 1.0.3
Show newest version
package com.leazxl.cms.web;

import com.leazxl.cms.model.CmsArticle;
import com.leazxl.cms.model.CmsCategory;
import com.leazxl.cms.service.CmsCategoryService;
import com.leazxl.core.dto.DataRet;
import com.leazxl.core.util.Assert;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("cms/category")
public class CmsCategoryWeb {

    @Autowired
    private CmsCategoryService categoryService;

    @GetMapping("list")
    public DataRet> getCateList(@RequestParam(defaultValue = "1") String siteId, @RequestParam(defaultValue = "1") String parentId) {
        List list = categoryService.getCateList(siteId, parentId);
        return new DataRet<>(list);
    }

    /**
     * 获取文章列表
     *
     * @param cmsArticle
     * @return
     */
    @PostMapping("save")
    public DataRet save(@RequestBody CmsCategory cmsArticle) {
        categoryService.save(cmsArticle);
        return new DataRet<>("保存成功");
    }

    /**
     * 删除链接信息
     *
     * @param id
     * @return
     */
    @PostMapping("delete")
    public DataRet articleDelete(String id) {
        Assert.notNull(id, "ID不能为空");
        categoryService.delete(id);
        return new DataRet<>("删除成功");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy