src/main/java/com/yj/oa/project/service/dept/DeptServiceImpl.java

(开头部分) 3KB

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

package com.yj.oa.project.service.dept;

import com.yj.oa.common.constant.CsEnum;
import com.yj.oa.common.utils.StringUtils;
import com.yj.oa.project.mapper.DeptMapper;
import com.yj.oa.project.mapper.UserMapper;
import com.yj.oa.project.po.Dept;
import com.yj.oa.project.po.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author 永健
 */
@Service
@Transactional
public class DeptServiceImpl implements IDeptService{

    private Logger log = LoggerFactory.getLogger(DeptServiceImpl.class);
    @Autowired
    DeptMapper deptMapper;

    @Autowired
    UserMapper userMapper;

    /**
     * @描述 删除部门
     * @date 2018/9/16 13:12
     */

    @Override
    public int deleteByPrimaryKeys(String[] ids) throws Exception
    {
        User user = new User();
        for (String id : ids)
        {
            user.setDept(Integer.parseInt(id));
            List<User> users = userMapper.selectByUser(user);
            if (users.size() > 0)
            {
                throw new Exception("部门存在用户,不允许删除!");
            }
        }
        try
        {
            return deptMapper.deleteByPrimaryKeys(ids);
        }
        catch (Exception e)
        {
            log.error("$$$$$ 删除部门失败=[{}]", e);
            throw new RuntimeException("操作失败!");
        }
    }


后面还有 96 行代码,购买后查看完整代码

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

AI 解读 AI

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

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