zzy90 преди 2 месеца
родител
ревизия
034b9515e6

+ 9 - 1
src/main/java/org/ajnb/controller/RulesController.java

@@ -16,18 +16,26 @@ public class RulesController {
 
     @Autowired
     private RulesService rulesService;
+
     @RequestMapping("searchRules")
     @ResponseBody
     public List<RulesVO> queryRules(@RequestBody RulesVO rulesVO) {
         return rulesService.queryAllRules(rulesVO);
     }
+
     @RequestMapping("addRule")
     @ResponseBody
     public void addRule(@RequestBody RulesVO rulesVO) {
         rulesService.addRule(rulesVO);
     }
+
+    @RequestMapping("deleteRule")
+    @ResponseBody
+    public void deleteRule(@RequestBody RulesVO rulesVO) {
+        rulesService.deleteRuleById(rulesVO);
+    }
     @RequestMapping("RuleInfo")
-    public RulesVO RuleInfo(RulesVO rulesVO){
+    public RulesVO RuleInfo(RulesVO rulesVO) {
         return rulesService.queryRulesById(rulesVO);
     }
 }

+ 1 - 0
src/main/java/org/ajnb/mapper/RulesMapper.java

@@ -9,6 +9,7 @@ import java.util.List;
 @Mapper
 public interface RulesMapper {
     public void addRule(RulesVO rulesVO);
+    public void deleteRuleById(RulesVO rulesVO);
     public List<RulesVO> queryAllRules(RulesVO rulesVO);
     public RulesVO queryRulesById(RulesVO rulesVO);
 }

+ 1 - 0
src/main/java/org/ajnb/service/RulesService.java

@@ -6,6 +6,7 @@ import java.util.List;
 
 public interface RulesService {
     public void addRule(RulesVO rulesVO);
+    public void deleteRuleById(RulesVO rulesVO);
     public List<RulesVO> queryAllRules(RulesVO rulesVO);
     public RulesVO queryRulesById(RulesVO rulesVO);
 }

+ 5 - 0
src/main/java/org/ajnb/service/RulesServiceImpl.java

@@ -21,6 +21,11 @@ public class RulesServiceImpl implements RulesService{
     }
 
     @Override
+    public void deleteRuleById(RulesVO rulesVO) {
+        rulesMapper.deleteRuleById(rulesVO);
+    }
+
+    @Override
     public List<RulesVO> queryAllRules(RulesVO rulesVO) {
         return rulesMapper.queryAllRules(rulesVO);
     }

+ 3 - 0
src/main/resources/mapper/Rules.xml

@@ -15,6 +15,9 @@
         insert into Rules(id, name, rounds, duration_minutes, interval_minutes)
         values(#{id},#{name},#{rounds},#{duration_minutes},#{interval_minutes});
     </insert>
+    <delete id="deleteRuleById">
+        delete from Rules where id = #{id};
+    </delete>
     <select id="queryAllRules" resultMap="rm">
         select id, name, rounds, duration_minutes, interval_minutes
         from Rules