INSERT INTO sys_role (
		create_by,
		create_time,
		update_by,
		update_time,
		role_id,
		role_name,
		role_remark,
		company_id,
		plates,
		is_default,
		shop_able
		)
		VALUES (
		#{createBy},
		now(),
		#{updateBy},
		now(),
		#{roleId},
		#{roleName},
		#{roleRemark},
		#{companyId},
		#{plates},
		#{isDefault},
		#{shopAble}
		)
	
	
	
		INSERT INTO sys_role (
		create_by,
		create_time,
		update_by,
		update_time,
		role_id,
		role_name,
		role_remark,
		company_id,
		plates,
		is_default,
		shop_able
		)
		VALUES
		(
			#{item.createBy},
			now(),
			#{item.updateBy},
			now(),
			#{item.roleId},
			#{item.roleName},
			#{item.roleRemark},
			#{item.companyId},
			#{item.plates},
			#{item.isDefault},
			#{item.shopAble}
			)
		
	
	
	
		UPDATE sys_role
		
			update_time=now(),
			
				update_by=#{updateBy},
			
			
				role_name = #{roleName},
			
			
				role_remark = #{roleRemark},
			
			
				company_id = #{companyId},
			
			
				plates = #{plates},
			
			
				shop_able = #{shopAble},
			
		
		WHERE role_id=#{roleId}
	
	
	
		UPDATE sys_role
		
			update_time=now(),
			
				update_by = #{btnKey},
			
			
				role_name = #{roleName},
			
			
				role_remark = #{roleRemark},
			
			
				company_id = #{companyId},
			
			
				plates = #{plates},
			
			
				shop_able = #{shopAble},
			
		
		WHERE role_id=#{roleId}
	
	
	
		delete from sys_role where is_default =2 and  role_id in
		
			#{item}
		
	
	
	
		DELETE FROM sys_role
		where
		 is_default =2 and
		role_id=#{roleId}
	
	
	
		DELETE FROM sys_role
		
			
				
					and role_id = #{record.roleId}
				
				
					and role_name = #{record.roleName}
				
				
					and role_remark = #{record.roleRemark}
				
				
					and company_id = #{record.companyId}
				
				
					and plates = #{record.plates}
				
				and is_default=2