Controller
@PostMapping(value = "/edit")
@ResponseBody
@PreAuthorize("hasAuthority('sys:contract:edit')")
@ApiOperation(value = "编辑合同信息", notes = "保存修改的合同信息")//描述
public Results<SysContract> updateContract(ContractDto contractDto) {
SysContract sysContract = null;
sysContract = contractService.getContract(contractDto.getName());
if (sysContract != null && !(sysContract.getId().equals(contractDto.getId()))) {
return Results.failure(ResponseCode.CONTRACT_REPEAT.getCode(), ResponseCode.CONTRACT_REPEAT.getMessage());
}
return contractService.updateContract(contractDto);
}
Service
@Override
public Results updateContract(ContractDto contractDto) {
contractDao.updateContract(contractDto);
log.info("service已经更新"+contractDto.getName());
return Results.success();
}
Dao
int updateContract(SysContract contract);
Dao对应的xml
<mapper namespace="com.sxbang.friday.dao.ContractDao">
<update id="updateContract" parameterType="com.sxbang.friday.model.SysContract">
update sys_contract t
<set>
<if test="name != null">
name = #{name},
</if>
<if test="startDate != null">
startDate = #{startDate},
</if>
<if test="expireDate != null">
expireDate = #{expireDate},
</if>
<if test="contractUrl != null">
contractUrl = #{contractUrl},
</if>
updateTime = #{updateTime}
</set>
where t.id = #{id}
</update>
</mapper>
service获取到的数据已经是修改过的了,为什么数据库还是没更新呢?我前两个用户和顾客资料的更新也是这样写的,几乎一样的为什么这个就更新不了呢?有没有大佬能解答一下...