This commit is contained in:
likehai 2023-12-05 07:24:57 +08:00
parent 46e2bc23ae
commit 79c067b60a
5 changed files with 59 additions and 66 deletions

View File

@ -34,7 +34,7 @@ public interface MaintainUpkeepInfoMapper {
* @param maintainUpkeepInfo 维修保养记录
* @return 维修保养记录集合
*/
Map<String, Long> listCount(MaintainUpkeepInfo maintainUpkeepInfo);
List<Map<String, String>> listCount(MaintainUpkeepInfo maintainUpkeepInfo);
/**
* 查询维修保养次数列表
@ -42,7 +42,7 @@ public interface MaintainUpkeepInfoMapper {
* @param maintainUpkeepInfo 维修保养记录
* @return 维修保养记录集合
*/
Map<String, Long> listCountAll(MaintainUpkeepInfo maintainUpkeepInfo);
Map<String, String> listCountzongShu(MaintainUpkeepInfo maintainUpkeepInfo);
/**
* 新增维修保养记录

View File

@ -34,7 +34,7 @@ public interface IMaintainUpkeepInfoService {
* @param maintainUpkeepInfo 维修保养记录
* @return 维修保养记录集合
*/
Map<String, Long> listCount(MaintainUpkeepInfo maintainUpkeepInfo);
Map<String, String> listCount(MaintainUpkeepInfo maintainUpkeepInfo);
/**
* 新增维修保养记录

View File

@ -50,11 +50,23 @@ public class MaintainUpkeepInfoServiceImpl implements IMaintainUpkeepInfoService
* @param maintainUpkeepInfo 维修保养记录
* @return 维修保养记录集合
*/
public Map<String, Long> listCount(MaintainUpkeepInfo maintainUpkeepInfo) {
Map<String, Long> stringLongMap = maintainUpkeepInfoMapper.listCount(maintainUpkeepInfo);
Map<String, Long> stringLongMap1 = maintainUpkeepInfoMapper.listCountAll(maintainUpkeepInfo);
stringLongMap.put("0", stringLongMap1.get("0"));
return stringLongMap;
public Map<String, String> listCount(MaintainUpkeepInfo maintainUpkeepInfo) {
HashMap<String, String> resultMap = new HashMap<>();
//查询对应条件的总数
Map<String, String> zongShuMap = maintainUpkeepInfoMapper.listCountzongShu(maintainUpkeepInfo);
//查询对应条件的维修数量和保养数量
List<Map<String, String>> maps = maintainUpkeepInfoMapper.listCount(maintainUpkeepInfo);
resultMap.put("zongShu", zongShuMap.get("shuLiang"));
//遍历返回数量匹配对应数据
for (Map<String, String> map : maps) {
if (map.get("maintainUpkeepType").equals("1") ){
resultMap.put("weiXiu",map.get("reserve_one"));
}
if(map.get("maintainUpkeepType").equals("2")){
resultMap.put("baoYang",map.get("reserve_one"));
}
}
return resultMap;
}
/**

View File

@ -65,8 +65,8 @@
</where>
</select>
<select id="listCount" parameterType="com.god.maintenance.domain.MaintainUpkeepInfo" resultType="map">
select count(1) as shuLiang,
<select id="listCount" parameterType="com.god.maintenance.domain.MaintainUpkeepInfo" resultType="java.util.Map">
select count(1) as reserve_one,
case when maintain_upkeep_type = '1' then '1' ELSE '2' END AS maintainUpkeepType
from maintain_upkeep_info
<where>
@ -84,12 +84,11 @@
</if>
<if test="maintenanceInfo != null and maintenanceInfo != ''">and maintenance_info = #{maintenanceInfo}
</if>
<if test="reserveOne != null and reserveOne != ''">and reserve_one = #{reserveOne}</if>
</where>
GROUP BY maintain_upkeep_type
</select>
<select id="listCountAll" parameterType="com.god.maintenance.domain.MaintainUpkeepInfo" resultType="map">
<select id="listCountzongShu" parameterType="com.god.maintenance.domain.MaintainUpkeepInfo" resultType="map">
select count(1) as shuLiang,
"0" AS maintainUpkeepType
from maintain_upkeep_info

View File

@ -62,56 +62,31 @@
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- >新增-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['maintenance:maintainUpkeepInfo:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['maintenance:maintainUpkeepInfo:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['maintenance:maintainUpkeepInfo:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-row style="width: 45rem;">
<el-col :span="8" class="extra-col">维保总数{{ zongShu }}</el-col>
<el-col :span="8" class="extra-col">维修次数{{ weiXiu }}</el-col>
<el-col :span="8" class="extra-col">保养次数{{ baoYang }}</el-col>
<el-row>
<el-col :span="6" :offset="1" class="extra-col">
<el-row>
维保总数
</el-row>
<el-row class="extra-row1">
{{ zongShu }}
</el-row>
</el-col>
<el-col :span="6" :offset="2" class="extra-col">
<el-row>
维修次数
</el-row>
<el-row class="extra-row1">
{{ weiXiu }}
</el-row>
</el-col>
<el-col :span="6" :offset="2" class="extra-col">
<el-row>
保养次数
</el-row>
<el-row class="extra-row1">
{{ baoYang }}
</el-row>
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
<!-- 详情列表-->
@ -315,9 +290,11 @@ export default {
listDeviceManage(queryParamsA).then(response => {
this.deviceManageList = response.rows
})
// listCount(this.queryParams).then(res =>{
// console.log(res.data)
// })
listCount(this.queryParams).then(res => {
this.zongShu = res.data.zongShu
this.weiXiu = res.data.weiXiu || 0
this.baoYang = res.data.baoYang || 0
})
},
//
cancel() {
@ -421,7 +398,6 @@ export default {
},
//
selectDataPickerA(res) {
console.log(res)
this.queryParams.startTimeA = res[0]
this.queryParams.endTimeA = res[1]
}
@ -433,5 +409,11 @@ export default {
box-shadow: 2px 2px 3px #25252525, -2px -2px 2px #23232312;
padding: 10px;
border-radius: 4px;
height: 90px;
text-align: center;
}
.extra-row1 {
margin-top: 15px;
}
</style>