<?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">
	 
	<!-- 해당 부분의 namespace는 project package + Mapper Package + Mapper Interface 이름입니다. -->
	<mapper namespace="com.elt.ems.mapper.ClientMapper">
	
		<!-- 해당 부분의 id는 MapperClass의 함수 이름과 유사하여야 합니다. -->
		<select id="selectList" parameterType="com.elt.ems.vo.ClientVo"  resultType="com.elt.ems.vo.ClientVo">
			select 
			  a.*, c.name as clientTypeName
			from t_client a, t_code c 
			where c.groupType='client_type' and a.clientType = c.code
			<if test="clientType != null and clientType != '-1' ">
			 <if test="clientType == '-80' ">and a.clientType &gt;= '20' and a.clientType &lt;= '80'</if>
			 <if test="clientType != '-80' and clientType != '' ">and a.clientType = #{clientType}</if>
			</if>
      		order by name asc      
		</select>
		
    <select id="select" parameterType="int"  resultType="com.elt.ems.vo.ClientVo">
      select 
        a.*
      from t_client a
      where a.seq = #{seq}       
    </select>		    
    
    <update id="update"  parameterType="com.elt.ems.vo.ClientVo">
      update t_client set 
        name=#{name}, clientType=#{clientType}, memo=#{memo},
        phone1=#{phone1}, phone2=#{phone2}, managerName=#{managerName}, updateDatetime=now()
      where seq=#{seq}
    </update>     
		
	</mapper>