<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="companyManagement">

  <!-- 회사 단건 조회 -->
  <select id="selectCompanyByCode" parameterType="map" resultType="map">
    SELECT COMPANY_CODE, COMPANY_NAME, STATUS
    FROM COMPANY_MNG
    WHERE (COMPANY_CODE = #{company_code} OR COMPANY_CODE = '*')
  </select>

  <!-- 회사 soft delete (status = 'deleted') -->
  <update id="softDeleteCompany" parameterType="map">
    UPDATE COMPANY_MNG
    SET STATUS = 'deleted'
    WHERE (COMPANY_CODE = #{company_code} OR COMPANY_CODE = '*')
  </update>

  <!-- 전체 회사 코드 목록 (disk usage 전체 조회용) -->
  <select id="selectAllCompanyCodes" parameterType="map" resultType="map">
    SELECT COMPANY_CODE
    FROM COMPANY_MNG
    WHERE STATUS != 'deleted'
    ORDER BY COMPANY_CODE ASC
  </select>

</mapper>
