Commit b2055069 authored by Fuzy's avatar Fuzy

修正

parent f158b86d
......@@ -26,4 +26,9 @@ public class RuleController {
public AjaxResult query(@RequestParam("templateId") String ruleRequestModel){
return ruleService.query(ruleRequestModel);
}
@PostMapping("/rule/updateToId")
public AjaxResult updateToId(@RequestBody RuleRequestModel ruleRequestModel){
return ruleService.updateToId(ruleRequestModel);
}
}
......@@ -11,4 +11,6 @@ public interface RuleMapper {
void save(@Param("rule") RuleRequestModel ruleRequestModel, @Param("json") JSON json);
List<RuleModel> query(@Param("id") String ruleRequestModel);
void updateToId(@Param("rule") RuleRequestModel ruleRequestModel, @Param("json") JSON json);
}
......@@ -5,6 +5,8 @@ import java.util.List;
public class RuleRequestModel implements Serializable {
private String id;
private String templateId;
private String firstRule;
......@@ -13,6 +15,14 @@ public class RuleRequestModel implements Serializable {
private List<RuleModel> rules;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTemplateId() {
return templateId;
}
......
......@@ -7,4 +7,6 @@ public interface RuleService {
AjaxResult save(RuleRequestModel ruleRequestModel);
AjaxResult query(String ruleRequestModel);
AjaxResult updateToId(RuleRequestModel ruleRequestModel);
}
......@@ -31,4 +31,11 @@ public class RuleServiceImpl implements RuleService {
List<RuleModel> rules = ruleMapper.query(ruleRequestModel);
return new AjaxResult(200, "成功", rules);
}
@Override
public AjaxResult updateToId(RuleRequestModel ruleRequestModel) {
JSON json = (JSON) JSON.toJSON(ruleRequestModel.getRules());
ruleMapper.updateToId(ruleRequestModel, json);
return null;
}
}
......@@ -8,6 +8,23 @@
values
(#{rule.templateId}, #{json}, #{rule.firstRule}, #{rule.secondRule})
</insert>
<update id="updateToId">
update rule_sheet set
<if test="rule.templateId != null and rule.templateId != ''">
template_id = #{rule.templateId},
</if>
<if test="rule.firstRule != null and rule.firstRule != ''">
first_rule = #{rule.firstRule},
</if>
<if test="rule.secondRule != null and rule.secondRule != ''">
second_rule = #{rule.secondRule},
</if>
<if test="json != null and json != ''">
rules = #{json},
</if>
id = #{rule.id}
where id = #{rule.id};
</update>
<select id="query" resultType="com.ruoyi.system.model.rule.RuleModel">
select *
from rule_sheet
......
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