<?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="kpiMapper">
	<select id="selectModule" parameterType="java.util.HashMap" resultType="CamelHashMap">
		SELECT
		       A.KPI_MODULE_ID,
		       A.KPI_MODULE_NAME,
		       A.KPI_MODULE_DESC,
		       A.KPI_MODULE_TYPE,
		       A.KPI_MODULE_PROGRAM,
		       A.CREATED_AT,
		       A.CREATED_BY,
		       A.UPDATED_AT,
		       A.UPDATED_BY
		FROM   DBO.EMBO_KPI_MODULE A

		WHERE  1 = 1
		<if test="@com.samsung.SdlComparator@isNotEmpty(kpiModuleId)">
		AND    A.KPI_MODULE_ID = #{kpiModuleId}
		</if>
	</select>

	<select id="selectKpi" parameterType="java.util.HashMap" resultType="CamelHashMap">
		SELECT KPI_ID,
		       KPI_TYPE_ID,
		       KPI_NAME,
		       KPI_DESC,
		       KPI_MODULE_ID

		FROM   DBO.EMBO_KPI
		WHERE  1 = 1
		<if test="@com.samsung.SdlComparator@isNotEmpty(kpiId)">
			AND    A.KPI_ID = #{kpiId}
		</if>
	</select>

	<select id="selectTarget" parameterType="java.util.HashMap" resultType="CamelHashMap">
		SELECT
			target_id,
			user_id,
			period_type,
			period,
			kpi_id,
			target_name,
			target_desc,
			target_type_id,
			target_text,
			target_number,
			weight
		FROM
			dbo.EMBO_TARGET
		where
			status = 'Y'
			and currentuse = 'Y'
		<if test="@com.samsung.SdlComparator@isNotEmpty(userId)">
			and user_id = #{userId}
		</if>

	</select>
</mapper>