資源簡介
框架已配好,拿來即用,含有mybatis使用代碼反轉java實體類及mybatis映射文件。
代碼片段和文件信息
package?com.lukuan.wei.controller;
import?java.util.List;
import?org.springframework.beans.factory.annotation.Autowired;
import?org.springframework.stereotype.Controller;
import?org.springframework.web.bind.annotation.RequestMapping;
import?org.springframework.web.bind.annotation.ResponseBody;
import?com.lukuan.wei.entity.DeptT;
import?com.lukuan.wei.service.DeptService;
import?com.lukuan.wei.utils.Msg;
@Controller
public?class?DeptController{
@Autowired
DeptService?deptService;
@RequestMapping(“/depts“)
@ResponseBody
public?Msg?getDepts()?{
Msg?msg?=?new?Msg();
try?{
List?list?=?deptService.getDepts();
msg?=?Msg.success().add(“list“?list);
return?msg;
}catch(Exception?e)?{
e.printStackTrace();
msg?=?Msg.fail();
return?msg;
}
}
}
評論
共有 條評論