廖井涛
7 天以前 79b057e22e97e7db70faf25b33a5977b06771810
north-glass-erp/src/main/java/com/example/erp/service/userInfo/UserService.java
@@ -5,11 +5,13 @@
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.erp.controller.dto.UserDTO;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.entity.userInfo.Role;
import com.example.erp.entity.userInfo.User;
import com.example.erp.mapper.pp.ProductionSchedulingMapper;
import com.example.erp.mapper.userInfo.*;
import com.example.erp.tools.TokenTools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
@@ -27,6 +29,9 @@
   private final PermissionRoleMapper permissionRoleMapper;
    private final ProductionSchedulingMapper productionSchedulingMapper;
    @Autowired
    LogService logService;
    public UserService(UserMapper userMapper, RoleMapper roleMapper, PermissionRoleMapper permissionRoleMapper, UserRoleMapper userRoleMapper, ProductionSchedulingMapper productionSchedulingMapper) {
        this.userMapper = userMapper;
@@ -142,6 +147,13 @@
            userDTO.setToken(StpUtil.getTokenValue());
            Boolean userIsAdmin= userRoleMapper.getUserIsAdmin(user.getId());
            userDTO.setPermissions(permissionRoleMapper.getUserEditPermission(user.getId(),userIsAdmin));
            Log log = new Log();
            log.setOperator(user.getUserName());
            log.setOperatorId(userDTO.getUserId());
            log.setContent(userDTO.toString());
            log.setFunction("用户登录");
            logService.saveLog(log);
            return userDTO;
        }else{
            return null;
@@ -208,6 +220,12 @@
        return map;
    }
    public Object getUserLog() {
        Map<String, Object> map = new HashMap<>();
        map.put("data", userMapper.getUserLog());
        return map;
    }
//查询用户优化参数
public String getOptimizeParms(String username) {