1.完成的excel批量新增、按id删除、批量删除、按id查询、分页查询、按id新增、修改审核状态
(excel批量新增还未http请求测试) (批量新增、批量删除、修改审核状态已复用sy代码) 2、查询ip是否存在于白名单功能初步实现,仍不完善
This commit is contained in:
@@ -38,8 +38,15 @@ public class StaticRuleController {
|
||||
public ResponseResult delete(@PathVariable List<Integer> ids){
|
||||
log.info("根据id删除静态规则:{}",ids);
|
||||
//调用service删除
|
||||
staticRuleService.deleteStaticRule(ids);
|
||||
return ResponseResult.ok();
|
||||
// if(staticRuleService.deleteStaticRule(ids) == false){
|
||||
// return ResponseResult.error()
|
||||
// .setData("static_rule_id",ids)
|
||||
// .setData("success",false);
|
||||
// //有的删了,有的没删,也返回false
|
||||
// }
|
||||
return ResponseResult.ok()
|
||||
.setData("static_rule_id",ids)
|
||||
.setData("success",true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,22 +9,24 @@ import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface StaticRuleMapper {
|
||||
/**
|
||||
* 新建静态规则
|
||||
*/
|
||||
|
||||
//新建静态规则
|
||||
void newStaticRuleObject(@Param("object") StaticRuleObject object);
|
||||
|
||||
/**
|
||||
* 根据主键删除菜品数据
|
||||
*/
|
||||
//根据主键删除静态规则
|
||||
@Delete("delete from t_static_rule where static_rule_id = #{id}")
|
||||
void deleteStaticRule(Integer id);
|
||||
Boolean deleteStaticRule(Integer id);
|
||||
|
||||
//修改静态规则
|
||||
void updateStaticRule(StaticRuleObject object);
|
||||
|
||||
//按id查询静态规则
|
||||
//@Select("select * from t_static_rule where static_rule_id = #{id}")
|
||||
StaticRuleObject queryStaticRuleById(Integer id);
|
||||
|
||||
//多页查询静态规则
|
||||
List<StaticRuleObject> queryStaticRule(String static_rule_name, Integer static_rule_id,
|
||||
Integer page, Integer pageSize);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
package com.realtime.protection.server.rule.staticrule;
|
||||
|
||||
import com.realtime.protection.configuration.entity.rule.staticrule.StaticRuleObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class StaticRuleService {
|
||||
@Autowired
|
||||
private StaticRuleMapper staticRuleMapper;
|
||||
|
||||
private final StaticRuleMapper staticRuleMapper;
|
||||
|
||||
public StaticRuleService(StaticRuleMapper staticRuleMapper) {
|
||||
this.staticRuleMapper = staticRuleMapper;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -28,13 +32,16 @@ public class StaticRuleService {
|
||||
return object.getStaticRuleId();
|
||||
}
|
||||
|
||||
public void deleteStaticRule(List<Integer> ids) {
|
||||
@Transactional
|
||||
public Boolean deleteStaticRule(List<Integer> staticRuleIds) {
|
||||
//判断当前静态规则是否能够删除---是否存在任务选择的静态规则??
|
||||
|
||||
//删除静态规则
|
||||
for (Integer id : ids) {
|
||||
staticRuleMapper.deleteStaticRule(id);
|
||||
}
|
||||
// for (Integer id : staticRuleIds) {
|
||||
// staticRuleMapper.deleteStaticRule(id);
|
||||
// }
|
||||
return staticRuleIds.stream().allMatch(staticRuleMapper::deleteStaticRule);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +54,7 @@ public class StaticRuleService {
|
||||
}
|
||||
|
||||
public StaticRuleObject queryStaticRuleById(Integer id) {
|
||||
|
||||
return staticRuleMapper.queryStaticRuleById(id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user