使用ajax提交的json数据,我们必须添加produces注解,如下所示。否则将会产生乱码
方法一:添加produces注解
@ApiOperation(value = "删除日志")
@RequiresPermissions("upms:log:delete")
@RequestMapping(value = "/delete/{ids}", method = RequestMethod.GET,produces = "text/html;charset=UTF-8")
@ResponseBody
public Object delete(@PathVariable("ids") String ids) {
int count = upmsLogService.deleteByPrimaryKeys(ids);
return new UpmsResult(UpmsResultConstant.SUCCESS, count);
}
方法二:在tcbds-common项目的springMVC-servlet.xml文件,添加<value>application/json;charset=UTF-8</value>
<!-- 返回ResponseBody响应类型 -->
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>