网页访问类中方法: 访问ShowController中 index方法
然后进入Service层执行uerService中的 findById()方法。
public class UserServiceImpl implements UserService {
@Autowired
private blogMapper blogMapper;
public blog findById(){
blog o = blogMapper.selectByPrimaryKey();
return o;
}
}
方法具体实现selectByPrimarykey();是在dao层
在dao层会生成sql语句
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from blogcontent
</select>
然后执行查询。
查询完成后执行model.addAttribute("blog",blogs);
将结果放在model中。然后return "user/indexs";
返回给前台界面。