diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomNewLogApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomNewLogApi.java index 15908bc1..cd01fa97 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomNewLogApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomNewLogApi.java @@ -8,12 +8,12 @@ import com.nflg.product.bomnew.service.BomNewLogService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import nflg.product.common.vo.ResultVO; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.hibernate.validator.constraints.Length; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.Set; /** * t_bom_new_log 表控制层 @@ -27,6 +27,8 @@ import javax.annotation.Resource; @RequestMapping("bomNewLogEntity") public class BomNewLogApi extends BaseApi { + @Resource + private RedisTemplate redisTemplate; /** * 服务对象 */ @@ -44,7 +46,15 @@ public class BomNewLogApi extends BaseApi { public ResultVO> selectBomNewLogEntityPageByCondition(@RequestBody BomNewLogQuery query) { return ResultVO.success(bomNewLogService.getListByPage(query)); } - + + @GetMapping("delRedisKey") + public ResultVO delRedisKey(@RequestParam(name = "key") @Length(min = 4, message = "长度不能少于4个字符") String key){ + Set keys = redisTemplate.keys(key); + if(!keys.isEmpty()){ + return ResultVO.success(redisTemplate.delete(keys)); + } + return ResultVO.success(0l); + } }