controller层,返回给前端 list数组形式,如果单独返回对象,把list去掉就好
//定时
// private static final Logger log = LoggerFactory.getLogger(StationChargerRedisIni.class);
/**
* 定时更新数据
*/
@ApiOperation("仓库信息")
@GetMapping("/Redis")
// @Scheduled(cron = "0 */1 * * * ?")
public List<CabinetDto> Charger() throws InstantiationException, IllegalAccessException, IOException {
// log.info(".........定时开始.........");
List<CabinetDto> cabinetDtoList = geelyChargingOrderService.show();
System.out.println("CabinetDto:+++++++++++++++++++++" + cabinetDtoList);
// log.info(".........定时结束.........");
return cabinetDtoList;
}
serviceimpl层,我的类是嵌套
list1{a :1,list2{c:1,list3{e:1}}}
redisTemplate.opsForValue().get()里面可以直接写key
@Override
public List<CabinetDto> show() {
//new仓库表,查找仓库所在的字段
GeelyConfigItemParam geelyConfigItemParam = new GeelyConfigItemParam();
geelyConfigItemParam.setParamCode("CABINET_SN_LIST");
//查询仓库所在的位置