new staticrule
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.realtime.protection.server.rule.staticrule;
|
||||
|
||||
|
||||
import com.realtime.protection.configuration.entity.rule.staticrule.StaticRuleObject;
|
||||
import com.realtime.protection.configuration.response.ResponseResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/staticrule")
|
||||
public class StaticRuleController {
|
||||
|
||||
@Autowired
|
||||
private StaticRuleService staticRuleService;
|
||||
|
||||
/**
|
||||
* 新增静态规则
|
||||
*/
|
||||
@RequestMapping("/new")
|
||||
public ResponseResult newStaticRuleObject(@RequestBody StaticRuleObject object){
|
||||
// log.info("新增部门: {}" , dept);
|
||||
//调用service新增
|
||||
staticRuleService.newStaticRuleObject(object);
|
||||
return ResponseResult.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.realtime.protection.server.rule.staticrule;
|
||||
|
||||
import com.realtime.protection.configuration.entity.rule.staticrule.StaticRuleObject;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface StaticRuleMapper {
|
||||
Integer newStaticRuleObject(@Param("object") StaticRuleObject object);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
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 java.time.LocalDateTime;
|
||||
|
||||
@Service
|
||||
public class StaticRuleService {
|
||||
@Autowired
|
||||
private StaticRuleMapper staticRuleMapper;
|
||||
|
||||
|
||||
/*
|
||||
新建静态规则
|
||||
*/
|
||||
public Integer newStaticRuleObject(StaticRuleObject object) {
|
||||
|
||||
object.setStaticRuleCreateTime(LocalDateTime.now());
|
||||
object.setStaticRuleAuditStatus(0);
|
||||
/*
|
||||
待开发:设置静态规则对象的创建用户、用户所属部门等属性
|
||||
*/
|
||||
|
||||
staticRuleMapper.newStaticRuleObject(object);
|
||||
|
||||
return object.getStaticRuleId();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user