新火炬后端单体项目初始化代码
cuilei
2 天以前 c71714508fbe3ace3543423c7700d7bbcca90056
src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java
@@ -7,7 +7,6 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.User;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CacheConstant;
@@ -83,6 +82,8 @@
   SysRoleIndexMapper sysRoleIndexMapper;
   @Resource
   UserFactoryMapper userFactoryMapper;
//   @Resource
//   MdcUserProductionMapper mdcUserProductionMapper;
   @Resource
   private ISysDictService sysDictService;
@@ -587,9 +588,9 @@
      //step.4 保存所属产线
      if (oConvertUtils.isNotEmpty(selectedProductions)) {
         arr = selectedProductions.split(",");
         for (String factoryId : arr) {
            UserFactory userFactory = new UserFactory(user.getId(), factoryId);
            userFactoryMapper.insert(userFactory);
         for (String productionId : arr) {
            UserFactory mdcUserProduction = new UserFactory(productionId, user.getId());
            userFactoryMapper.insert(mdcUserProduction);
         }
      }
      //step.5 保存设备权限
@@ -659,11 +660,12 @@
      //先删后加
      userFactoryMapper.delete(new QueryWrapper<UserFactory>().lambda().eq(UserFactory::getUserId, user.getId()));
      if (oConvertUtils.isNotEmpty(productions)) {
         for (String factoryId : array) {
            UserFactory userFactory = new UserFactory(user.getId(), factoryId);
            userFactoryMapper.insert(userFactory);
         for (String productionId : array) {
            UserFactory mdcUserProduction = new UserFactory(productionId, user.getId());
            userFactoryMapper.insert(mdcUserProduction);
         }
      }
      //step.5 修改设备权限
      //先删后加
//      dncDevicePermissionMapper.delete(new QueryWrapper<DncDevicePermission>().lambda().eq(DncDevicePermission::getUserId, user.getId()));
@@ -830,4 +832,9 @@
   public IPage<SysUser> getUserByFactoryId(Page<SysUser> page, String factoryId, String username) {
      return userMapper.getUserByFactoryId(page,factoryId,username);
   }
   @Override
   public void editUser(SysUser sysUser) {
      userMapper.updateById(sysUser);
   }
}