发表于: 2019-05-28 21:21:11
1 588
今天完成的事情:
1:部署项目到云服务器 测试各个接口
2:写了一个使用pagehepler插件 分页的功能
相应的到dao 接口以及cootroller层 还要配置文件
package demo.dao;
import demo.model.Scholastic;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author 学生全表Dao接口。
*/
@Repository
public interface ScholasticMapper {
/**
* <根据id查询>
*
* @param id
* @return
*/
Scholastic selectByPrimaryKey(Integer id);
/**
* <查询全表>
*
* @return
*/
List<Scholastic> findAll();
/**
* <根据id删除>
*
* @param id
* @return
*/
int deleteByPrimaryKey(Integer id);
/**
* <根据id更新>
* @param record
* @return
*/
int updateByPrimaryKeySelective(Scholastic record);
}
package demo.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import demo.model.Scholastic;
import demo.service.ScholasticService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.util.List;
@Controller
public class ScholasticController {
@Resource
private ScholasticService scholasticService;
/**
* <分页展示所有学上>
*
* @param mv
* @param page
* @param pageSize
* @return
*/
@RequestMapping(value = "/u/list", method = RequestMethod.GET)
public ModelAndView findAll(ModelAndView mv, @RequestParam(required = true, defaultValue = "1") Integer page, @RequestParam(required = false, defaultValue = "10") Integer pageSize, Integer toalPages) {
PageHelper.startPage(page, pageSize);
List<Scholastic> scholasticList = scholasticService.findAll();
PageInfo<Scholastic> p = new PageInfo<Scholastic>(scholasticList);
System.out.println(scholasticList);
mv.addObject("scholasticList", scholasticList);
mv.addObject("page", p);
mv.setViewName("studentPage");
return mv;
}
/**
* @author根据id删除数据。
*/
@RequestMapping(value = "/u/list/{id}", method = RequestMethod.DELETE)
public ModelAndView deleteByPrimaryKey(@PathVariable("id") int id) throws Exception {
scholasticService.deleteByPrimaryKey(id);
ModelAndView mav = new ModelAndView("redirect:/studentPage");
return mav;
}
}
3:学习了maven最短依赖
明天计划的事情:
1:任务七基本已经做完了 可以开始任务八了
遇到的问题:
1:到晚上准备打包的时候 项目前端页面出问题了 也没搞明白为什么 只是确定哪个位置有错误 还没搞明白
收获:
1:学会使用分页插件 进行页面的分页功能
2:知道以后出现依赖冲突 如何根据情况排除依赖以及使用maven依赖的原则
评论