2023.4.3学习日志

一,今天在用mybaties加springmvc改四阶段项目

1.controller大致代码

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/add")
    public ResultDTO add( UserVO userVO) {
        return userService.add(userVO);
    }

    @PutMapping("update")
    public ResultDTO update( UserVO userVO) {
        return userService.update(userVO);
    }

    @DeleteMapping("/delete")
    public ResultDTO delete( UserVO userVO) {
        return userService.delete(userVO);
    }

    @GetMapping("/findById")
    public ResultDTO findById(UserVO userVO) {
        return userService.delete(userVO);
    }

    @GetMapping("/findAll")
    public ResultDTO findAll(UserVO userVO) {
        return userService.findAll(userVO);
    }
}

2.dao层大致代码

@Override
public UserModel login(UserModel userModel) {
    return GetSqlSession.getSqlSession().selectOne(add + "login", userModel);
}

@Override
public int add(UserModel userModel) {
    return GetSqlSession.getSqlSession().insert(add + "add", userModel);
}

@Override
public int update(UserModel userModel) {
    return GetSqlSession.getSqlSession().insert(add + "update", userModel);
}

@Override
public int updatePassword(UserModel userModel) {
    return GetSqlSession.getSqlSession().update(add + "updatePassword", userModel);
}

@Override
public int delete(UserModel userModel) {
    return GetSqlSession.getSqlSession().delete(add + "delete", userModel);
}

@Override
public UserModel findById(UserModel userModel) {
    return GetSqlSession.getSqlSession().selectOne(add + "findById", userModel
    );
}

3.问题是今天没有配置bean的xml文件和扫描bean的配置文件,所以后台一直运行不起

你可能感兴趣的:(学习,java,开发语言)