抢晒镜修改

This commit is contained in:
quyixiao 2020-08-11 17:10:30 +08:00
parent 1e781e9bdf
commit 394371d19e
7 changed files with 151 additions and 101 deletions

View File

@ -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;

View File

@ -1,8 +1,8 @@
/**
* Copyright (c) 2020 fumeiai All rights reserved.
*
*
*
* <p>
* <p>
* <p>
* 版权所有侵权必究
*/
@ -20,112 +20,115 @@ import java.util.List;
* @author Mark sunlightcs@gmail.com
*/
public class PageUtils<E> 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 <E> PageUtils<E> doSelect(ISelect select) {
IPage page = new Page(this.currPage,this.pageSize);
list = select.doSelect(page);
page.setRecords(list);
return new PageUtils<E>(page);
}
public <E> PageUtils<E> doSelect(ISelect select) {
IPage page = new Page(this.currPage, this.pageSize);
list = select.doSelect(page);
page.setRecords(list);
return new PageUtils<E>(page);
}
/**
* 开始分页
*
* @param pageNum 页码
* @param pageSize 每页显示数量
* @param count 是否进行count查询
*/
public static <E> PageUtils<E> startPage(int pageNum, int pageSize) {
IPage<E> page = new Page<E>(pageNum, pageSize);
return new PageUtils<E>(page);
}
/**
* 开始分页
*
* @param pageNum 页码
* @param pageSize 每页显示数量
* @param count 是否进行count查询
*/
public static <E> PageUtils<E> startPage(int pageNum, int pageSize) {
IPage<E> page = new Page<E>(pageNum, pageSize);
return new PageUtils<E>(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;
}
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -1,40 +1,44 @@
package com.lz.modules.sys.dao.app;
/**
* <p>
* 业绩记录表 服务类
* </p>
*
* @author quyixiao
* @since 2020-08-10
*/
* <p>
* 业绩记录表 服务类
* </p>
*
* @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> {
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<ResultRecord> selectByCondition(@Param("page") IPage page, @Param("req") ResultRecordReq req);
List<ResultRecord> selectByConditionTest(ResultRecordReq req);
}

View File

@ -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;

View File

@ -103,6 +103,18 @@
</select>
<select id="selectByConditionTest" resultType="com.lz.modules.sys.entity.app.ResultRecord">
select * from lz_result_record where is_delete = 0
<if test="monthBeginDate != null and monthBeginDate != '' ">
AND DATE_FORMAT(month_time, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{monthBeginDate}, '%Y-%m-%d %H:%i:%S')
</if>
<if test="monthEndDate != null and monthEndDate != '' ">
AND DATE_FORMAT(month_time, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{monthEndDate}, '%Y-%m-%d %H:%i:%S')
</if>
order by id desc
</select>
</mapper>