早晨四点起来,开发个基于SpringBoot+微信小程序汽车服务系统。

困死我了。

送完孩子,然后去上班。

昨天有个读者朋友问小孟:程序员之间的差距为何如此之大。

有时候甚至在同一所大学,同一个专业,有的学生大四毕业可以拿到四五十w的年薪,有的学生毕业找不到工作。

甚至挂科、重修,延期一年毕业![流泪]

现实就是这样,差距大的让人惊叹!究竟是什么原因造成了这样??

我读本科的时候,大三时候我已经作为队长获得软件大赛一等奖,而有的同学才开始学习编程,研一下的时候,很多同学刚开始准备开题,而我已经接了很多的外包项目。

因为我一直在认清现状、反思、规划。

包括后来,有公司给我高薪、高职位,我依然认清现状。程序员这个行业很特殊。

一 视频演示界面图

基于SpringBoot+微信小程序汽车服务系统的设计与实现-LMLPHP
基于SpringBoot+微信小程序汽车服务系统的设计与实现-LMLPHP
基于SpringBoot+微信小程序汽车服务系统的设计与实现-LMLPHP
基于SpringBoot+微信小程序汽车服务系统的设计与实现-LMLPHP

基于SpringBoot+微信小程序汽车服务系统的设计与实现-LMLPHP
基于SpringBoot+微信小程序汽车服务系统的设计与实现-LMLPHP
基于SpringBoot+微信小程序汽车服务系统的设计与实现-LMLPHP

二 核心代码

/**
源码或者开发,都可以找小孟V:codingxm
*/
@RestController
public class AccountController {

    @Resource
    private UserInfoService userInfoService;

    @GetMapping("/logout")
    public Result logout(HttpServletRequest request) {
        request.getSession().setAttribute("user", null);
        return Result.success();
    }

    @GetMapping("/auth")
    public Result getAuth(HttpServletRequest request) {
        Object user = request.getSession().getAttribute("user");
        if(user == null) {
            return Result.error("401", "未登录");
        }
        return Result.success((UserInfo)user);
    }

    /**
     * 注册
     */
    @PostMapping("/register")
    public Result<UserInfo> register(@RequestBody UserInfo userInfo, HttpServletRequest request) {
        if (StrUtil.isBlank(userInfo.getName()) || StrUtil.isBlank(userInfo.getPassword())) {
            throw new CustomException(ResultCode.PARAM_ERROR);
        }
        UserInfo register = userInfoService.add(userInfo);
        HttpSession session = request.getSession();
        session.setAttribute("user", register);
        session.setMaxInactiveInterval(120 * 60);
        return Result.success(register);
    }

    /**
     * 登录
     */
    @PostMapping("/login")
    public Result<UserInfo> login(@RequestBody UserInfo userInfo, HttpServletRequest request) {
        if (StrUtil.isBlank(userInfo.getName()) || StrUtil.isBlank(userInfo.getPassword())) {
            throw new CustomException(ResultCode.USER_ACCOUNT_ERROR);
        }
        UserInfo login = userInfoService.login(userInfo.getName(), userInfo.getPassword());
        HttpSession session = request.getSession();
        session.setAttribute("user", login);
        session.setMaxInactiveInterval(120 * 60);
        return Result.success(login);
    }

    /**
     * 重置密码为123456
     */
    @PutMapping("/resetPassword")
    public Result<UserInfo> resetPassword(@RequestParam String username) {
        return Result.success(userInfoService.resetPassword(username));
    }

    @PutMapping("/updatePassword")
    public Result updatePassword(@RequestBody UserInfo info, HttpServletRequest request) {
        UserInfo account = (UserInfo) request.getSession().getAttribute("user");
        if (account == null) {
            return Result.error(ResultCode.USER_NOT_EXIST_ERROR.code, ResultCode.USER_NOT_EXIST_ERROR.msg);
        }
        String oldPassword = SecureUtil.md5(info.getPassword());
        if (!oldPassword.equals(account.getPassword())) {
            return Result.error(ResultCode.PARAM_PASSWORD_ERROR.code, ResultCode.PARAM_PASSWORD_ERROR.msg);
        }
        account.setPassword(SecureUtil.md5(info.getNewPassword()));
        userInfoService.update(account);

        // 清空session,让用户重新登录
        request.getSession().setAttribute("user", null);
        return Result.success();
    }

@RestController
@RequestMapping(value = "/addressInfo")
public class AddressInfoController {
    @Resource
    private AddressInfoService addressInfoService;

    @PostMapping
    public Result<AddressInfo> add(@RequestBody AddressInfo addressInfo, HttpServletRequest request) {
        addressInfoService.add(addressInfo);
        return Result.success(addressInfo);
    }

    @DeleteMapping("/{id}")
    public Result delete(@PathVariable Long id) {
        addressInfoService.delete(id);
        return Result.success();
    }

    @PutMapping
    public Result update(@RequestBody AddressInfo addressInfo) {
        addressInfoService.update(addressInfo);
        return Result.success();
    }

    @GetMapping("/{id}")
    public Result<AddressInfo> detail(@PathVariable Long id) {
        AddressInfo addressInfo = addressInfoService.findById(id);
        return Result.success(addressInfo);
    }

    @GetMapping
    public Result<List<AddressInfo>> all() {
        return Result.success(addressInfoService.findAll());
    }

    @GetMapping("/all/{userId}")
    public Result<List<AddressInfo>> all(@PathVariable Long userId) {
        return Result.success(addressInfoService.findAll(userId));
    }

    @GetMapping("/page/{name}")
    public Result<PageInfo<AddressInfo>> page(@RequestParam(defaultValue = "1") Integer pageNum,
                                              @RequestParam(defaultValue = "10") Integer pageSize,
                                              @PathVariable String name) {
        return Result.success(addressInfoService.findPage( name, pageSize, pageNum));
    }
@RestController
@RequestMapping(value = "/advertiserInfo")
public class AdvertiserInfoController {
    @Resource
    private AdvertiserInfoService advertiserInfoService;

    @PostMapping
    public Result<AdvertiserInfo> add(@RequestBody AdvertiserInfo advertiserInfo) {
        advertiserInfoService.add(advertiserInfo);
        return Result.success(advertiserInfo);
    }

    @DeleteMapping("/{id}")
    public Result delete(@PathVariable Long id) {
        advertiserInfoService.delete(id);
        return Result.success();
    }

    @PutMapping
    public Result update(@RequestBody AdvertiserInfo advertiserInfo) {
        advertiserInfoService.update(advertiserInfo);
        return Result.success();
    }

    @GetMapping("/{id}")
    public Result<AdvertiserInfo> detail(@PathVariable Long id) {
        AdvertiserInfo advertiserInfo = advertiserInfoService.findById(id);
        return Result.success(advertiserInfo);
    }

    @GetMapping
    public Result<List<AdvertiserInfo>> all() {
        return Result.success(advertiserInfoService.findAll());
    }

    @GetMapping("/page/{name}")
    public Result<PageInfo<AdvertiserInfo>> page(@PathVariable String name,
                                                   @RequestParam(defaultValue = "1") Integer pageNum,
                                                   @RequestParam(defaultValue = "5") Integer pageSize,
                                                   HttpServletRequest request) {
        return Result.success(advertiserInfoService.findPage(name, pageNum, pageSize, request));
    }
}

我是程序员小孟,如果觉得系统不错,欢迎点赞关注。非常感谢!

点击下面可以联系我。

11-30 08:56