Commit d95c13ea authored by 位宇华's avatar 位宇华

规则删除 --代码提交

parent 50cf3702
......@@ -28,4 +28,8 @@ public class RuleController {
public AjaxResult updateToId(@RequestBody RuleRequestModel ruleRequestModel){
return ruleService.updateToId(ruleRequestModel);
}
@PostMapping("/rule/delete")
public AjaxResult delete(@RequestBody RuleRequestModel ruleRequestModel){
return ruleService.deleteById(ruleRequestModel);
}
}
......@@ -15,4 +15,6 @@ public interface RuleMapper {
void updateToId(@Param("rule") RuleRequestModel ruleRequestModel, @Param("s") String s);
List<String> queryOfId(@Param("id") String ruleRequestModel);
void deleteById(@Param("id") String id);
}
......@@ -9,4 +9,6 @@ public interface RuleService {
AjaxResult query(String ruleRequestModel);
AjaxResult updateToId(RuleRequestModel ruleRequestModel);
AjaxResult deleteById(RuleRequestModel ruleRequestModel);
}
......@@ -48,6 +48,13 @@ public class RuleServiceImpl implements RuleService {
@Override
public AjaxResult updateToId(RuleRequestModel ruleRequestModel) {
ruleMapper.updateToId(ruleRequestModel, JSON.toJSONString(ruleRequestModel.getRules()));
return null;
return AjaxResult.success();
}
@Override
public AjaxResult deleteById(RuleRequestModel ruleRequestModel) {
String id=ruleRequestModel.getId();
ruleMapper.deleteById(id);
return AjaxResult.success();
}
}
......@@ -3,15 +3,13 @@
<mapper namespace="com.ruoyi.system.mapper.RuleMapper">
<insert id="save">
INSERT INTO
rule_sheet(template_id, rules, first_rule, second_rule, summary_identification, type)
values
(#{rule.templateId}, #{s}, #{rule.firstRule}, #{rule.secondRule}, #{rule.summary}, #{rule.type})
INSERT INTO rule_sheet(template_id, rules, first_rule, second_rule, summary_identification, type)
values (#{rule.templateId}, #{s}, #{rule.firstRule}, #{rule.secondRule}, #{rule.summary}, #{rule.type})
</insert>
<update id="updateToId">
update rule_sheet set
<if test="rule.templateId != null and rule.templateId != ''">
template_id = #{rule.templateId},
template_id = #{rule.templateId},
</if>
<if test="rule.firstRule != null and rule.firstRule != ''">
first_rule = #{rule.firstRule},
......@@ -28,11 +26,16 @@
<if test="rule.type != null and rule.type != ''">
type = #{rule.type},
</if>
id = #{rule.id}
id = #{rule.id}
where id = #{rule.id};
</update>
<select id="query" resultType="com.ruoyi.system.model.rule.RuleRequestModel">
select template_id as templateId, first_rule as firstRule, second_rule as secondRule, summary_identification as summary, type
select template_id as templateId,
first_rule as firstRule,
second_rule as secondRule,
summary_identification as summary,
type
from rule_sheet
where template_id = #{id}
</select>
......@@ -41,4 +44,9 @@
from rule_sheet
where template_id = #{id}
</select>
<delete id="deleteById">
delete
from rule_sheet
where id = #{id}
</delete>
</mapper>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment