forked from kidgrow-microservices-platform

zhaoxiaohao
2020-06-24 6ff7f64dc78dd5af4c180fe13a24aeef7581a6ab
kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysDoctorServiceImpl.java
@@ -144,7 +144,7 @@
    }
    @Override
    @Transactional
    @Transactional(rollbackFor = Exception.class)
    public boolean saveOrUpdateSer(SysDoctorDto sysDoctor, HttpServletRequest request,SysUser user) {
        String id = request.getHeader(SecurityConstants.USER_ID_HEADER);
        if(null==sysDoctor){
@@ -239,19 +239,23 @@
    }
    @Override
    @Transactional
    @Transactional(rollbackFor = Exception.class)
    public ResultBody setAdminDoctor(Map<String, Object> params) {
        Long id = MapUtils.getLong(params, "id");
        Long adminId = MapUtils.getLong(params, "adminId");
        if (id>0&&adminId>0) {
            Map<String,Object> map= new HashMap<>();
            map.put("id",adminId);
            SysDoctor sysDoctor=baseMapper.selectById(adminId);
            map.put("user_id",adminId);
            List<SysDoctor> sysDoctors = baseMapper.selectByMap(map);
            if(sysDoctors==null||sysDoctors.size()<=0){
                return ResultBody.failed("当前操作用户不是管理员");
            }
            SysDoctor sysDoctor = sysDoctors.get(0);
            //先检查操作用户是否管理员
            if(sysDoctor!=null){
                if (sysDoctor.getIsAdminUser()) {
                    //现将操作人员设为非管理
                    sysDoctor=new SysDoctor();
//                    sysDoctor=new SysDoctor();
                    sysDoctor.setIsAdminUser(false);
                    if(baseMapper.updateById(sysDoctor)>0)
                    {
@@ -259,7 +263,7 @@
                        sysDoctor=baseMapper.selectById(id);
                        if (sysDoctor != null) {
                            if (!sysDoctor.getIsAdminUser()) {
                                sysDoctor=new SysDoctor();
//                                sysDoctor=new SysDoctor();
                                sysDoctor.setIsAdminUser(true);
                                if (baseMapper.updateById(sysDoctor)>0) {
                                    return ResultBody.ok().data(true).msg("管理员设置成功!");