java中controller,service,serviceImpl,mapper,xml等几个文件的作用理解,以简单的查询为例

一、controller、service、serviceImpl、Mapper、Xml等文件的作用
下图为java约定俗成的几个文件的作用


二、在项目中的使用情况,由于业务逻辑很简单,所以每个文件中的代码行数都很少

  • controller.java
    /**
     * 资产rim项目信息报表
     *
     */
    @RequestMapping(value = "/hls/cus/rpt/rim/project/detail/query")
    @ResponseBody
    public ResponseData rptRimProjecrDetailQuery(@RequestBody Map map) {
        return new ResponseData(hlsCusRptRimProjectDetailService.rptRimProjectDetailQuery(map));
    }
  • service.java
public interface HlsCusRptRimProjectDetailService extends IBaseService,ProxySelf {
 
    List rptRimProjectDetailQuery(Map map);
}
  • serviceImpl.java
    @Override
    public List rptRimProjectDetailQuery(Map map) {
      int page = Integer.parseInt(String.valueOf(map.get("page")));
      int pageSize = Integer.parseInt(String.valueOf(map.get("pageSize")));
      PageHelper.startPage(page,pageSize);
      return hlsCusRptRimProjectDetailMapper.rptRimProjectDetailQuery(map);
    }
  • mapper.java
public interface HlsCusRptRimProjectDetailMapper extends Mapper {
 
    List rptRimProjectDetailQuery( Map map);// 资产rim表项目信息报表
 
}
  • mapper.xml

原文:https://blog.csdn.net/congweijing/article/details/82499627

你可能感兴趣的:(java中controller,service,serviceImpl,mapper,xml等几个文件的作用理解,以简单的查询为例)