@@ -4,6 +4,8 @@ import com.tuoheng.model.po.UserPo; | |||
import org.apache.ibatis.annotations.Mapper; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.List; | |||
/** | |||
* @author chenjiandong | |||
* @description: TODO | |||
@@ -22,4 +24,5 @@ public interface ClientUserMapper { | |||
UserPo selectByUserId(@Param("userId") Long userId); | |||
List<UserPo> selectByTenantId(@Param("tenantId") Long id); | |||
} |
@@ -292,6 +292,11 @@ public class ClientUserServiceImpl implements ClientUserSevice { | |||
@Override | |||
@Transactional(rollbackFor = Exception.class) | |||
public JsonResult deleteTenant(OidcTenantDto dto, LoginUser loginUser) { | |||
List<UserPo> list = clientUserMapper.selectByTenantId(dto.getId()); | |||
if (ObjectUtil.isNotEmpty(list)) { | |||
return JsonResult.error("该租户下含有关联用户,不能进行删除"); | |||
} | |||
TenantPo tenantPo = tenantMapper.selectById(dto.getId()); | |||
tenantPo.setEnabled(0); | |||
tenantMapper.updateById(tenantPo); |
@@ -29,6 +29,13 @@ | |||
WHERE id = #{userId} | |||
and enabled = 1 | |||
</select> | |||
<select id="selectByTenantId" resultType="com.tuoheng.model.po.UserPo"> | |||
SELECT * | |||
FROM users | |||
WHERE tenant_id = #{tenantId} | |||
# 用户没有被删除 | |||
and enabled = 1 | |||
</select> | |||
<update id="updatePass" parameterType="com.tuoheng.model.po.UserPo"> | |||
update users |