package com.lf.server.controller.data; import com.lf.server.entity.data.DictEntity; import com.lf.server.entity.data.StyleEntity; import com.lf.server.service.data.StyleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 样式管理 * @author sws * @date 2022-09.26 */ @RestController @RequestMapping("/Style") public class StyleController { @Autowired StyleService styleService; @GetMapping({"/selectCount"}) public Integer selectCount(String name) { return styleService.selectCount(name); } @GetMapping(value = "/selectByPage") public List selectByPage(String name, Integer pageSize, Integer pageIndex) { if (pageSize < 1 || pageIndex < 0) { return null; } return styleService.selectByPage(name, pageSize, pageSize * pageIndex); } @RequestMapping(value = "/insertStyle", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") public Integer insertStyle(StyleEntity styleEntity) { return styleService.insertStyle(styleEntity); } @RequestMapping(value = "/insertStyles", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") public Integer insertStyles(@RequestBody List styleEntity) { return styleService.insertStyles(styleEntity); } @ResponseBody @RequestMapping(value = "/deleteStyle", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") public Integer deleteStyle(int id) { return styleService.deleteStyle(id); } @RequestMapping(value = "/deleteStyles", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") public Integer deleteStyles(@RequestBody List ids) { if (!ids.isEmpty()) { return styleService.deleteStyles(ids); } else { return -1; } } @ResponseBody @RequestMapping(value = "/updateStyle", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") public Integer updateStyle(StyleEntity styleEntity) { return styleService.updateStyle(styleEntity); } @GetMapping(value = "/selectStyle") public StyleEntity selectStyle(int id) { return styleService.selectStyle(id); } @GetMapping(value = "/selectStyleAll") public List selectStyleAll() { return styleService.selectStyleAll(); } }