类与方法命名规范,注释,参数标准
类命名规范:
/** * 管理员dao层代码 * * @author wanlige * @date 2020-05-16 17:12:38 */ @Controller @RequestMapping("/admin") public class AdminController { // 自动注入 adminService @Resource private AdminService adminService; /** 处理登录请求 * @param admin * @param request * @param session * @return */ @RequestMapping("/login") public String login(Admin admin, HttpServletRequest request, HttpSession session) { Admin resultAdmin = adminService.login(admin); // 如果该登录的管理员用户名或密码错误返回错误信息 if (resultAdmin == null) { request.setAttribute("admin", admin); request.setAttribute("errorMsg", "Please check your username and password!"); return "login"; } else { // 登录成功, Session 保存该管理员的信息 session.setAttribute("currentAdmin", resultAdmin); session.setAttribute("username", resultAdmin.getUsername()); return "redirect:main"; } } }
接口以及方法规范:
@Mapper public interface BaseAnalysisDao extends BaseMapper { /** * 交易周期统计 * @param startDate * @param endDate * @param areaCode * @return */ List<ChartKeyValueEntity> getTradingCycle(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("areaCode") String areaCode); }