diff --git a/src/main/java/com/lz/common/utils/ISelect.java b/src/main/java/com/lz/common/utils/ISelect.java index bb2b7678..3d6ce69b 100644 --- a/src/main/java/com/lz/common/utils/ISelect.java +++ b/src/main/java/com/lz/common/utils/ISelect.java @@ -25,7 +25,9 @@ package com.lz.common.utils; + import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import java.util.List; diff --git a/src/main/java/com/lz/common/utils/PageUtils.java b/src/main/java/com/lz/common/utils/PageUtils.java index 8c4d5149..559de80a 100644 --- a/src/main/java/com/lz/common/utils/PageUtils.java +++ b/src/main/java/com/lz/common/utils/PageUtils.java @@ -1,8 +1,8 @@ /** * Copyright (c) 2020 fumeiai All rights reserved. - * - * - * + *

+ *

+ *

* 版权所有,侵权必究! */ @@ -20,112 +20,115 @@ import java.util.List; * @author Mark sunlightcs@gmail.com */ public class PageUtils implements Serializable { - private static final long serialVersionUID = 1L; - /** - * 总记录数 - */ - private int totalCount; - /** - * 每页记录数 - */ - private int pageSize; - /** - * 总页数 - */ - private int totalPage; - /** - * 当前页数 - */ - private int currPage; - /** - * 列表数据 - */ - private List list; + private static final long serialVersionUID = 1L; + /** + * 总记录数 + */ + private int totalCount; + /** + * 每页记录数 + */ + private int pageSize; + /** + * 总页数 + */ + private int totalPage; + /** + * 当前页数 + */ + private int currPage; + /** + * 列表数据 + */ + private List list; - /** - * 分页 - * @param list 列表数据 - * @param totalCount 总记录数 - * @param pageSize 每页记录数 - * @param currPage 当前页数 - */ - public PageUtils(List list, int totalCount, int pageSize, int currPage) { - this.list = list; - this.totalCount = totalCount; - this.pageSize = pageSize; - this.currPage = currPage; - this.totalPage = (int)Math.ceil((double)totalCount/pageSize); - } + /** + * 分页 + * @param list 列表数据 + * @param totalCount 总记录数 + * @param pageSize 每页记录数 + * @param currPage 当前页数 + */ + public PageUtils(List list, int totalCount, int pageSize, int currPage) { + this.list = list; + this.totalCount = totalCount; + this.pageSize = pageSize; + this.currPage = currPage; + this.totalPage = (int) Math.ceil((double) totalCount / pageSize); + } - public PageUtils doSelect(ISelect select) { - IPage page = new Page(this.currPage,this.pageSize); - list = select.doSelect(page); - page.setRecords(list); - return new PageUtils(page); - } + public PageUtils doSelect(ISelect select) { + IPage page = new Page(this.currPage, this.pageSize); + list = select.doSelect(page); + page.setRecords(list); + return new PageUtils(page); + } + + /** + * 开始分页 + * + * @param pageNum 页码 + * @param pageSize 每页显示数量 + * @param count 是否进行count查询 + */ + public static PageUtils startPage(int pageNum, int pageSize) { + IPage page = new Page(pageNum, pageSize); + return new PageUtils(page); + } - /** - * 开始分页 - * - * @param pageNum 页码 - * @param pageSize 每页显示数量 - * @param count 是否进行count查询 - */ - public static PageUtils startPage(int pageNum, int pageSize) { - IPage page = new Page(pageNum, pageSize); - return new PageUtils(page); - } /** * 分页 */ public PageUtils(IPage page) { this.list = page.getRecords(); - this.totalCount = (int)page.getTotal(); - this.pageSize = (int)page.getSize(); - this.currPage = (int)page.getCurrent(); - this.totalPage = (int)page.getPages(); + this.totalCount = (int) page.getTotal(); + this.pageSize = (int) page.getSize(); + this.currPage = (int) page.getCurrent(); + this.totalPage = (int) page.getPages(); } + + public int getTotalCount() { - return totalCount; - } + return totalCount; + } - public void setTotalCount(int totalCount) { - this.totalCount = totalCount; - } + public void setTotalCount(int totalCount) { + this.totalCount = totalCount; + } - public int getPageSize() { - return pageSize; - } + public int getPageSize() { + return pageSize; + } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public int getTotalPage() { - return totalPage; - } + public int getTotalPage() { + return totalPage; + } - public void setTotalPage(int totalPage) { - this.totalPage = totalPage; - } + public void setTotalPage(int totalPage) { + this.totalPage = totalPage; + } - public int getCurrPage() { - return currPage; - } + public int getCurrPage() { + return currPage; + } - public void setCurrPage(int currPage) { - this.currPage = currPage; - } + public void setCurrPage(int currPage) { + this.currPage = currPage; + } - public List getList() { - return list; - } + public List getList() { + return list; + } - public void setList(List list) { - this.list = list; - } + public void setList(List list) { + this.list = list; + } } diff --git a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java index b69abd0c..ce4cf869 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -1,6 +1,8 @@ package com.lz.modules.app.controller; +import java.math.BigDecimal; import java.util.Arrays; +import java.util.Date; import java.util.Map; import com.lz.common.utils.PageUtils; diff --git a/src/main/java/com/lz/modules/app/controller/TestController.java b/src/main/java/com/lz/modules/app/controller/TestController.java new file mode 100644 index 00000000..96845aaa --- /dev/null +++ b/src/main/java/com/lz/modules/app/controller/TestController.java @@ -0,0 +1,26 @@ +package com.lz.modules.app.controller; + +import com.lz.modules.sys.entity.app.ResultRecord; +import com.lz.modules.sys.service.app.ResultRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.math.BigDecimal; +import java.util.Date; + +@RestController +public class TestController { + + @Autowired + private ResultRecordService resultRecordService; + + @RequestMapping("/test") + public void test(){ + ResultRecord resultRecord = new ResultRecord(); + resultRecord.setAllScore(new BigDecimal(10)); + resultRecord.setLastScore(new BigDecimal(8)); + resultRecord.setMonthTime(new Date()); + resultRecordService.insertResultRecord(resultRecord); + } +} diff --git a/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java b/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java index 2af4b99d..78eb47a7 100644 --- a/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java +++ b/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java @@ -1,40 +1,44 @@ package com.lz.modules.sys.dao.app; /** -*

-* 业绩记录表 服务类 -*

-* -* @author quyixiao -* @since 2020-08-10 -*/ + *

