抢晒镜修改

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; package com.lz.common.utils;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List; import java.util.List;

View File

@ -1,8 +1,8 @@
/** /**
* Copyright (c) 2020 fumeiai All rights reserved. * Copyright (c) 2020 fumeiai All rights reserved.
* * <p>
* * <p>
* * <p>
* 版权所有侵权必究 * 版权所有侵权必究
*/ */
@ -20,112 +20,115 @@ import java.util.List;
* @author Mark sunlightcs@gmail.com * @author Mark sunlightcs@gmail.com
*/ */
public class PageUtils<E> implements Serializable { public class PageUtils<E> implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 总记录数 * 总记录数
*/ */
private int totalCount; private int totalCount;
/** /**
* 每页记录数 * 每页记录数
*/ */
private int pageSize; private int pageSize;
/** /**
* 总页数 * 总页数
*/ */
private int totalPage; private int totalPage;
/** /**
* 当前页数 * 当前页数
*/ */
private int currPage; private int currPage;
/** /**
* 列表数据 * 列表数据
*/ */
private List<?> list; private List<?> list;
/** /**
* 分页 * 分页
* @param list 列表数据 * @param list 列表数据
* @param totalCount 总记录数 * @param totalCount 总记录数
* @param pageSize 每页记录数 * @param pageSize 每页记录数
* @param currPage 当前页数 * @param currPage 当前页数
*/ */
public PageUtils(List<?> list, int totalCount, int pageSize, int currPage) { public PageUtils(List<?> list, int totalCount, int pageSize, int currPage) {
this.list = list; this.list = list;
this.totalCount = totalCount; this.totalCount = totalCount;
this.pageSize = pageSize; this.pageSize = pageSize;
this.currPage = currPage; this.currPage = currPage;
this.totalPage = (int)Math.ceil((double)totalCount/pageSize); this.totalPage = (int) Math.ceil((double) totalCount / pageSize);
} }
public <E> PageUtils<E> doSelect(ISelect select) { public <E> PageUtils<E> doSelect(ISelect select) {
IPage page = new Page(this.currPage,this.pageSize); IPage page = new Page(this.currPage, this.pageSize);
list = select.doSelect(page); list = select.doSelect(page);
page.setRecords(list); page.setRecords(list);
return new PageUtils<E>(page); 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) { public PageUtils(IPage<?> page) {
this.list = page.getRecords(); this.list = page.getRecords();
this.totalCount = (int)page.getTotal(); this.totalCount = (int) page.getTotal();
this.pageSize = (int)page.getSize(); this.pageSize = (int) page.getSize();
this.currPage = (int)page.getCurrent(); this.currPage = (int) page.getCurrent();
this.totalPage = (int)page.getPages(); this.totalPage = (int) page.getPages();
} }
public int getTotalCount() { public int getTotalCount() {
return totalCount; return totalCount;
} }
public void setTotalCount(int totalCount) { public void setTotalCount(int totalCount) {
this.totalCount = totalCount; this.totalCount = totalCount;
} }
public int getPageSize() { public int getPageSize() {
return pageSize; return pageSize;
} }
public void setPageSize(int pageSize) { public void setPageSize(int pageSize) {
this.pageSize = pageSize; this.pageSize = pageSize;
} }
public int getTotalPage() { public int getTotalPage() {
return totalPage; return totalPage;
} }
public void setTotalPage(int totalPage) { public void setTotalPage(int totalPage) {
this.totalPage = totalPage; this.totalPage = totalPage;
} }
public int getCurrPage() { public int getCurrPage() {
return currPage; return currPage;
} }
public void setCurrPage(int currPage) { public void setCurrPage(int currPage) {
this.currPage = currPage; this.currPage = currPage;
} }
public List<?> getList() { public List<?> getList() {
return list; return list;
} }
public void setList(List<?> list) { public void setList(List<?> list) {
this.list = list; this.list = list;
} }
} }

View File

@ -1,6 +1,8 @@
package com.lz.modules.app.controller; package com.lz.modules.app.controller;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.Map; import java.util.Map;
import com.lz.common.utils.PageUtils; 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; package com.lz.modules.sys.dao.app;
/** /**
* <p> * <p>
* 业绩记录表 服务类 * 业绩记录表 服务类
* </p> * </p>
* *
* @author quyixiao * @author quyixiao
* @since 2020-08-10 * @since 2020-08-10
*/ */
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.app.req.ResultRecordReq;
import com.lz.modules.sys.entity.app.ResultRecord; import com.lz.modules.sys.entity.app.ResultRecord;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface ResultRecordMapper extends BaseMapper<ResultRecord> { 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> 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; package com.lz.modules.sys.service.app.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.ISelect; import com.lz.common.utils.ISelect;
import com.lz.common.utils.PageUtils; import com.lz.common.utils.PageUtils;

View File

@ -103,6 +103,18 @@
</select> </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> </mapper>