feat:()添加存储故障Redis信息方法
parent
f166853e31
commit
11d1d68511
|
@ -1,11 +1,14 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.FaultInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 所有故障缓存服务
|
||||
*/
|
||||
public class AllFaultCacheService extends CacheAbsBacis {
|
||||
public class AllFaultCacheService extends CacheAbsBacis<String, List<FaultInfo>> {
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
import com.muyu.enterprise.service.FaultService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
|
||||
import com.muyu.domain.Fault;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 故障管理
|
||||
*/
|
||||
|
||||
@Log4j2
|
||||
@RestController
|
||||
@Tag(name = "故障管理列", description = "故障管理列")
|
||||
@RequestMapping("/fault")
|
||||
public class FaultController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private FaultService faultService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆故障管理列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@RequiresPermissions("fault:fault:list")
|
||||
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
||||
public Result<TableDataInfo<Fault>> list(Fault fault) {
|
||||
startPage();
|
||||
List<Fault> list = faultService.pageQuery(fault);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出车辆故障管理列表
|
||||
*/
|
||||
@Log(title = "车辆故障管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@RequiresPermissions("fault:fault:export")
|
||||
public void export(HttpServletResponse response, Fault fault) {
|
||||
List<Fault> list = faultService.pageQuery(fault);
|
||||
ExcelUtil<Fault> util = new ExcelUtil<Fault>(Fault.class);
|
||||
util.exportExcel(response, list, "车辆故障管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车辆故障管理详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result<String> getConfigKey (@PathVariable("id") String id) {
|
||||
return success(faultService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增车辆故障管理
|
||||
*/
|
||||
@Log(title = "车辆故障管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@RequiresPermissions("fault:fault:add")
|
||||
public Result add(@RequestBody Fault fault) {
|
||||
faultService.save(fault);
|
||||
return Result.success(null,"成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改车故障管理
|
||||
*/
|
||||
@Log(title = "车辆故障管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@RequiresPermissions("fault:fault:edit")
|
||||
public Result edit(@RequestBody Fault fault) {
|
||||
faultService.updateById(fault);
|
||||
return Result.success(null,"成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除车辆故障管理
|
||||
*/
|
||||
@Log(title = "车辆故障管理删除", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
@RequiresPermissions("fault:fault:remove")
|
||||
public Result remove(@PathVariable("id") Long[] id) {
|
||||
return Result.success(faultService.removeBatchByIds(Arrays.asList(id)), "成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import com.muyu.enterprise.cache.AllFaultCacheService;
|
||||
import com.muyu.enterprise.cache.FaultCacheService;
|
||||
import com.muyu.enterprise.service.FaultInfoService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
|
@ -22,12 +23,7 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:2112-car-cloud-server
|
||||
* @Package:com.muyu.fault.controller
|
||||
* @Filename:FaultController
|
||||
* @Description TODO
|
||||
* @Date:2024/9/17 11:08
|
||||
* 故障信息
|
||||
*/
|
||||
|
||||
@Log4j2
|
||||
|
@ -40,7 +36,7 @@ public class FaultInfoController extends BaseController {
|
|||
private FaultInfoService service;
|
||||
|
||||
@Autowired
|
||||
private FaultCacheService faultCacheService;
|
||||
private AllFaultCacheService allFaultCacheService;
|
||||
|
||||
/**
|
||||
* 查询车辆故障管理列表
|
||||
|
@ -51,6 +47,7 @@ public class FaultInfoController extends BaseController {
|
|||
public Result<TableDataInfo<FaultInfo>> list(FaultInfo faultInfo) {
|
||||
startPage();
|
||||
List<FaultInfo> list = service.pageQuery(faultInfo);
|
||||
allFaultCacheService.put(faultInfo.getFaultCode(),list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue