src/main/java/com/zgn/hospital/service/Impl/UserServiceImpl.java

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.zgn.hospital.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zgn.hospital.entity.bed;
import com.zgn.hospital.entity.doctor;
import com.zgn.hospital.entity.user;
import com.zgn.hospital.mapper.*;
import com.zgn.hospital.service.UserService;
import com.zgn.hospital.utils.MD5Util;
import com.zgn.hospital.utils.R;
import com.zgn.hospital.utils.UserConstants;
import com.zgn.hospital.vo.usernumvo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;

/**
 * @program: hostpital_info
 * @description:
 * @author: ZGN
 * @create: 2023-03-03 15:28
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Autowired
    DoctorMapper doctorMapper;
    @Autowired
    BedMapper bedMapper;
    @Autowired
    DeptMapper deptMapper;
    @Autowired
    NoticeMapper noticeMapper;
    /**
     * 注册用户
     *
     * @param user
     * @return
     */
    @Override
    public R register(user user) {
        QueryWrapper<user> userQueryWrapper=new QueryWrapper<>();
        userQueryWrapper.eq("username",user.getUsername());
        Integer counts = userMapper.selectCount(userQueryWrapper);
        if(counts>0){
            return R.fail("该用户已存在,请更改用户名!");
        }
        String pas=user.getPassword();
        pas= MD5Util.encode(pas+ UserConstants.USER_SLAT);
        user.setPassword(pas);
        Date time=new Date();
        user.setCreateTime(time);
        user.setUpdateTime(time);
后面还有 201 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。