package com.bonus.canteen.core.allocation.canteen.dto;

import cn.hutool.json.JSONUtil;
import com.bonus.canteen.core.allocation.canteen.model.DzAllocCanteenAuth;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 食堂访问权限DTO
 *
 * @author shihao.li
 * @date 2024/8/22 16:21
 */
@Data
@NoArgsConstructor
public class DzCanteenAuthDTO {
    /**
     * 食堂id
     */
    private Long canteenId;
    /**
     * 所属组织
     */
    private List<Long> orgIdList;

    public DzCanteenAuthDTO(DzAllocCanteenAuth allocCanteenAuth) {
        this.canteenId = allocCanteenAuth.getCanteenId();
        this.orgIdList = JSONUtil.toList(allocCanteenAuth.getOrgIds(), Long.class);
    }
}
