package
com.shopping.rest.controller
import org
.springframework.beans.factory.annotation.Autowired
import org
.springframework.http.MediaType
import org
.springframework.http.converter.json.MappingJacksonValue
import org
.springframework.stereotype.Controller
import org
.springframework.web.bind.annotation.RequestMapping
import org
.springframework.web.bind.annotation.ResponseBody
import
com.shopping.common.utils.JsonUtils
import
com.shopping.rest.pojo.CatResult
import
com.shopping.rest.service.ItemCatService
@Controller
public class ItemCatController {
@Autowired
private ItemCatService itemCatService
@RequestMapping(value=
"/itemcat/list",
produces=MediaType
.APPLICATION_JSON_VALUE+
";charset=utf-8")
@ResponseBody
public String getItemCatList(String callback){
CatResult catResult = itemCatService
.getItemCatList()
String json = JsonUtils
.objectToJson(catResult)
String result = callback +
"("+ json +
")"
return result
}
}