refactor mysql dao