Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pojo类中的List<E>字段,json格式应该是对象却输出数组 #27

Closed
buyili opened this issue Oct 31, 2020 · 1 comment
Closed

Comments

@buyili
Copy link
Contributor

buyili commented Oct 31, 2020

类HelloController

@RestController
@RequestMapping("/hello")
public class HelloController {

    /**
     * world
     * @return
     */
    @GetMapping("/world")
    public ResultVo<AppVersion> world(){
        AppVersion appVersion = new AppVersion();
        return ResultVoBuilder.success(appVersion);
    }

}

类ResultVo

@Data
public class ResultVo<E> {

    private int code;

    private String message;

    private E data;

    private List<E> list;

    private List<String> list2;


}

类AppVersion

@Data
public class AppVersion {

	/**
	 * 类型 1=android  2=ios
	 */
	private Integer appType;

	/**
	 * app类型  1=用户端 =2代理端
	 */
	private Integer bizType;


}

生成结果如下;字段list应该为数组,但生成的json为对象

{
  "code": 1,
  "message": "@string",
  "data": {
    "appType": 0,//	  类型 1=android  2=ios 	
    "bizType": 0//	  app类型  1=用户端 =2代理端 	
  },
  "list": {
    "appType": 0,//	  类型 1=android  2=ios 	
    "bizType": 0//	  app类型  1=用户端 =2代理端 	
  },
  "list2": [
    "@string"
  ]
}
@Forgus
Copy link
Owner

Forgus commented Feb 19, 2021

该问题已解决,建议更新插件到最新版(v2020.02.18)

@Forgus Forgus closed this as completed Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants