Commit 4b920d4a by 钱炳权

更新数据正常

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