package cn.skcks.matrix.v2.services.orm;

import cn.skcks.matrix.v2.orm.mybatis.operation.OperateTableMapper;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@Order(0)
@RequiredArgsConstructor
public class OrmService {
    private final OperateTableMapper mapper;

    @PostConstruct
    public void init() {
        log.info("[orm] 自动建表");

        log.info("[orm] 创建 User 表");
        mapper.createUserTable();

        log.info("[orm] 创建 Role 表");
        mapper.createRoleTable();

        log.info("[orm] 创建 LocationRecord 表");
        mapper.createLocationRecordTable();
    }

}