+ * 业绩记录表 服务类 + *

+ * + * @author quyixiao + * @since 2020-08-10 + */ + import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.lz.modules.app.req.ResultRecordReq; import com.lz.modules.sys.entity.app.ResultRecord; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; -import java.util.Map; @Mapper public interface ResultRecordMapper extends BaseMapper { - ResultRecord selectResultRecordById(@Param("id") Long id); + ResultRecord selectResultRecordById(@Param("id") Long id); - Long insertResultRecord(ResultRecord resultRecord); + Long insertResultRecord(ResultRecord resultRecord); - int updateResultRecordById(ResultRecord resultRecord); + int updateResultRecordById(ResultRecord resultRecord); - int updateCoverResultRecordById(ResultRecord resultRecord); + int updateCoverResultRecordById(ResultRecord resultRecord); - int deleteResultRecordById(@Param("id") Long id); + int deleteResultRecordById(@Param("id") Long id); List selectByCondition(@Param("page") IPage page, @Param("req") ResultRecordReq req); + + + List selectByConditionTest(ResultRecordReq req); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java index 6e2df427..97ac9b82 100644 --- a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java +++ b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java @@ -1,6 +1,7 @@ package com.lz.modules.sys.service.app.impl; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.lz.common.utils.ISelect; import com.lz.common.utils.PageUtils; diff --git a/src/main/resources/mapper/app/ResultRecordMapper.xml b/src/main/resources/mapper/app/ResultRecordMapper.xml index fec333f0..1c4b140a 100644 --- a/src/main/resources/mapper/app/ResultRecordMapper.xml +++ b/src/main/resources/mapper/app/ResultRecordMapper.xml @@ -103,6 +103,18 @@ + +