/*为权限生成layercode*/
SELECT
	CONCAT(
	"INSERT INTO auth_privilege ( APPLICATION_ID, PRIVILEGE_KEY, PRIVILEGE_NAME, PRIVILEGE_TYPE_DICT, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME,PRIVILEGE_DISPLAY_ORDER,PRIVILEGE_PARENT_ID,PRIVILEGE_ICON,PRIVILEGE_URL,PRIVILEGE_STATUS ) (SELECT ",
	APPLICATION_ID,
	",'",
	PRIVILEGE_KEY,
	"','",
	PRIVILEGE_NAME,
	"','",
	PRIVILEGE_TYPE_DICT,
	"','1',now(),'1',now(),",
	PRIVILEGE_DISPLAY_ORDER,
	",(SELECT max(PRIVILEGE_ID) FROM auth_privilege WHERE PRIVILEGE_KEY='父权限标识'),'",
	PRIVILEGE_ICON,
	"','",
	PRIVILEGE_URL,
	"','",
	PRIVILEGE_STATUS,
	"' FROM DUAL);"
) AS psql
FROM
	auth_privilege
WHERE
	application_id = 2
	AND privilege_key = '当前权限标识'
ORDER BY
	privilege_layer_code;