src/main/java/com/lf/server/controller/data/StyleController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/lf/server/mapper/data/StyleMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/lf/server/service/data/StyleService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/data/StyleMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/lf/server/controller/data/StyleController.java
@@ -1,5 +1,6 @@ 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; @@ -18,6 +19,20 @@ public class StyleController { @Autowired StyleService styleService; @GetMapping({"/selectCount"}) public Integer selectCount(String name) { return styleService.selectCount(name); } @GetMapping(value = "/selectByPage") public List<StyleEntity> 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) { @@ -62,4 +77,4 @@ public List<StyleEntity> selectStyleAll() { return styleService.selectStyleAll(); } } } src/main/java/com/lf/server/mapper/data/StyleMapper.java
@@ -1,5 +1,6 @@ package com.lf.server.mapper.data; import com.lf.server.entity.data.DictEntity; import com.lf.server.entity.data.StyleEntity; import org.apache.ibatis.annotations.Mapper; import org.springframework.web.bind.annotation.ResponseBody; @@ -15,7 +16,26 @@ @ResponseBody public interface StyleMapper { /** * 根据表名查询记录数 * * @param name 样式名 * @return 记录数 */ public Integer selectCount(String name); /** * 根据表名分页查询 * * @param name 样式名 * @param limit 记录表 * @param offset 偏移量 * @return 列表 */ public List<StyleEntity> selectByPage(String name, Integer limit, Integer offset); /** * 添加数据 * * @param styleEntity * @return */ @@ -23,12 +43,15 @@ /** * 批量添加 * * @param styleEntity * @return */ public Integer insertStyles(List<StyleEntity> styleEntity); /** * 刪除数据 * * @param id * @return */ @@ -36,6 +59,7 @@ /** * 批量删除 * * @param ids * @return */ @@ -43,6 +67,7 @@ /** * 修改数据 * * @param styleEntity * @return */ @@ -50,6 +75,7 @@ /** * 查询单条数据 * * @param id * @return */ @@ -57,6 +83,7 @@ /** * 查询全部数据 * * @return */ public List<StyleEntity> selectStyleAll(); src/main/java/com/lf/server/service/data/StyleService.java
@@ -1,5 +1,6 @@ package com.lf.server.service.data; import com.lf.server.entity.data.DictEntity; import com.lf.server.entity.data.StyleEntity; import com.lf.server.mapper.data.StyleMapper; import org.springframework.beans.factory.annotation.Autowired; @@ -19,6 +20,24 @@ StyleMapper styleMapper; @Override public Integer selectCount(String name) { if (name != null && name.length() > 0) { name = "%" + name + "%"; } return styleMapper.selectCount(name); } @Override public List<StyleEntity> selectByPage(String name, Integer limit, Integer offset) { if (name != null && name.length() > 0) { name = "%" + name + "%"; } return styleMapper.selectByPage(name, limit, offset); } @Override public Integer insertStyle(StyleEntity styleEntity) { return styleMapper.insertStyle(styleEntity); } src/main/resources/mapper/data/StyleMapper.xml
@@ -16,7 +16,7 @@ select count(*) from lf.sys_style <where> <if test="name != null"> tab like #{tab} name like #{name} </if> </where> </select> @@ -26,10 +26,10 @@ select * from lf.sys_style <where> <if test="name != null"> tab like #{tab} name like #{name} </if> </where> order by ns,tab,order_num order by id limit #{limit} offset #{offset} </select>