<?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="WebMember">
	
	<select id="selectMemberId" parameterType="String" resultType="String">
		SELECT MU_MEMBER_ID as muMemberId
		  FROM MU_MEMBER AS MM
 		 WHERE MM.USE_YN        = 'Y'
		   AND MM.LOGIN_ID  = #{loginId}
		limit 0,1
	</select>

	<select id="checkMember" parameterType="hashMap" resultType="hashMap">
		SELECT MM.MU_MEMBER_ID                AS "muMemberId"
			  ,MM.LOGIN_ID                    AS "loginId"
			  ,MM.NAME                        AS "memberName"
			  ,MM.PHONE_NUMBER                AS "phoneNumber"
			  ,MM.EMAIL                       AS "email"
			  ,MM.MU_AUTH_ID                  AS "muAuthId"
		  FROM MU_MEMBER AS MM
 		 WHERE MM.USE_YN        = 'Y'
 		   AND MM.STATUS        = 'Y'
		   AND MM.MU_MEMBER_ID  = #{loginMemberId}
		 LIMIT 0, 1
	</select>

	<select id="selectListMemberDoctorOption" parameterType="hashMap" resultType="hashMap">
		SELECT MM.MU_MEMBER_ID                        AS "muMemberId"
			  ,MM.NAME                                AS "memberName"
			  ,MM.MU_GROUP_ID                         AS "muGroupId"
			  ,IFNULL((SELECT MG.GROUP_NAME
						 FROM MU_GROUP AS MG
						WHERE MG.USE_YN      = 'Y'
			 			  AND MG.MU_GROUP_ID = MM.MU_GROUP_ID
			 			LIMIT 0, 1
			   ),'')                                  AS "groupName"
			  ,MM.TYPE                                AS "type"
			  ,CASE MM.TYPE
					WHEN 'D'  THEN '닥터'
					WHEN 'A'  THEN '상담'
					WHEN 'E'  THEN '직원'
					ELSE ''
			   END                                    AS "typeName"
		  FROM MU_MEMBER AS MM
		 WHERE MM.USE_YN         = 'Y'
		   AND MM.STATUS         = 'Y'
		   AND MM.TYPE           = 'D'
 	  ORDER BY MM.NAME ASC
	</select>

	<select id="selectListMemberDoctorConsultingOption" parameterType="hashMap" resultType="hashMap">
		SELECT MM.MU_MEMBER_ID              AS "muMemberId"
			  ,MM.NAME                      AS "memberName"
			  ,MM.TYPE                      AS "type"
			  ,CASE MM.TYPE
					WHEN 'D'  THEN '닥터'
					WHEN 'A'  THEN '상담'
					WHEN 'E'  THEN '직원'
					ELSE ''
			   END                          AS "typeName"
		  FROM (
					<!-- 해당 시술 닥터 -->
					SELECT MM.MU_MEMBER_ID
						  ,MM.NAME
						  ,MM.TYPE
   						  ,MM.ORDER_NUMBER
					  FROM MU_MEMBER AS MM
				INNER JOIN MU_TREATMENT_PROCEDURE_DOCTOR AS MTPD
						ON MM.MU_MEMBER_ID = MTPD.MU_MEMBER_ID
					   AND MM.USE_YN                      = 'Y'
					   AND MM.STATUS                      = 'Y'
					   AND MM.TYPE                        = 'D'
					   AND MTPD.USE_YN                    = 'Y'
					   AND MTPD.MU_TREATMENT_PROCEDURE_ID IN(${muTreatmentProcedureIdList})
					 UNION
					 <!-- 상담자 -->
					SELECT MM.MU_MEMBER_ID
						  ,MM.NAME
						  ,MM.TYPE
						  ,MM.ORDER_NUMBER
					  FROM MU_MEMBER AS MM
					 WHERE MM.USE_YN   = 'Y'
					   AND MM.STATUS   = 'Y'
					   AND MM.TYPE     = 'A'
					   AND MM.MU_GROUP_ID IN (SELECT MU_GROUP_ID
                                                FROM MU_GROUP MG
                                               WHERE MG.USE_YN='Y'
                                                 AND MG.GROUP_NAME IN (SELECT TREATMENT_NAME
                                                                         FROM MU_TREATMENT AS MT
                                                                         JOIN MU_TREATMENT_PROCEDURE MTP
                                                                           ON MT.MU_TREATMENT_ID=MTP.MU_TREATMENT_ID
                                                                          AND MT.USE_YN                     = 'Y'
                                                                          AND MTP.MU_TREATMENT_PROCEDURE_ID IN (${muTreatmentProcedureIdList})))
			   ) AS MM
		 <!-- 휴무/연차 아닌 직원 -->
		   <if test="searchDate != null and searchDate != ''">
		 WHERE MM.MU_MEMBER_ID NOT IN (SELECT MA.MU_MEMBER_ID
										 FROM MU_ATTENDANCE AS MA
										WHERE MA.USE_YN           = 'Y'
										  AND MA.STATUS          != 'D'
										  AND MA.ATTENDANCE_TYPE IN ('C', 'D')
										  AND DATE_FORMAT(MA.START_DATE, '%Y-%m-%d') &lt;= #{searchDate}
										  AND DATE_FORMAT(MA.END_DATE, '%Y-%m-%d')   &gt;= #{searchDate}

								    UNION ALL

			                           SELECT MA.MU_MEMBER_ID
			                             FROM MU_ATTENDANCE AS MA
										WHERE MA.USE_YN           = 'Y'
										  AND MA.STATUS          != 'D'
										  AND MA.ATTENDANCE_TYPE IN ('E')
										  AND DATE_FORMAT(CONCAT(MA.START_DATE, ' ', MA.START_TIME), '%Y-%m-%d %H:%i') &lt;= CONCAT(#{searchDate}, ' ', #{searchTime})
										  AND DATE_FORMAT(CONCAT(MA.END_DATE, ' ', MA.END_TIME), '%Y-%m-%d %H:%i') &gt;= CONCAT(#{searchDate}, ' ', #{searchTime})
									  )
		   </if>
 	  ORDER BY MM.TYPE DESC, MM.ORDER_NUMBER ASC
	</select>
	
	<select id="selectListMemberDoctorConsultingOption2" parameterType="hashMap" resultType="hashMap">
		SELECT MM.MU_MEMBER_ID                        AS "muMemberId"
			  ,MM.MEMBER_CODE                         AS "memberCode"
			  ,MM.NAME                                AS "memberName"
			  ,MM.TYPE                                AS "type"
			  ,CASE MM.TYPE
					WHEN 'D'  THEN '닥터'
					WHEN 'A'  THEN '상담'
					WHEN 'E'  THEN '직원'
					ELSE ''
			   END                                    AS "typeName"
		  FROM MU_MEMBER AS MM
		 WHERE MM.USE_YN         = 'Y'
		   AND MM.STATUS         = 'Y'
		   AND MM.TYPE IN ('A', 'D')
 	  ORDER BY MM.ORDER_NUMBER DESC, MM.NAME ASC
	</select>

	<select id="selectTotalMemberCount" parameterType="hashmap" resultType="hashmap">
		SELECT COUNT(*)  AS "totalCount"
		  FROM MU_MEMBER AS MM
		 WHERE MM.USE_YN = 'Y'
		   <if test="memberSearchKeywordParam != null and memberSearchKeywordParam != ''">
		   AND (MM.NAME LIKE CONCAT('%',TRIM(#{memberSearchKeywordParam}),'%')
			OR MM.EMAIL LIKE CONCAT('%',TRIM(#{memberSearchKeywordParam}),'%')
			OR MM.PHONE_NUMBER LIKE CONCAT('%',TRIM(#{memberSearchKeywordParam}),'%'))
		   </if>
		   <if test="memberSearchGroupId != null and memberSearchGroupId != ''">
		   AND MM.MU_GROUP_ID  = #{memberSearchGroupId}
		   </if>
		   <if test="memberSearchDutyId != null and memberSearchDutyId != ''">
		   AND MM.MU_DUTY_ID = #{memberSearchDutyId}
		   </if>
		   <if test="memberSearchAuthId != null and memberSearchAuthId != ''">
		   AND MM.MU_AUTH_ID   = #{memberSearchAuthId}
		   </if>
	</select>
	
	<select id="selectListMember" parameterType="hashmap" resultType="hashmap">
		SELECT MM.MU_MEMBER_ID                        AS "muMemberId"
              ,MM.ORDER_NUMBER						  AS "orderNumber"
			  ,MM.MEMBER_CODE                         AS "memberCode"
			  ,MM.LOGIN_ID                            AS "loginId"
			  ,MM.NAME                                AS "memberName"
			  ,MM.PHONE_NUMBER                        AS "phoneNumber"
			  ,MM.EMAIL                               AS "email"
			  ,CASE MM.STATUS
					WHEN 'Y'  THEN '활성'
					WHEN 'N'  THEN '비활성'
			   END                                    AS "status"
			  ,MM.MU_AUTH_ID                          AS "muAuthId"
			  ,IFNULL((SELECT MA.AUTH_NAME
						 FROM MU_AUTH AS MA
						WHERE MA.USE_YN      = 'Y'
						  AND MA.MU_AUTH_ID = MM.MU_AUTH_ID
						LIMIT 0, 1
			   ),'')                                  AS "authName"
			  ,MM.MU_GROUP_ID                         AS "muGroupId"
			  ,IFNULL((SELECT MG.GROUP_NAME
						 FROM MU_GROUP AS MG
						WHERE MG.USE_YN      = 'Y'
						  AND MG.MU_GROUP_ID = MM.MU_GROUP_ID
						LIMIT 0, 1
			   ),'')                                  AS "groupName"
			  ,MM.MU_DUTY_ID                          AS "muDutyId"
			  ,IFNULL((SELECT MD.DUTY_NAME
						 FROM MU_DUTY AS MD
						WHERE MD.USE_YN      = 'Y'
						  AND MD.MU_DUTY_ID = MM.MU_DUTY_ID
						LIMIT 0, 1
			   ),'')                                  AS "dutyName"
			   ,CASE MM.TYPE
                    WHEN 'D'  THEN '닥터'
                    WHEN 'A'  THEN '상담'
                    WHEN 'E'  THEN '직원'
                    ELSE ''
               END                                    AS "typeName"
			  ,DATE_FORMAT(MM.WRITE_DATE, '%Y-%m-%d') AS "writeDate"
		  FROM MU_MEMBER AS MM
		 WHERE MM.USE_YN = 'Y'
		   <if test="memberSearchKeywordParam != null and memberSearchKeywordParam != ''">
		   AND (MM.NAME LIKE CONCAT('%',TRIM(#{memberSearchKeywordParam}),'%')
			OR MM.EMAIL LIKE CONCAT('%',TRIM(#{memberSearchKeywordParam}),'%')
			OR MM.PHONE_NUMBER LIKE CONCAT('%',TRIM(#{memberSearchKeywordParam}),'%'))
		   </if>
		   <if test="memberSearchGroupId != null and memberSearchGroupId != ''">
		   AND MM.MU_GROUP_ID  = #{memberSearchGroupId}
		   </if>
		   <if test="memberSearchDutyId != null and memberSearchDutyId != ''">
		   AND MM.MU_DUTY_ID = #{memberSearchDutyId}
		   </if>
		   <if test="memberSearchAuthId != null and memberSearchAuthId != ''">
		   AND MM.MU_AUTH_ID   = #{memberSearchAuthId}
		   </if>
		 <choose>
		 <when test="memberSort != null and memberSort != ''">
	  ORDER BY ${memberSort}
		 </when>
		 <otherwise>
	  ORDER BY MM.ORDER_NUMBER
		 </otherwise>
		 </choose>
		<if test="memberStart != null and memberStart != ''">
			LIMIT ${memberStart}
			<if test="memberLimit != null and memberLimit != ''">
				,${memberLimit}
			</if>
		</if>
	</select>
	
	<select id="selectMember" parameterType="hashMap" resultType="hashMap">
		SELECT MM.MU_MEMBER_ID                        AS "muMemberId"
			  ,MM.ORDER_NUMBER					      AS "orderNumber"
			  ,MM.MEMBER_CODE                         AS "memberCode"
			  ,MM.LOGIN_ID                            AS "loginId"
			  ,MM.NAME                                AS "memberName"
			  ,MM.PHONE_NUMBER                        AS "phoneNumber"
			  ,MM.EMAIL                               AS "email"
			  ,MM.STATUS                              AS "status"
			  ,MM.MU_AUTH_ID                          AS "muAuthId"
			  ,IFNULL((SELECT MA.AUTH_NAME
						 FROM MU_AUTH AS MA
						WHERE MA.USE_YN      = 'Y'
			 			  AND MA.MU_AUTH_ID = MM.MU_AUTH_ID
			 			LIMIT 0, 1
			   ),'')                                  AS "authName"
			  ,MM.MU_GROUP_ID                         AS "muGroupId"
			  ,IFNULL((SELECT MG.GROUP_NAME
						 FROM MU_GROUP AS MG
						WHERE MG.USE_YN      = 'Y'
			 			  AND MG.MU_GROUP_ID = MM.MU_GROUP_ID
			 			LIMIT 0, 1
			   ),'')                                  AS "groupName"
			  ,MM.MU_DUTY_ID                          AS "muDutyId"
			  ,IFNULL((SELECT MD.DUTY_NAME
						 FROM MU_DUTY AS MD
						WHERE MD.USE_YN     = 'Y'
			 			  AND MD.MU_DUTY_ID = MM.MU_DUTY_ID
			 			LIMIT 0, 1
			   ),'')                                  AS "dutyName"
			  ,MM.TYPE                                AS "type"
			  ,CASE MM.TYPE
					WHEN 'D'  THEN '닥터'
					WHEN 'A'  THEN '상담'
					WHEN 'E'  THEN '직원'
					ELSE ''
			   END                                    AS "typeName"
			  ,DATE_FORMAT(MM.WRITE_DATE, '%Y-%m-%d') AS "writeDate"
		  FROM MU_MEMBER AS MM
 		 WHERE MM.USE_YN        = 'Y'
		   AND MM.MU_MEMBER_ID  = #{muMemberId}
	</select>
	
	<select id="selectListMemberExcel" parameterType="hashmap" resultType="hashmap">
		SELECT MM.*
		  FROM (
					SELECT MM.*
						  ,CAST(@RNUM:=@RNUM + 1 AS CHAR) AS "rowNum"
					  FROM (
								SELECT MM.MU_MEMBER_ID                        AS "muMemberId"
									  ,MM.MEMBER_CODE                         AS "memberCode"
									  ,MM.LOGIN_ID                            AS "loginId"
									  ,MM.NAME                                AS "memberName"
									  ,MM.PHONE_NUMBER                        AS "phoneNumber"
									  ,MM.EMAIL                               AS "email"
									  ,CASE MM.STATUS
											WHEN 'Y'  THEN '활성'
											WHEN 'N'  THEN '비활성'
									   END                                    AS "status"
									  ,MM.MU_AUTH_ID                          AS "muAuthId"
									  ,IFNULL((SELECT MA.AUTH_NAME
												 FROM MU_AUTH AS MA
												WHERE MA.USE_YN      = 'Y'
									 			  AND MA.MU_AUTH_ID = MM.MU_AUTH_ID
									 			LIMIT 0, 1
									   ),'')                                  AS "authName"
									  ,MM.MU_GROUP_ID                         AS "muGroupId"
									  ,IFNULL((SELECT MG.GROUP_NAME
												 FROM MU_GROUP AS MG
												WHERE MG.USE_YN      = 'Y'
									 			  AND MG.MU_GROUP_ID = MM.MU_GROUP_ID
									 			LIMIT 0, 1
									   ),'')                                  AS "groupName"
									  ,MM.MU_DUTY_ID                          AS "muDutyId"
									  ,IFNULL((SELECT MD.DUTY_NAME
												 FROM MU_DUTY AS MD
												WHERE MD.USE_YN     = 'Y'
									 			  AND MD.MU_DUTY_ID = MM.MU_DUTY_ID
									 			LIMIT 0, 1
									   ),'')                                  AS "dutyName"
									  ,CASE MM.TYPE
											WHEN 'D'  THEN '닥터'
											WHEN 'A'  THEN '상담'
											WHEN 'E'  THEN '직원'
											ELSE ''
									   END                                    AS "typeName"
									  ,DATE_FORMAT(MM.WRITE_DATE, '%Y-%m-%d') AS "writeDate"
								  FROM MU_MEMBER AS MM
								 WHERE MM.USE_YN = 'Y'
								   <if test="memberSearchKeywordParam != null and memberSearchKeywordParam != ''">
								   AND (MM.NAME LIKE CONCAT('%',TRIM(#{memberSearchKeywordParam}),'%')
									OR MM.EMAIL LIKE CONCAT('%',TRIM(#{memberSearchKeywordParam}),'%')
									OR MM.PHONE_NUMBER LIKE CONCAT('%',TRIM(#{memberSearchKeywordParam}),'%'))
								   </if>
								   <if test="memberSearchGroupId != null and memberSearchGroupId != ''">
								   AND MM.MU_GROUP_ID  = #{memberSearchGroupId}
								   </if>
								   <if test="memberSearchDutyId != null and memberSearchDutyId != ''">
								   AND MM.MU_DUTY_ID = #{memberSearchDutyId}
								   </if>
								   <if test="memberSearchAuthId != null and memberSearchAuthId != ''">
								   AND MM.MU_AUTH_ID   = #{memberSearchAuthId}
								   </if>
								 <choose>
								 <when test="memberSort != null and memberSort != ''">
							  ORDER BY ${memberSort}
								 </when>
								 <otherwise>
							  ORDER BY MM.WRITE_DATE DESC
								 </otherwise>
								 </choose>
								 LIMIT 18446744073709551615
						   ) MM, (SELECT @RNUM:=0) R
					 WHERE 1 = 1
			   ) MM
		 WHERE 1 = 1
	</select>
	
	<select id="selectMemberPassword" parameterType="hashMap" resultType="hashMap">
		SELECT count(*)    AS "totalCount"
		  FROM MU_MEMBER AS MM
 		 WHERE MM.USE_YN        = 'Y'
		   AND MM.MU_MEMBER_ID  = #{muMemberId}
		   AND MM.PASSWORD      = #{password}
	</select>
	
	<select id="selectMemberAvailableYn" parameterType="hashMap" resultType="hashMap">
		SELECT MM.MU_MEMBER_ID              AS "muMemberId"
			  ,MM.NAME                      AS "memberName"
			  ,MM.TYPE                      AS "type"
			  ,CASE MM.TYPE
					WHEN 'D'  THEN '닥터'
					WHEN 'A'  THEN '상담'
					WHEN 'E'  THEN '직원'
					ELSE ''
			   END                          AS "typeName"
		  FROM (
					<!-- 해당 시술 닥터 -->
					SELECT MM.MU_MEMBER_ID
						  ,MM.NAME
						  ,MM.TYPE
					  FROM MU_MEMBER AS MM
				INNER JOIN MU_TREATMENT_PROCEDURE_DOCTOR AS MTPD
						ON MM.MU_MEMBER_ID = MTPD.MU_MEMBER_ID
					   AND MM.USE_YN                      = 'Y'
					   AND MM.STATUS                      = 'Y'
					   AND MM.TYPE                        = 'D'
					   AND MTPD.USE_YN                    = 'Y'
					   AND MTPD.MU_TREATMENT_PROCEDURE_ID = #{muTreatmentProcedureId}
					   AND MM.MEMBER_CODE                 = #{memberCode}
					 UNION
					 <!-- 상담자 -->
					SELECT MM.MU_MEMBER_ID
						  ,MM.NAME
						  ,MM.TYPE
					 FROM  MU_MEMBER AS MM
					 WHERE MM.USE_YN                      = 'Y'
					   AND MM.STATUS                      = 'Y'
					   AND MM.TYPE                        = 'A'
					   AND MM.MEMBER_CODE                 = #{memberCode}
					   AND MM.MU_GROUP_ID IN (SELECT MU_GROUP_ID
												 FROM MU_GROUP MG
											     WHERE MG.USE_YN='Y'
					                             AND MG.GROUP_NAME IN(SELECT TREATMENT_NAME
                                                                 FROM MU_TREATMENT AS MT
                                                                 JOIN MU_TREATMENT_PROCEDURE MTP
                                                                 ON MT.MU_TREATMENT_ID=MTP.MU_TREATMENT_ID
                                                                   AND MT.USE_YN                      = 'Y'
                                                                   AND MTP.MU_TREATMENT_PROCEDURE_ID = #{muTreatmentProcedureId}
                                                                 )
											 )
			   ) AS MM
		 WHERE MM.MU_MEMBER_ID NOT IN (SELECT MA.MU_MEMBER_ID
										 FROM MU_ATTENDANCE AS MA
										WHERE MA.USE_YN           = 'Y'
										  AND MA.STATUS          != 'D'
										  AND MA.ATTENDANCE_TYPE IN ('C', 'D')
										  AND DATE_FORMAT(MA.START_DATE, '%Y-%m-%d') &lt;= #{searchDate}
										  AND DATE_FORMAT(MA.END_DATE, '%Y-%m-%d')   &gt;= #{searchDate}
									  )
 	  ORDER BY MM.TYPE DESC, MM.NAME ASC
 		 LIMIT 0, 1
	</select>
	
	<select id="selectMemberCountSeq" parameterType="hashmap" resultType="hashmap">
		SELECT CONCAT('M', LPAD((SELECT NEXTVAL(MU_MEMBER_COUNT_SEQ)), 4, 0)) AS "memberCode"
	</select>
	
	<insert id="insertMember" parameterType="hashmap">
		<selectKey resultType="string" keyProperty="id" order="BEFORE">
			SELECT CONCAT(#{muMemberId},LPAD((SELECT NEXTVAL(MU_MEMBER_SEQ)), 11, 0))
		</selectKey>
		INSERT INTO MU_MEMBER(
					 ORDER_NUMBER
					,MU_MEMBER_ID
					,MEMBER_CODE
					,LOGIN_ID
					,PASSWORD
					,NAME
					,PHONE_NUMBER
					,EMAIL
					,STATUS
					,MU_GROUP_ID
					,MU_DUTY_ID
					,MU_AUTH_ID
					,TYPE
					,WRITE_DATE
					,WRITE_TIME
					,CUD_FLAG
					,USE_YN
					,REG_ID
					,REG_DATE
					,MOD_ID
					,MOD_DATE
					,T_ID
					,T_DATE
		)VALUES(
					 #{orderNumber}
					,#{id}
					,#{memberCode}
					,#{loginId}
					,#{password}
					,#{memberName}
					,#{phoneNumber}
					,#{email}
					,#{status}
					,#{muGroupId}
					,#{muDutyId}
					,#{muAuthId}
					,#{type}
					,CURDATE()
					,CURTIME()
					,'C'
					,'Y'
					,#{regId}
					,NOW()
					,#{modId}
					,NOW()
					,#{tId}
					,#{tDate}
		)
	</insert>
	
	<update id="updateMember" parameterType="hashmap">
		UPDATE MU_MEMBER
		   SET MOD_ID              = #{modId}
			  ,MOD_DATE            = NOW()
			  ,CUD_FLAG            = 'U'
 			  ,NAME                = #{memberName}
 			  ,ORDER_NUMBER         = #{orderNumber}
 			  ,PHONE_NUMBER        = #{phoneNumber}
 			  ,EMAIL               = #{email}
 			  ,MU_GROUP_ID         = #{muGroupId}
 			  ,MU_DUTY_ID          = #{muDutyId}
 			  ,MU_AUTH_ID          = #{muAuthId}
 			  ,TYPE                = #{type}
		 WHERE USE_YN        = 'Y'
		   AND MU_MEMBER_ID  = #{muMemberId}
	</update>

	<update id="updateMemberOrderNumber" parameterType="hashmap">
		UPDATE MU_MEMBER AS MM
		   SET ORDER_NUMBER = (SELECT NUM.NEW_ORDER_NUMBER  AS newOrderNumber
								 FROM (
									   SELECT MM2.MU_MEMBER_ID                                   AS MU_MEMBER_ID
											 ,ROW_NUMBER() OVER (ORDER BY MM2.ORDER_NUMBER ASC
											                             ,MM2.MOD_DATE DESC)     AS NEW_ORDER_NUMBER
										 FROM MU_MEMBER AS MM2
								 ) AS NUM
								WHERE MM.MU_MEMBER_ID = NUM.MU_MEMBER_ID)
		 WHERE 1 = 1
	</update>
	
	<update id="updateMemberStatus" parameterType="hashmap">
		UPDATE MU_MEMBER
		   SET MOD_ID              = #{modId}
			  ,MOD_DATE            = NOW()
			  ,CUD_FLAG            = 'U'
 			  ,STATUS              = #{status}
		 WHERE USE_YN        	   = 'Y'
		   AND MU_MEMBER_ID        = #{muMemberId}
	</update>
	
	<update id="updateMemberPassword" parameterType="hashmap">
		UPDATE MU_MEMBER
		   SET MOD_ID              = #{modId}
			  ,MOD_DATE            = NOW()
			  ,CUD_FLAG            = 'U'
 			  ,PASSWORD            = #{password}
		 WHERE USE_YN        = 'Y'
		   AND MU_MEMBER_ID  = #{muMemberId}
	</update>
	
	<update id="deleteMember" parameterType="hashmap">
		UPDATE MU_MEMBER
		   SET MOD_ID            = #{modId}
			  ,MOD_DATE	         = NOW()
			  ,CUD_FLAG          = 'D'
			  ,USE_YN            = 'N'
		 WHERE USE_YN        = 'Y'
		   AND MU_MEMBER_ID  = #{muMemberId}
	</update>
</mapper>