Commit 9f689033 authored by Fuzy's avatar Fuzy

修正

parent 53c01f53
......@@ -57,7 +57,7 @@ public class WagesConversionController extends BaseController {
}
@RequestMapping("/recentFormulas")
public AjaxResult recentFormulas(){
return new AjaxResult(200, "成功", wagesConversionService.recentFormulas());
public AjaxResult recentFormulas(@RequestBody String mineId){
return new AjaxResult(200, "成功", wagesConversionService.recentFormulas(mineId));
}
}
......@@ -23,5 +23,5 @@ public interface WagesConversionMapper {
void deleteFromConversionToDate(@Param("date") String yearMonth);
List<WagesConversionDataVO> selectWagesValueAndDate();
List<WagesConversionDataVO> selectWagesValueAndDate(@Param("id") String mineId);
}
......@@ -19,5 +19,5 @@ public interface WagesConversionService {
WagesConversionData selectWagesConversionDataById(int id);
Object recentFormulas();
Object recentFormulas(String mineId);
}
......@@ -51,8 +51,8 @@ public class WagesConversionServiceImpl implements WagesConversionService {
}
@Override
public Object recentFormulas() {
List<WagesConversionDataVO> list = wagesConversionMapper.selectWagesValueAndDate();
public Object recentFormulas(String mineId) {
List<WagesConversionDataVO> list = wagesConversionMapper.selectWagesValueAndDate(mineId);
list.removeAll(Collections.singleton(null));
boolean b1 = list.parallelStream().anyMatch(v -> v.getYearMonth() == null || v.getYearMonth().indexOf("-") <= 0);
if (b1) return "数据库中数据存在日期错误";
......@@ -63,10 +63,11 @@ public class WagesConversionServiceImpl implements WagesConversionService {
} else {
return "数据库中没有数据";
}
if (collect != null) {
if (collect.size() != 0) {
collect = collect.parallelStream().sorted((a, b) -> Integer.parseInt(b.getYearMonth().split("-")[1]) - Integer.parseInt(a.getYearMonth().split("-")[1])).collect(Collectors.toList());
}
return collect.get(0).getValue();
}
return "数据库中数据错误";
}
}
......@@ -39,7 +39,7 @@
</select>
<select id="selectWagesValueAndDate" resultType="com.ruoyi.system.model.wages.vo.WagesConversionDataVO">
select wage_month as yearMonth, value as value
from wages_conversion_data;
from wages_conversion_data where mine_id = #{id};
</select>
<update id="update">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment