小修改,增加贫化表的分页和查询本月或上月。
This commit is contained in:
parent
01aa266251
commit
53e0f1b6c0
@ -1,6 +1,7 @@
|
||||
package com.jdc.jdcproject.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jdc.jdcproject.entity.DicekeMiningloss;
|
||||
import com.jdc.jdcproject.entity.DicekePlatearea;
|
||||
import com.jdc.jdcproject.entity.DicekeShovel;
|
||||
@ -34,18 +35,36 @@ public class DicekeMininglossController {
|
||||
private IDicekeMininglossService dicekeMininglossService;
|
||||
|
||||
@Operation(summary = "查询损失和贫化报表")
|
||||
@GetMapping("findAllMininggloss")
|
||||
@GetMapping("findAllMiningloss")
|
||||
public Result findAllLoss(){
|
||||
List<DicekeMininglossVo> dicekeMininglossVoList = dicekeMininglossService.findAllLoss();
|
||||
System.out.println(dicekeMininglossVoList.toString());
|
||||
return Result.successResult().data("dicekeMininglossVoList", dicekeMininglossVoList);
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询")
|
||||
@GetMapping("lossPageList")
|
||||
public Result lossPageList(@RequestParam(defaultValue = "1") int pageNum){
|
||||
return Result.successResult().data("Page",dicekeMininglossService.getPage(pageNum));
|
||||
}
|
||||
|
||||
@Operation(summary = "查当前或上一个月")
|
||||
@GetMapping("findMonth")
|
||||
public Result findMonth() {
|
||||
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
|
||||
List<DicekeMininglossVo> LossMonthList = dicekeMininglossService.getLossByMonth(currentDate);
|
||||
|
||||
System.out.println(LossMonthList.toString());
|
||||
return Result.successResult().data("LossMonthVoList", LossMonthList);
|
||||
|
||||
}
|
||||
|
||||
@Operation(summary = "通过Month查询损失和贫化报表")
|
||||
@GetMapping("findLossByMonth")
|
||||
public Result findLossByMonth(@RequestParam(required = false)
|
||||
@Parameter(description = "yyyy-MM-dd",example = "2002-10-11")LocalDate Month
|
||||
@Parameter(description = "yyyy-MM-dd",example = "2002-10-11")LocalDate LossMonth
|
||||
/*,@RequestParam(required = false) LocalDate endMonth*/) {
|
||||
|
||||
/*
|
||||
@ -55,8 +74,8 @@ public class DicekeMininglossController {
|
||||
return Result.successResult().data("LossMonthRangeList", LossByMonthRangeVoList);
|
||||
} else
|
||||
*/
|
||||
if (Month != null){ //Month存在 通过获取year年和month月查询此月报表
|
||||
List<DicekeMininglossVo> LossByMonthVoList = dicekeMininglossService.getLossByMonth(Month);
|
||||
if (LossMonth != null){ //Month存在 通过获取year年和month月查询此月报表
|
||||
List<DicekeMininglossVo> LossByMonthVoList = dicekeMininglossService.getLossByMonth(LossMonth);
|
||||
System.out.println(LossByMonthVoList.toString());
|
||||
return Result.successResult().data("LossMonthVoList", LossByMonthVoList);
|
||||
} else {
|
||||
@ -95,18 +114,17 @@ public class DicekeMininglossController {
|
||||
|
||||
@Operation(summary = "新增损失和贫化信息")
|
||||
@PostMapping("savedicekeMiningloss")
|
||||
public Result saveLoss(@RequestBody DicekeMininglossVo dicekeMininglossVo){
|
||||
public Result saveLoss(@RequestBody DicekeMiningloss dicekeMiningloss){
|
||||
|
||||
int savedml = dicekeMininglossService.savedml(dicekeMininglossVo);
|
||||
|
||||
if(savedml == 1) {
|
||||
return Result.errorResult().data("平盘不存在",savedml);
|
||||
} else if (savedml == 2) {
|
||||
return Result.errorResult().data("电铲不存在",savedml);
|
||||
} else {
|
||||
return Result.successResult();
|
||||
}
|
||||
boolean updateflag = dicekeMininglossService.save(dicekeMiningloss);
|
||||
if (updateflag){
|
||||
return Result.successResult();
|
||||
} else {
|
||||
return Result.errorResult();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.jdc.jdcproject.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jdc.jdcproject.entity.DicekeMiningloss;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jdc.jdcproject.entity.VO.DicekeMininglossVo;
|
||||
@ -31,5 +32,5 @@ public interface DicekeMininglossMapper extends BaseMapper<DicekeMiningloss> {
|
||||
List<DicekeMininglossVo> findLossByMonth(int monthV,int year);
|
||||
|
||||
|
||||
|
||||
Page<DicekeMininglossVo> selectLossPage(Page<DicekeMininglossVo> page);
|
||||
}
|
||||
|
@ -62,4 +62,23 @@
|
||||
LEFT JOIN diceke_shovel ds ON dml.ShovelID = ds.ShovelID
|
||||
WHERE YEAR(dml.Month) = #{year} AND MONTH(dml.Month) = #{monthV}
|
||||
</select>
|
||||
|
||||
<select id="selectLossPage" resultType="com.jdc.jdcproject.entity.VO.DicekeMininglossVo">
|
||||
select dml.LossID,
|
||||
dp.PlateRange,
|
||||
ds.ShovelCode,
|
||||
dml.DefineMineralReserves,
|
||||
dml.StrippingAndTotalMiningTon,
|
||||
dml.WasteRockTon,
|
||||
dml.DilutionRate,
|
||||
dml.LossMineralTon,
|
||||
dml.LossRate,
|
||||
dml.AllocationTon,
|
||||
dml.Month,
|
||||
dml.beizhu FROM diceke_miningloss dml
|
||||
LEFT JOIN diceke_platearea dp ON dml.PlateID = dp.PlateID
|
||||
LEFT JOIN diceke_shovel ds ON dml.ShovelID = ds.ShovelID
|
||||
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.jdc.jdcproject.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jdc.jdcproject.entity.DicekeMiningloss;
|
||||
import com.jdc.jdcproject.entity.VO.DicekeMininglossVo;
|
||||
import com.jdc.jdcproject.utils.Result;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
@ -20,7 +20,11 @@ public interface IDicekeMininglossService extends IService<DicekeMiningloss> {
|
||||
|
||||
List<DicekeMininglossVo> findAllLoss();
|
||||
|
||||
Page<DicekeMininglossVo> getPage(int pageNum);
|
||||
|
||||
/*
|
||||
int savedml(DicekeMininglossVo dicekeMininglossVo);
|
||||
*/
|
||||
|
||||
/*
|
||||
// 两个时间内查询
|
||||
@ -28,5 +32,7 @@ public interface IDicekeMininglossService extends IService<DicekeMiningloss> {
|
||||
|
||||
*/
|
||||
|
||||
List<DicekeMininglossVo> getLossByMonth(LocalDate Month);
|
||||
List<DicekeMininglossVo> getLossByMonth(LocalDate currentDate);
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.jdc.jdcproject.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jdc.jdcproject.entity.DicekeMiningloss;
|
||||
import com.jdc.jdcproject.entity.DicekePlatearea;
|
||||
import com.jdc.jdcproject.entity.DicekeShovel;
|
||||
@ -10,10 +11,6 @@ import com.jdc.jdcproject.mapper.DicekePlateareaMapper;
|
||||
import com.jdc.jdcproject.mapper.DicekeShovelMapper;
|
||||
import com.jdc.jdcproject.service.IDicekeMininglossService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jdc.jdcproject.service.IDicekePlateareaService;
|
||||
import com.jdc.jdcproject.service.IDicekeShovelService;
|
||||
import com.jdc.jdcproject.utils.Result;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -77,19 +74,37 @@ public class DicekeMininglossServiceImpl extends ServiceImpl<DicekeMininglossMap
|
||||
|
||||
|
||||
@Override
|
||||
public List<DicekeMininglossVo> getLossByMonth(LocalDate month) {
|
||||
int year = month.getYear();
|
||||
int monthV = month.getMonthValue();
|
||||
return baseMapper.findLossByMonth(monthV,year);
|
||||
public List<DicekeMininglossVo> getLossByMonth(LocalDate currentDate) {
|
||||
|
||||
int year = currentDate.getYear();
|
||||
int monthV = currentDate.getMonthValue();
|
||||
List<DicekeMininglossVo> lossMonthList = baseMapper.findLossByMonth(monthV, year);
|
||||
if (lossMonthList.isEmpty()) {
|
||||
LocalDate lastMonth;
|
||||
if (currentDate.getMonthValue() == 1) {
|
||||
lastMonth = LocalDate.of(currentDate.getYear() - 1, 12, 1);
|
||||
} else {
|
||||
lastMonth = LocalDate.of(currentDate.getYear(), currentDate.getMonthValue() - 1, 1);
|
||||
}
|
||||
return baseMapper.findLossByMonth(lastMonth.getMonthValue(),lastMonth.getYear());
|
||||
}
|
||||
return lossMonthList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DicekeMininglossVo> getPage(int pageNum) {
|
||||
Page<DicekeMininglossVo> page = new Page<>(pageNum, 30);
|
||||
return baseMapper.selectLossPage(page);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public int savedml(DicekeMininglossVo dicekeMininglossVo) {
|
||||
/*
|
||||
*//*
|
||||
QueryWrapper<DicekePlatearea> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("plateRange",dicekeMininglossVo.getPlateRange());
|
||||
DicekePlatearea dp = dicekePlateareaService.getOne(queryWrapper);
|
||||
*/
|
||||
*//*
|
||||
|
||||
//平盘和电铲查找是否单独一个工具类(如果使用次数多)
|
||||
DicekePlatearea dp = dicekePlateareaMapper.selectOne(
|
||||
@ -125,6 +140,7 @@ public class DicekeMininglossServiceImpl extends ServiceImpl<DicekeMininglossMap
|
||||
dicekeMininglossMapper.insert(dml);
|
||||
return 20000;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ public final class MD5 {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(MD5.encrypt("111111"));
|
||||
System.out.println(MD5.encrypt("123456789"));
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user