Controller
-
Result
package com.yang.controller;
public class Result {
private Object data;
private Integer code;
private String msg;
public Result() {
}
public Result(Object data, Integer code) {
this.data = data;
this.code = code;
}
public Result(Object data, Integer code, String msg) {
this.data = data;
this.code = code;
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
-
Code
package com.yang.controller;
public class Code {
public static final Integer SAVE_OK = 20011;
public static final Integer UPDATE_OK = 20011;
public static final Integer DELETE_OK = 20011;
public static final Integer GET_OK = 20011;
public static final Integer SAVE_ERR = 20010;
public static final Integer UPDATE_ERR = 20010;
public static final Integer DELETE_ERR = 20010;
public static final Integer GET_ERR = 20010;
public static final Integer SYSTEM_UNKNOWN_ERROR = 50001;
public static final Integer SYSTEM_TIMEOUT_ERROR = 50002;
public static final Integer PROJECT_VALIDATE_ERROR = 60001;
public static final Integer PROJECT_BUSINESS_ERROR = 60002;
}
-
BookController
package com.yang.controller;
import com.yang.domain.Book;
import com.yang.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;