发表于: 2018-02-24 23:02:25
0 539
今日完成:
1. .trim()函数去掉字符序列前后空格
2. ctrl+alt+L自动设置缩进
3. 使用mybatis-generator自动生成,不产生example
4. spring框架,复习
5. 完成service,controller类,相当于复习
public interface BaseService {
List<Students> selectStudentsByEvaluate();
Integer countStudentsByStatus(Integer status);
List<Profession> selectProfessionByDirection(String direction);
Salary selectSalaryByPrimaryKey(Integer id);
}
@Service
public class SchoolService implements BaseService {
@Autowired
private StudentsMapper studentsMapper;
@Autowired
private ProfessionMapper professionMapper;
@Autowired
private SalaryMapper salaryMapper;
public List<Students> selectStudentsByEvaluate() {
List<Students> list = studentsMapper.selectByEvaluate();
return list;
}
public Integer countStudentsByStatus(Integer status) {
Integer num = studentsMapper.countByStatus(status);
return num;
}
public List<Profession> selectProfessionByDirection(String direction) {
List<Profession> list = professionMapper.selectByDirection(direction);
return list;
}
public Salary selectSalaryByPrimaryKey(Integer id) {
Salary salary = salaryMapper.selectByPrimaryKey(id);
return salary;
}
}
6. 将html页面转换为jsp页面
静态文件
<mvc:resources mapping="/css/**" location="/WEB-INF/statics/css/"/>
<mvc:resources mapping="/js/**" location="/WEB-INF/statics/js/"/>
<mvc:resources mapping="/image/**" location="/WEB-INF/statics/image/"/>
forEach循环在jsp页面显示优秀学员
<c:forEach items="${students}" var="s">
<li class="col-xs-12 col-sm-6 col-md-6 col-lg-3">
<div>
<img src="/image/${s.picture}">
<span>${s.profession}:${s.name}</span>
<p class="text-left">${s.job}:${s.workIntroduction}</p>
</div>
</li>
</c:forEach>
替换人数
<p>
<img src="/image/453254312.png">${count}<br>
<span class="up-3">累计在线学习人数</span>
</p>
<p>
<img src="/image/453254312.png">${graduated}<br>
<span class="up-3">学员已经找到满意工作</span>
</p>
效果
明日计划:
1. 完成任务四
遇到的问题:
1. 在spring中配置basePackage后是不是DAO已经成为一个bean存在于spring中了,不需要使用@Repository注解?
收获:
1. 将html页面转化为jsp页面从数据库中读取数据
2. springmvc中静态文件处理
3. 复习构造一个完整的springmvc框架
评论