5,017
社区成员
我们知道Controller层:接口层,是用户访问请求时对接的。
Controller层负责具体的业务模块流程的控制,在此层里面要调用Serice层的接口来控制业务流程,控制的配置也同样是在Spring的配置文件里面进行,针对具体的业务流程,会有不同的控制器,我们具体的设计过程中可以将流程进行抽象归纳,设计出可以重复利用的子单元流程模块,这样不仅使程序结构变得清晰,也大大减少了代码量。
原文链接:https://blog.csdn.net/Mr_wilson_liu/article/details/104172717
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("*****")
public class *****Controller {
@Resource
private I*****Dao *****dao;
@RequestMapping("findAll.do")
public Map findAll(*****DTO dto) {
Map map = new HashMap();
map.put("code", "0");
map.put("msg", "");
map.put("count", *****dao.getCount(dto));
map.put("data", *****dao.findAll(dto));
return map;
}
}