Commit 4b920d4a by 钱炳权

更新数据正常

parent 442473de
...@@ -3,6 +3,7 @@ package com.example.fuzzControll.mapper; ...@@ -3,6 +3,7 @@ package com.example.fuzzControll.mapper;
import com.example.fuzzControll.domain.bo.FuzzParams; import com.example.fuzzControll.domain.bo.FuzzParams;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
...@@ -14,7 +15,7 @@ public interface FuzzParamsMapper { ...@@ -14,7 +15,7 @@ public interface FuzzParamsMapper {
List<FuzzParams> getFuzzParamsList(); List<FuzzParams> getFuzzParamsList();
FuzzParams getFuzzParamsById(int id); FuzzParams getFuzzParamsById(int id);
int editFuzzParams(FuzzParams fuzzParams); boolean editFuzzParams(@Param("id") int id,@Param("params") String params ,@Param("protocol") String protocol);
void insertFuzzParamsReturnId(FuzzParams fuzzParams); int insertFuzzParamsReturnId(FuzzParams fuzzParams);
} }
...@@ -12,5 +12,5 @@ public interface FuzzParamsService { ...@@ -12,5 +12,5 @@ public interface FuzzParamsService {
//todo 使用切面在运行时插入参数 //todo 使用切面在运行时插入参数
boolean saveFuzzParams(FuzzParams fuzzParams); boolean saveFuzzParams(FuzzParams fuzzParams);
int editFuzzParams(FuzzParams fuzzParams); boolean editFuzzParams(FuzzParams fuzzParams);
} }
...@@ -47,7 +47,7 @@ public class FuzzParamsServiceImpl implements FuzzParamsService { ...@@ -47,7 +47,7 @@ public class FuzzParamsServiceImpl implements FuzzParamsService {
} }
@Override @Override
public int editFuzzParams(FuzzParams fuzzParams) { public boolean editFuzzParams(FuzzParams fuzzParams) {
return fuzzParamsMapper.editFuzzParams(fuzzParams); return fuzzParamsMapper.editFuzzParams(fuzzParams.getId(),fuzzParams.getParams(),fuzzParams.getProtocol());
} }
} }
...@@ -76,8 +76,10 @@ public class TestMissionServiceImpl implements TestMissionService { ...@@ -76,8 +76,10 @@ public class TestMissionServiceImpl implements TestMissionService {
fuzzParamsId = fuzzParams.getId(); fuzzParamsId = fuzzParams.getId();
test.setFuzzParamsId(fuzzParamsId); test.setFuzzParamsId(fuzzParamsId);
} else {//有则更新数据 } else {//有则更新数据
FuzzParams fuzzParams = new FuzzParams(test.getId(),JSON.toJSONString(cmdStartParams), cmdStartParams.getProtopcol()); FuzzParams fuzzParams = new FuzzParams(test.getFuzzParamsId(),JSON.toJSONString(cmdStartParams), cmdStartParams.getProtopcol());
fuzzParamsMapper.editFuzzParams(fuzzParams); if(!fuzzParamsMapper.editFuzzParams(fuzzParams.getId(),fuzzParams.getParams(),fuzzParams.getProtocol())){
throw new RuntimeException("EditFuzzParams failed!");
}
} }
/*更新修改时间*/ /*更新修改时间*/
test.setUpdateTime(new Date()); test.setUpdateTime(new Date());
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</insert> </insert>
<update id="editFuzzParams" parameterType="com.example.fuzzControll.domain.bo.FuzzParams"> <update id="editFuzzParams" parameterType="com.example.fuzzControll.domain.bo.FuzzParams">
update fuzz_params update fuzz_params
set id = #{id} , params = #{params} ,protocol = #{protocol} set params = #{params} ,protocol = #{protocol}
where id = #{id} where id = #{id}
<!-- update fuzz_params--> <!-- update fuzz_params-->
<!-- <trim prefix="SET" suffixOverrides=",">--> <!-- <trim prefix="SET" suffixOverrides=",">-->
...@@ -42,5 +42,4 @@ ...@@ -42,5 +42,4 @@
<select id="getFuzzParamsList" resultMap="fuzzParams"> <select id="getFuzzParamsList" resultMap="fuzzParams">
<include refid="selectFuzzParams"/> <include refid="selectFuzzParams"/>
</select> </select>
</mapper> </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