<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:og="hybs-taglib.tld"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	version="2.0">
<jsp:directive.page language="java" contentType="text/html; charset=UTF-8" />

<og:head headType="init" />
<og:comment
	system   = "GE:エンジンサンプル"
	pgid     = "GE0017"
	title    = "ロールマスタ"
	date     = "2007/12/12"
	author   = "K.HASEGAWA"
	text     = "ZZZZ"
	version  = "001"
/>

<!-- history.back() で戻るボタンを表示します。	-->
<jsp:directive.include file="/jsp/common/history_back.jsp" />

<og:columnCheck command="{@command}" />
<og:entry command="{@command}" />

<og:equals val1="{@direct}" nullCheck="true">
	<og:value command = "SETTBL" key = "USERID" separator="','" action = "APPEND"/>

	<og:tableUpdate
		command			= "{@command}"
		queryType		= "JDBCTableUpdate"
		commitTableModel= "false"
		selectedAll		= "true">
		<jsp:text>
			update GEA10 set
			{@KEY_ROLES} = '--'
			where SYSTEM_ID = [SYSTEM_ID]
			and USERID = [USERID]
			and FGJ = '1'
			and USERID in ('{@USERID}')
		</jsp:text>
	</og:tableUpdate>

	<og:tableFilter classId="ROTATE" selectedAll="true"
		keys="ROTATE_CLM,KEY_CLM,VALUE_CLM,REVERSE" vals='TMP_ROLE,"SYSTEM_ID,USERID,NAME_JA,{@KEY_ROLES},UNIQ",IS_CHECK,true' />

	<og:tableUpdate
		command			= "{@command}"
		queryType		= "JDBCTableUpdate"
		selectedAll		= "true">
		<jsp:text>
			update GEA10 set
			{@KEY_ROLES} = case
				when [IS_CHECK] = '0' then {@KEY_ROLES}
				when [IS_CHECK] = '1' and {@KEY_ROLES} = '--' then SUBSTR([TMP_ROLE],5)
				else {@KEY_ROLES}{@DBF.CON}'|'{@DBF.CON}SUBSTR([TMP_ROLE],5) end
			,DYUPD = '{@USER.YMDH}'
			,USRUPD = '{@USER.ID}'
			,PGUPD = '{@GUI.KEY}'
			where SYSTEM_ID = [SYSTEM_ID]
			and USERID = [USERID]
			and FGJ = '1'
			and USERID in ('{@USERID}')
		</jsp:text>
	</og:tableUpdate>

	<og:value command = "REMOVE" key = "USERID" />
</og:equals>

<og:equals val1="{@direct}" nullCheck="true" notEquals="true">
	<og:tableUpdate
		command			= "{@command}"
		queryType		= "JDBCTableUpdate">
		<jsp:text>
			update GEA10 set
			{@KEY_ROLES} = [{@KEY_ROLES}]
			,DYUPD = '{@USER.YMDH}'
			,USRUPD = '{@USER.ID}'
			,PGUPD = '{@GUI.KEY}'
			where SYSTEM_ID = [SYSTEM_ID]
			and USERID = [USERID]
			and FGJ = '1'
		</jsp:text>
	</og:tableUpdate>
</og:equals>

<og:forward page="result.jsp" keys="command" vals="RENEW" />

<jsp:directive.include file="/jsp/common/htmlend.jsp" />
</jsp:root>
