alter all code to service layer and dao layer