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

View File

@ -34,7 +34,7 @@ public interface IMaintainUpkeepInfoService {
* @param maintainUpkeepInfo 维修保养记录 * @param maintainUpkeepInfo 维修保养记录
* @return 维修保养记录集合 * @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 维修保养记录 * @param maintainUpkeepInfo 维修保养记录
* @return 维修保养记录集合 * @return 维修保养记录集合
*/ */
public Map<String, Long> listCount(MaintainUpkeepInfo maintainUpkeepInfo) { public Map<String, String> listCount(MaintainUpkeepInfo maintainUpkeepInfo) {
Map<String, Long> stringLongMap = maintainUpkeepInfoMapper.listCount(maintainUpkeepInfo); HashMap<String, String> resultMap = new HashMap<>();
Map<String, Long> stringLongMap1 = maintainUpkeepInfoMapper.listCountAll(maintainUpkeepInfo); //查询对应条件的总数
stringLongMap.put("0", stringLongMap1.get("0")); Map<String, String> zongShuMap = maintainUpkeepInfoMapper.listCountzongShu(maintainUpkeepInfo);
return stringLongMap; //查询对应条件的维修数量和保养数量
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> </where>
</select> </select>
<select id="listCount" parameterType="com.god.maintenance.domain.MaintainUpkeepInfo" resultType="map"> <select id="listCount" parameterType="com.god.maintenance.domain.MaintainUpkeepInfo" resultType="java.util.Map">
select count(1) as shuLiang, select count(1) as reserve_one,
case when maintain_upkeep_type = '1' then '1' ELSE '2' END AS maintainUpkeepType case when maintain_upkeep_type = '1' then '1' ELSE '2' END AS maintainUpkeepType
from maintain_upkeep_info from maintain_upkeep_info
<where> <where>
@ -84,12 +84,11 @@
</if> </if>
<if test="maintenanceInfo != null and maintenanceInfo != ''">and maintenance_info = #{maintenanceInfo} <if test="maintenanceInfo != null and maintenanceInfo != ''">and maintenance_info = #{maintenanceInfo}
</if> </if>
<if test="reserveOne != null and reserveOne != ''">and reserve_one = #{reserveOne}</if>
</where> </where>
GROUP BY maintain_upkeep_type GROUP BY maintain_upkeep_type
</select> </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, select count(1) as shuLiang,
"0" AS maintainUpkeepType "0" AS maintainUpkeepType
from maintain_upkeep_info from maintain_upkeep_info

View File

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